Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5f6d858ecca78f71755859a346d845e302973cd1
Commit:     5f6d858ecca78f71755859a346d845e302973cd1
Parent:     b0ffd246ea947a037746e725bd461bb7e809a4b3
Author:     Peter Zijlstra <[EMAIL PROTECTED]>
AuthorDate: Mon Oct 15 17:00:12 2007 +0200
Committer:  Ingo Molnar <[EMAIL PROTECTED]>
CommitDate: Mon Oct 15 17:00:12 2007 +0200

    sched: speed up and simplify vslice calculations
    
    speed up and simplify vslice calculations.
    
    [ From: Mike Galbraith <[EMAIL PROTECTED]>: build fix ]
    
    Signed-off-by: Peter Zijlstra <[EMAIL PROTECTED]>
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
---
 include/linux/sched.h |    2 +-
 kernel/sched_debug.c  |    2 +-
 kernel/sched_fair.c   |   15 +++++++++------
 kernel/sysctl.c       |    9 +++------
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index d5daca4..97f736b 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1400,7 +1400,7 @@ extern void sched_idle_next(void);
 
 #ifdef CONFIG_SCHED_DEBUG
 extern unsigned int sysctl_sched_latency;
-extern unsigned int sysctl_sched_min_granularity;
+extern unsigned int sysctl_sched_nr_latency;
 extern unsigned int sysctl_sched_wakeup_granularity;
 extern unsigned int sysctl_sched_batch_wakeup_granularity;
 extern unsigned int sysctl_sched_child_runs_first;
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index be79cd6..995bbd3 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -210,7 +210,7 @@ static int sched_debug_show(struct seq_file *m, void *v)
 #define PN(x) \
        SEQ_printf(m, "  .%-40s: %Ld.%06ld\n", #x, SPLIT_NS(x))
        PN(sysctl_sched_latency);
-       PN(sysctl_sched_min_granularity);
+       PN(sysctl_sched_nr_latency);
        PN(sysctl_sched_wakeup_granularity);
        PN(sysctl_sched_batch_wakeup_granularity);
        PN(sysctl_sched_child_runs_first);
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index ec0569e..ae2d4b0 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -46,7 +46,7 @@ const_debug unsigned int sysctl_sched_child_runs_first = 1;
  * Minimal preemption granularity for CPU-bound tasks:
  * (default: 2 msec, units: nanoseconds)
  */
-unsigned int sysctl_sched_min_granularity __read_mostly = 2000000ULL;
+const_debug unsigned int sysctl_sched_nr_latency = 20;
 
 /*
  * sys_sched_yield() compat mode
@@ -222,8 +222,7 @@ static inline struct sched_entity 
*__pick_last_entity(struct cfs_rq *cfs_rq)
 static u64 __sched_period(unsigned long nr_running)
 {
        u64 period = sysctl_sched_latency;
-       unsigned long nr_latency =
-               sysctl_sched_latency / sysctl_sched_min_granularity;
+       unsigned long nr_latency = sysctl_sched_nr_latency;
 
        if (unlikely(nr_running > nr_latency)) {
                period *= nr_running;
@@ -245,11 +244,15 @@ static u64 sched_slice(struct cfs_rq *cfs_rq, struct 
sched_entity *se)
 
 static u64 __sched_vslice(unsigned long nr_running)
 {
-       u64 period = __sched_period(nr_running);
+       unsigned long period = sysctl_sched_latency;
+       unsigned long nr_latency = sysctl_sched_nr_latency;
 
-       do_div(period, nr_running);
+       if (unlikely(nr_running > nr_latency))
+               nr_running = nr_latency;
 
-       return period;
+       period /= nr_running;
+
+       return (u64)period;
 }
 
 /*
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 97b15c2..230ca4e 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -222,14 +222,11 @@ static ctl_table kern_table[] = {
 #ifdef CONFIG_SCHED_DEBUG
        {
                .ctl_name       = CTL_UNNUMBERED,
-               .procname       = "sched_min_granularity_ns",
-               .data           = &sysctl_sched_min_granularity,
+               .procname       = "sched_nr_latency",
+               .data           = &sysctl_sched_nr_latency,
                .maxlen         = sizeof(unsigned int),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_minmax,
-               .strategy       = &sysctl_intvec,
-               .extra1         = &min_sched_granularity_ns,
-               .extra2         = &max_sched_granularity_ns,
+               .proc_handler   = &proc_dointvec,
        },
        {
                .ctl_name       = CTL_UNNUMBERED,
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to