]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
sched: cleanup, use NSEC_PER_MSEC and NSEC_PER_SEC
authorEric Dumazet <dada1@cosmosbay.com>
Fri, 9 Nov 2007 21:39:38 +0000 (22:39 +0100)
committerIngo Molnar <mingo@elte.hu>
Fri, 9 Nov 2007 21:39:38 +0000 (22:39 +0100)
1) hardcoded 1000000000 value is used five times in places where
   NSEC_PER_SEC might be more readable.

2) A conversion from nsec to msec uses the hardcoded 1000000 value,
   which is a candidate for NSEC_PER_MSEC.

no code changed:

    text    data     bss     dec     hex filename
   44359    3326      36   47721    ba69 sched.o.before
   44359    3326      36   47721    ba69 sched.o.after

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/sched.c
kernel/sysctl.c

index 69cae271c63b98a67999319f5726cd906200d15c..387258cdd0b9bd6709ad8a992b64c104d87f03be 100644 (file)
@@ -75,7 +75,7 @@
  */
 unsigned long long __attribute__((weak)) sched_clock(void)
 {
-       return (unsigned long long)jiffies * (1000000000 / HZ);
+       return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ);
 }
 
 /*
@@ -99,8 +99,8 @@ unsigned long long __attribute__((weak)) sched_clock(void)
 /*
  * Some helpers for converting nanosecond timing to jiffy resolution
  */
-#define NS_TO_JIFFIES(TIME)    ((unsigned long)(TIME) / (1000000000 / HZ))
-#define JIFFIES_TO_NS(TIME)    ((TIME) * (1000000000 / HZ))
+#define NS_TO_JIFFIES(TIME)    ((unsigned long)(TIME) / (NSEC_PER_SEC / HZ))
+#define JIFFIES_TO_NS(TIME)    ((TIME) * (NSEC_PER_SEC / HZ))
 
 #define NICE_0_LOAD            SCHED_LOAD_SCALE
 #define NICE_0_SHIFT           SCHED_LOAD_SHIFT
@@ -7256,7 +7256,7 @@ static u64 cpu_usage_read(struct cgroup *cgrp, struct cftype *cft)
                spin_unlock_irqrestore(&cpu_rq(i)->lock, flags);
        }
        /* Convert from ns to ms */
-       do_div(res, 1000000);
+       do_div(res, NSEC_PER_MSEC);
 
        return res;
 }
index 6e3b63c06856d89b10b161dc1bc1c309d02ff911..adddf682d4cbedf5a1017aa0f7d7ec713915e2c5 100644 (file)
@@ -226,9 +226,9 @@ static struct ctl_table root_table[] = {
 
 #ifdef CONFIG_SCHED_DEBUG
 static unsigned long min_sched_granularity_ns = 100000;                /* 100 usecs */
-static unsigned long max_sched_granularity_ns = 1000000000;    /* 1 second */
+static unsigned long max_sched_granularity_ns = NSEC_PER_SEC;  /* 1 second */
 static unsigned long min_wakeup_granularity_ns;                        /* 0 usecs */
-static unsigned long max_wakeup_granularity_ns = 1000000000;   /* 1 second */
+static unsigned long max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
 #endif
 
 static struct ctl_table kern_table[] = {