Explorar o código

Merge branch 'timers/nohz-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks into timers/nohz

Pull more full-dynticks updates from Frederic Weisbecker:

 * Get rid of the passive dependency on VIRT_CPU_ACCOUNTING_GEN (finally!)
 * Preparation patch to remove the dependency on CONFIG_64BITS

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Ingo Molnar %!s(int64=12) %!d(string=hai) anos
pai
achega
a1412ec539
Modificáronse 3 ficheiros con 25 adicións e 13 borrados
  1. 19 9
      include/asm-generic/cputime_nsecs.h
  2. 3 3
      init/Kconfig
  3. 3 1
      kernel/time/Kconfig

+ 19 - 9
include/asm-generic/cputime_nsecs.h

@@ -16,21 +16,27 @@
 #ifndef _ASM_GENERIC_CPUTIME_NSECS_H
 #ifndef _ASM_GENERIC_CPUTIME_NSECS_H
 #define _ASM_GENERIC_CPUTIME_NSECS_H
 #define _ASM_GENERIC_CPUTIME_NSECS_H
 
 
+#include <linux/math64.h>
+
 typedef u64 __nocast cputime_t;
 typedef u64 __nocast cputime_t;
 typedef u64 __nocast cputime64_t;
 typedef u64 __nocast cputime64_t;
 
 
 #define cputime_one_jiffy		jiffies_to_cputime(1)
 #define cputime_one_jiffy		jiffies_to_cputime(1)
 
 
+#define cputime_div(__ct, divisor)  div_u64((__force u64)__ct, divisor)
+#define cputime_div_rem(__ct, divisor, remainder) \
+	div_u64_rem((__force u64)__ct, divisor, remainder);
+
 /*
 /*
  * Convert cputime <-> jiffies (HZ)
  * Convert cputime <-> jiffies (HZ)
  */
  */
 #define cputime_to_jiffies(__ct)	\
 #define cputime_to_jiffies(__ct)	\
-	((__force u64)(__ct) / (NSEC_PER_SEC / HZ))
+	cputime_div(__ct, NSEC_PER_SEC / HZ)
 #define cputime_to_scaled(__ct)		(__ct)
 #define cputime_to_scaled(__ct)		(__ct)
 #define jiffies_to_cputime(__jif)	\
 #define jiffies_to_cputime(__jif)	\
 	(__force cputime_t)((__jif) * (NSEC_PER_SEC / HZ))
 	(__force cputime_t)((__jif) * (NSEC_PER_SEC / HZ))
 #define cputime64_to_jiffies64(__ct)	\
 #define cputime64_to_jiffies64(__ct)	\
-	((__force u64)(__ct) / (NSEC_PER_SEC / HZ))
+	cputime_div(__ct, NSEC_PER_SEC / HZ)
 #define jiffies64_to_cputime64(__jif)	\
 #define jiffies64_to_cputime64(__jif)	\
 	(__force cputime64_t)((__jif) * (NSEC_PER_SEC / HZ))
 	(__force cputime64_t)((__jif) * (NSEC_PER_SEC / HZ))
 
 
@@ -45,7 +51,7 @@ typedef u64 __nocast cputime64_t;
  * Convert cputime <-> microseconds
  * Convert cputime <-> microseconds
  */
  */
 #define cputime_to_usecs(__ct)		\
 #define cputime_to_usecs(__ct)		\
-	((__force u64)(__ct) / NSEC_PER_USEC)
+	cputime_div(__ct, NSEC_PER_USEC)
 #define usecs_to_cputime(__usecs)	\
 #define usecs_to_cputime(__usecs)	\
 	(__force cputime_t)((__usecs) * NSEC_PER_USEC)
 	(__force cputime_t)((__usecs) * NSEC_PER_USEC)
 #define usecs_to_cputime64(__usecs)	\
 #define usecs_to_cputime64(__usecs)	\
@@ -55,7 +61,7 @@ typedef u64 __nocast cputime64_t;
  * Convert cputime <-> seconds
  * Convert cputime <-> seconds
  */
  */
 #define cputime_to_secs(__ct)		\
 #define cputime_to_secs(__ct)		\
-	((__force u64)(__ct) / NSEC_PER_SEC)
+	cputime_div(__ct, NSEC_PER_SEC)
 #define secs_to_cputime(__secs)		\
 #define secs_to_cputime(__secs)		\
 	(__force cputime_t)((__secs) * NSEC_PER_SEC)
 	(__force cputime_t)((__secs) * NSEC_PER_SEC)
 
 
@@ -69,8 +75,10 @@ static inline cputime_t timespec_to_cputime(const struct timespec *val)
 }
 }
 static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val)
 static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val)
 {
 {
-	val->tv_sec  = (__force u64) ct / NSEC_PER_SEC;
-	val->tv_nsec = (__force u64) ct % NSEC_PER_SEC;
+	u32 rem;
+
+	val->tv_sec = cputime_div_rem(ct, NSEC_PER_SEC, &rem);
+	val->tv_nsec = rem;
 }
 }
 
 
 /*
 /*
@@ -83,15 +91,17 @@ static inline cputime_t timeval_to_cputime(const struct timeval *val)
 }
 }
 static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val)
 static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val)
 {
 {
-	val->tv_sec = (__force u64) ct / NSEC_PER_SEC;
-	val->tv_usec = ((__force u64) ct % NSEC_PER_SEC) / NSEC_PER_USEC;
+	u32 rem;
+
+	val->tv_sec = cputime_div_rem(ct, NSEC_PER_SEC, &rem);
+	val->tv_usec = rem / NSEC_PER_USEC;
 }
 }
 
 
 /*
 /*
  * Convert cputime <-> clock (USER_HZ)
  * Convert cputime <-> clock (USER_HZ)
  */
  */
 #define cputime_to_clock_t(__ct)	\
 #define cputime_to_clock_t(__ct)	\
-	((__force u64)(__ct) / (NSEC_PER_SEC / USER_HZ))
+	cputime_div(__ct, (NSEC_PER_SEC / USER_HZ))
 #define clock_t_to_cputime(__x)		\
 #define clock_t_to_cputime(__x)		\
 	(__force cputime_t)((__x) * (NSEC_PER_SEC / USER_HZ))
 	(__force cputime_t)((__x) * (NSEC_PER_SEC / USER_HZ))
 
 

+ 3 - 3
init/Kconfig

@@ -306,7 +306,7 @@ choice
 # Kind of a stub config for the pure tick based cputime accounting
 # Kind of a stub config for the pure tick based cputime accounting
 config TICK_CPU_ACCOUNTING
 config TICK_CPU_ACCOUNTING
 	bool "Simple tick based cputime accounting"
 	bool "Simple tick based cputime accounting"
-	depends on !S390
+	depends on !S390 && !NO_HZ_FULL
 	help
 	help
 	  This is the basic tick based cputime accounting that maintains
 	  This is the basic tick based cputime accounting that maintains
 	  statistics about user, system and idle time spent on per jiffies
 	  statistics about user, system and idle time spent on per jiffies
@@ -316,7 +316,7 @@ config TICK_CPU_ACCOUNTING
 
 
 config VIRT_CPU_ACCOUNTING_NATIVE
 config VIRT_CPU_ACCOUNTING_NATIVE
 	bool "Deterministic task and CPU time accounting"
 	bool "Deterministic task and CPU time accounting"
-	depends on HAVE_VIRT_CPU_ACCOUNTING
+	depends on HAVE_VIRT_CPU_ACCOUNTING && !NO_HZ_FULL
 	select VIRT_CPU_ACCOUNTING
 	select VIRT_CPU_ACCOUNTING
 	help
 	help
 	  Select this option to enable more accurate task and CPU time
 	  Select this option to enable more accurate task and CPU time
@@ -346,7 +346,7 @@ config VIRT_CPU_ACCOUNTING_GEN
 
 
 config IRQ_TIME_ACCOUNTING
 config IRQ_TIME_ACCOUNTING
 	bool "Fine granularity task level IRQ time accounting"
 	bool "Fine granularity task level IRQ time accounting"
-	depends on HAVE_IRQ_TIME_ACCOUNTING
+	depends on HAVE_IRQ_TIME_ACCOUNTING && !NO_HZ_FULL
 	help
 	help
 	  Select this option to enable fine granularity task irq time
 	  Select this option to enable fine granularity task irq time
 	  accounting. This is done by reading a timestamp on each
 	  accounting. This is done by reading a timestamp on each

+ 3 - 1
kernel/time/Kconfig

@@ -104,11 +104,13 @@ config NO_HZ_FULL
 	depends on SMP
 	depends on SMP
 	# RCU_USER_QS dependency
 	# RCU_USER_QS dependency
 	depends on HAVE_CONTEXT_TRACKING
 	depends on HAVE_CONTEXT_TRACKING
-	depends on VIRT_CPU_ACCOUNTING_GEN
+	# VIRT_CPU_ACCOUNTING_GEN dependency
+	depends on 64BIT
 	select NO_HZ_COMMON
 	select NO_HZ_COMMON
 	select RCU_USER_QS
 	select RCU_USER_QS
 	select RCU_NOCB_CPU
 	select RCU_NOCB_CPU
 	select RCU_NOCB_CPU_ALL
 	select RCU_NOCB_CPU_ALL
+	select VIRT_CPU_ACCOUNTING_GEN
 	select CONTEXT_TRACKING_FORCE
 	select CONTEXT_TRACKING_FORCE
 	select IRQ_WORK
 	select IRQ_WORK
 	help
 	help