scheduler changes for v3.4
Subsystems (18)
Linus,
Please pull the latest sched-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched-core-for-linus
HEAD: 600e145882802d6ccbfe2c4aea243d97caeb91a9 printk: Make it compile with !CONFIG_PRINTK
Thanks,
Ingo
------------------>
Anton Vorontsov (1):
sched: Turn lock_task_sighand() into a static inline
Diwakar Tundlam (1):
sched/nohz: Correctly initialize 'next_balance' in 'nohz' idle balancer
Hiroshi Shimamoto (3):
sched: Move SMP-only variable into the SMP section
sched: Make initial SCHED_RR timeslace DEF_TIMESLICE
sched: Clean up parameter passing of proc_sched_autogroup_set_nice()
Nikunj A. Dadhania (1):
sched: Remove rcu_read_lock/unlock() from select_idle_sibling()
Peter Zijlstra (12):
sched, block: Unify cache detection
sched/rt: Keep period timer ticking when rt throttling is active sched/rt: Do not throttle when PI boosting
sched: Move load-balancing arguments into helper struct
sched: Rename load-balancing fields
sched: Ditch per cgroup task lists for load-balancing
sched: Fix load-balance wreckage
sched: Cleanup cpu_active madness
printk/sched: Introduce special printk_sched() for those awkward moments
sched: Update yield() docs
sched: Fix nohz load accounting -- again!
printk: Make it compile with !CONFIG_PRINTK
Rakib Mullick (1):
sched: Remove sched_switch
Salman Qazi (1):
sched/x86: Fix overflow in cyc2ns_offset
Thomas Gleixner (6):
sched/rt: Add schedule_preempt_disabled() sched/rt: Use schedule_preempt_disabled() sched/rt: Document scheduler related skip-resched-check sites sched/wait: Add __wake_up_all_locked() API sched/rt: Prevent idle task boosting
sched/rt: Do not submit new work when PI-blocked
Vincent Guittot (1):
sched: Ensure cpu_power periodic update
Documentation/scheduler/sched-stats.txt | 3 +- arch/arm/kernel/process.c | 4 +- arch/arm/kernel/smp.c | 7 - arch/avr32/kernel/process.c | 4 +- arch/blackfin/kernel/process.c | 4 +- arch/cris/kernel/process.c | 4 +- arch/frv/kernel/process.c | 4 +- arch/h8300/kernel/process.c | 4 +- arch/hexagon/kernel/smp.c | 2 - arch/ia64/kernel/process.c | 4 +- arch/m32r/kernel/process.c | 4 +- arch/m68k/kernel/process_mm.c | 4 +- arch/m68k/kernel/process_no.c | 4 +- arch/microblaze/kernel/process.c | 4 +- arch/mips/kernel/process.c | 4 +- arch/mn10300/kernel/process.c | 4 +- arch/parisc/kernel/process.c | 4 +- arch/powerpc/kernel/idle.c | 8 +- arch/powerpc/platforms/iseries/setup.c | 8 +- arch/s390/kernel/process.c | 4 +- arch/s390/kernel/smp.c | 6 - arch/score/kernel/process.c | 4 +- arch/sh/kernel/idle.c | 4 +- arch/sparc/kernel/process_32.c | 8 +- arch/sparc/kernel/process_64.c | 10 +- arch/tile/kernel/process.c | 4 +- arch/x86/include/asm/timer.h | 8 +- arch/x86/kernel/process_32.c | 4 +- arch/x86/kernel/process_64.c | 4 +- arch/x86/kernel/smpboot.c | 13 - arch/x86/kernel/tsc.c | 3 +- arch/xtensa/kernel/process.c | 4 +- block/blk-softirq.c | 16 +- block/blk.h | 16 -- fs/proc/base.c | 3 +- include/linux/init_task.h | 2 +- include/linux/kernel.h | 13 + include/linux/preempt.h | 5 +- include/linux/printk.h | 10 + include/linux/sched.h | 41 +++- include/linux/wait.h | 5 +- init/main.c | 5 +- kernel/mutex.c | 4 +- kernel/printk.c | 40 +++- kernel/sched/auto_group.c | 12 +- kernel/sched/core.c | 129 +++++++---- kernel/sched/debug.c | 1 - kernel/sched/fair.c | 392 ++++++++++++++----------------- kernel/sched/rt.c | 43 +++- kernel/sched/sched.h | 15 +- kernel/sched/stats.c | 4 +- kernel/softirq.c | 8 +- 52 files changed, 462 insertions(+), 462 deletions(-)
Documentation/scheduler/sched-stats.txt +2 -1
@@ -38,7 +38,8 @@ First field is a sched_yield() statistic: 1) # of times sched_yield() was called Next three are schedule() statistics: - 2) # of times we switched to the expired queue and reused it + 2) This field is a legacy array expiration count field used in the O(1) + scheduler. We kept it for ABI compatibility, but it is always set to zero. 3) # of times schedule() was called 4) # of times schedule() left the processor idle
arch/arm/kernel/process.c +1 -3
@@ -239,9 +239,7 @@ void cpu_idle(void)leds_event (led_idle_end);rcu_idle_exit ();tick_nohz_idle_exit (); -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled (); } }
arch/arm/kernel/smp.c +0 -7
@@ -295,13 +295,6 @@ asmlinkage void __cpuinit secondary_start_kernel(void)*/ percpu_timer_setup (); -while (!cpu_active (cpu)) -cpu_relax (); - -/* -* cpu_active bit is set, so it's safe to enalbe interrupts -* now. -*/ local_irq_enable ();local_fiq_enable ();
arch/avr32/kernel/process.c +1 -3
@@ -40,9 +40,7 @@ void cpu_idle(void)cpu_idle_sleep ();rcu_idle_exit ();tick_nohz_idle_exit (); -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled (); } }
arch/blackfin/kernel/process.c +1 -3
@@ -94,9 +94,7 @@ void cpu_idle(void)idle ();rcu_idle_exit ();tick_nohz_idle_exit (); -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled (); } }
arch/cris/kernel/process.c +1 -3
@@ -115,9 +115,7 @@ void cpu_idle (void) idle = default_idle;idle (); } -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled (); } }
arch/frv/kernel/process.c +1 -3
@@ -92,9 +92,7 @@ void cpu_idle(void)idle (); } -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled (); } }
arch/h8300/kernel/process.c +1 -3
@@ -81,9 +81,7 @@ void cpu_idle(void)while (1 ) {while (!need_resched ())idle (); -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled (); } }
arch/hexagon/kernel/smp.c +0 -2
@@ -179,8 +179,6 @@ void __cpuinit start_secondary(void)printk (KERN_INFO "%s cpu %d\n" , __func__,current_thread_info ()->cpu);set_cpu_online (cpu, true); -while (!cpumask_test_cpu (cpu, cpu_active_mask)) -cpu_relax ();local_irq_enable ();cpu_idle ();
arch/ia64/kernel/process.c +1 -3
@@ -330,9 +330,7 @@ cpu_idle (void)normal_xtp ();#endif } -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled ();check_pgt_cache ();if (cpu_is_offline (cpu))play_dead ();
arch/m32r/kernel/process.c +1 -3
@@ -90,9 +90,7 @@ void cpu_idle (void)idle (); } -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled (); } }
arch/m68k/kernel/process_mm.c +1 -3
@@ -78,9 +78,7 @@ void cpu_idle(void)while (1 ) {while (!need_resched ())idle (); -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled (); } }
arch/m68k/kernel/process_no.c +1 -3
@@ -73,9 +73,7 @@ void cpu_idle(void)/* endless idle loop with no priority at all */ while (1 ) {idle (); -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled (); } }
arch/microblaze/kernel/process.c +1 -3
@@ -110,9 +110,7 @@ void cpu_idle(void)rcu_idle_exit ();tick_nohz_idle_exit (); -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled ();check_pgt_cache (); } }
arch/mips/kernel/process.c +1 -3
@@ -80,9 +80,7 @@ void __noreturn cpu_idle(void)#endif rcu_idle_exit ();tick_nohz_idle_exit (); -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled (); } }
arch/mn10300/kernel/process.c +1 -3
@@ -123,9 +123,7 @@ void cpu_idle(void)idle (); } -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled (); } }
arch/parisc/kernel/process.c +1 -3
@@ -71,9 +71,7 @@ void cpu_idle(void)while (1 ) {while (!need_resched ())barrier (); -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled ();check_pgt_cache (); } }
arch/powerpc/kernel/idle.c +4 -4
@@ -101,11 +101,11 @@ void cpu_idle(void)ppc64_runlatch_on ();rcu_idle_exit ();tick_nohz_idle_exit (); -preempt_enable_no_resched (); -if (cpu_should_die ()) +if (cpu_should_die ()) { +sched_preempt_enable_no_resched ();cpu_die (); -schedule (); -preempt_disable (); + } +schedule_preempt_disabled (); } }
arch/powerpc/platforms/iseries/setup.c +2 -6
@@ -584,9 +584,7 @@ static void iseries_shared_idle(void)if (hvlpevent_is_pending ())process_iSeries_events (); -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled (); } }
@@ -615,9 +613,7 @@ static void iseries_dedicated_idle(void)ppc64_runlatch_on ();rcu_idle_exit ();tick_nohz_idle_exit (); -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled (); } }
arch/s390/kernel/process.c +1 -3
@@ -97,9 +97,7 @@ void cpu_idle(void)tick_nohz_idle_exit ();if (test_thread_flag (TIF_MCCK_PENDING ))s390_handle_mcck (); -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled (); } }
arch/s390/kernel/smp.c +0 -6
@@ -550,12 +550,6 @@ int __cpuinit start_secondary(void *cpuvoid) S390_lowcore.restart_psw.addr =PSW_ADDR_AMODE | (unsigned long ) psw_restart_int_handler;__ctl_set_bit (0 ,28 );/* Enable lowcore protection */ -/* -* Wait until the cpu which brought this one up marked it -* active before enabling interrupts. -*/ -while (!cpumask_test_cpu (smp_processor_id (), cpu_active_mask)) -cpu_relax ();local_irq_enable ();/* cpu_idle will call schedule for us */ cpu_idle ();
arch/score/kernel/process.c +1 -3
@@ -53,9 +53,7 @@ void __noreturn cpu_idle(void)while (!need_resched ())barrier (); -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled (); } }
arch/sh/kernel/idle.c +1 -3
@@ -114,9 +114,7 @@ void cpu_idle(void)rcu_idle_exit ();tick_nohz_idle_exit (); -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled (); } }
arch/sparc/kernel/process_32.c +2 -6
@@ -113,9 +113,7 @@ void cpu_idle(void)while (!need_resched ())cpu_relax (); } -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled ();check_pgt_cache (); } }
@@ -138,9 +136,7 @@ void cpu_idle(void)while (!need_resched ())cpu_relax (); } -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled ();check_pgt_cache (); } }
arch/sparc/kernel/process_64.c +4 -6
@@ -104,15 +104,13 @@ void cpu_idle(void)rcu_idle_exit ();tick_nohz_idle_exit (); -preempt_enable_no_resched (); -#ifdef CONFIG_HOTPLUG_CPU -if (cpu_is_offline (cpu)) +if (cpu_is_offline (cpu)) { +sched_preempt_enable_no_resched ();cpu_play_dead (); + }#endif - -schedule (); -preempt_disable (); +schedule_preempt_disabled (); } }
arch/tile/kernel/process.c +1 -3
@@ -108,9 +108,7 @@ void cpu_idle(void) }rcu_idle_exit ();tick_nohz_idle_exit (); -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled (); } }
arch/x86/include/asm/timer.h +2 -6
@@ -57,14 +57,10 @@ DECLARE_PER_CPU(unsigned long long, cyc2ns_offset);static inline unsigned long long __cycles_2_ns (unsigned long long cyc) { -unsigned long long quot; -unsigned long long rem;int cpu =smp_processor_id ();unsigned long long ns =per_cpu (cyc2ns_offset, cpu); - quot = (cyc >>CYC2NS_SCALE_FACTOR ); - rem = cyc & ((1ULL <<CYC2NS_SCALE_FACTOR ) -1 ); - ns += quot *per_cpu (cyc2ns, cpu) + - ((rem *per_cpu (cyc2ns, cpu)) >>CYC2NS_SCALE_FACTOR ); + ns +=mult_frac (cyc,per_cpu (cyc2ns, cpu), + (1UL <<CYC2NS_SCALE_FACTOR ));return ns; }
arch/x86/kernel/process_32.c +1 -3
@@ -119,9 +119,7 @@ void cpu_idle(void) }rcu_idle_exit ();tick_nohz_idle_exit (); -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled (); } }
arch/x86/kernel/process_64.c +1 -3
@@ -156,9 +156,7 @@ void cpu_idle(void) }tick_nohz_idle_exit (); -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled (); } }
arch/x86/kernel/smpboot.c +0 -13
@@ -291,19 +291,6 @@ notrace static void __cpuinit start_secondary(void *unused)per_cpu (cpu_state,smp_processor_id ()) =CPU_ONLINE ; x86_platform.nmi_init (); -/* -* Wait until the cpu which brought this one up marked it -* online before enabling interrupts. If we don't do that then -* we can end up waking up the softirq thread before this cpu -* reached the active state, which makes the scheduler unhappy -* and schedule the softirq thread on the wrong cpu. This is -* only observable with forced threaded interrupts, but in -* theory it could also happen w/o them. It's just way harder -* to achieve. -*/ -while (!cpumask_test_cpu (smp_processor_id (), cpu_active_mask)) -cpu_relax (); -/* enable local interrupts */ local_irq_enable ();
arch/x86/kernel/tsc.c +2 -1
@@ -620,7 +620,8 @@ static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu)if (cpu_khz) { *scale = (NSEC_PER_MSEC <<CYC2NS_SCALE_FACTOR )/cpu_khz; - *offset = ns_now - (tsc_now * *scale >>CYC2NS_SCALE_FACTOR ); + *offset = ns_now -mult_frac (tsc_now, *scale, + (1UL <<CYC2NS_SCALE_FACTOR )); }sched_clock_idle_wakeup_event (0 );
arch/xtensa/kernel/process.c +1 -3
@@ -113,9 +113,7 @@ void cpu_idle(void)while (1 ) {while (!need_resched ())platform_idle (); -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled (); } }
block/blk-softirq.c +8 -8
@@ -8,6 +8,7 @@#include <linux/blkdev.h> #include <linux/interrupt.h> #include <linux/cpu.h> +#include <linux/sched.h> #include "blk.h"
@@ -103,9 +104,10 @@ static struct notifier_block __cpuinitdata blk_cpu_notifier = {void __blk_complete_request (struct request *req) { -int ccpu, cpu, group_cpu =NR_CPUS ; +int ccpu, cpu;struct request_queue *q = req->q;unsigned long flags; +bool shared = false;BUG_ON (!q->softirq_done_fn);
@@ -117,22 +119,20 @@ void __blk_complete_request(struct request *req)*/ if (req->cpu !=-1 ) { ccpu = req->cpu; -if (!test_bit (QUEUE_FLAG_SAME_FORCE , &q->queue_flags)) { - ccpu =blk_cpu_to_group (ccpu); - group_cpu =blk_cpu_to_group (cpu); - } +if (!test_bit (QUEUE_FLAG_SAME_FORCE , &q->queue_flags)) + shared =cpus_share_cache (cpu, ccpu); }else ccpu = cpu;/* -* If current CPU and requested CPU are in the same group, running -* softirq in current CPU. One might concern this is just like +* If current CPU and requested CPU share a cache, run the softirq on +* the current CPU. One might concern this is just like * QUEUE_FLAG_SAME_FORCE, but actually not. blk_complete_request() is * running in interrupt handler, and currently I/O controller doesn't * support multiple interrupts, so current CPU is unique actually. This * avoids IPI sending from current CPU to the first CPU of a group. */ -if (ccpu == cpu || ccpu == group_cpu) { +if (ccpu == cpu || shared) {struct list_head *list; do_local: list = &__get_cpu_var (blk_cpu_done);
block/blk.h +0 -16
@@ -166,22 +166,6 @@ static inline int queue_congestion_off_threshold(struct request_queue *q)return q->nr_congestion_off; } -static inline int blk_cpu_to_group (int cpu) -{ -int group =NR_CPUS ; -#ifdef CONFIG_SCHED_MC -const struct cpumask *mask =cpu_coregroup_mask (cpu); - group =cpumask_first (mask); -#elif defined(CONFIG_SCHED_SMT ) - group =cpumask_first (topology_thread_cpumask (cpu)); -#else -return cpu; -#endif -if (likely (group <NR_CPUS )) -return group; -return cpu; -} -/* * Contribute to IO statistics IFF: *
fs/proc/base.c +1 -2
@@ -1310,8 +1310,7 @@ sched_autogroup_write(struct file *file, const char __user *buf,if (!p)return -ESRCH ; - err = nice; - err =proc_sched_autogroup_set_nice (p, &err); + err =proc_sched_autogroup_set_nice (p, nice);if (err) count = err;
include/linux/init_task.h +1 -1
@@ -149,7 +149,7 @@ extern struct cred init_cred; }, \ .rt = { \ .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \ - .time_slice = HZ, \ + .time_slice = RR_TIMESLICE, \ .nr_cpus_allowed = NR_CPUS, \ }, \ .tasks = LIST_HEAD_INIT(tsk.tasks), \
include/linux/kernel.h +13 -0
@@ -85,6 +85,19 @@ } \ ) +/* +* Multiplies an integer by a fraction, while avoiding unnecessary +* overflow or loss of precision. +*/ +#define mult_frac (x, numer, denom)( \ +{ \ + typeof(x) quot = (x) / (denom); \ + typeof(x) rem = (x) % (denom); \ + (quot * (numer)) + ((rem * (numer)) / (denom)); \ +} \ +) + +#define _RET_IP_ (unsigned long)__builtin_return_address(0)#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
include/linux/preempt.h +4 -1
@@ -48,12 +48,14 @@ do { \barrier (); \ } while (0) -#define preempt_enable_no_resched () \ +#define sched_preempt_enable_no_resched () \ do { \ barrier(); \ dec_preempt_count(); \ } while (0) +#define preempt_enable_no_resched () sched_preempt_enable_no_resched() +#define preempt_enable () \ do { \ preempt_enable_no_resched(); \
@@ -92,6 +94,7 @@ do { \#else /* !CONFIG_PREEMPT_COUNT */ #define preempt_disable () do { } while (0) +#define sched_preempt_enable_no_resched () do { } while (0)#define preempt_enable_no_resched () do { } while (0)#define preempt_enable () do { } while (0)
include/linux/printk.h +10 -0
@@ -101,6 +101,11 @@ asmlinkage __printf(1, 2) __coldint printk (const char *fmt, ...);/* +* Special printk facility for scheduler use only, _DO_NOT_USE_ ! +*/ +__printf(1, 2) __cold int printk_sched(const char *fmt, ...); + +/* * Please don't use printk_ratelimit(), because it shares ratelimiting state * with all other unrelated printk_ratelimit() callsites. Instead use * printk_ratelimited() or plain old __ratelimit().
@@ -127,6 +132,11 @@ int printk(const char *s, ...) {return 0 ; } +static inline __printf(1, 2) __cold +int printk_sched(const char *s, ...) +{ +return 0 ; +}static inline int printk_ratelimit (void ) {return 0 ;
include/linux/sched.h +34 -7
95 lines not on this page · raw message
include/linux/wait.h +3 -2
@@ -157,7 +157,7 @@ void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key);void __wake_up_locked_key (wait_queue_head_t *q,unsigned int mode,void *key);void __wake_up_sync_key (wait_queue_head_t *q,unsigned int mode,int nr,void *key); -void __wake_up_locked (wait_queue_head_t *q,unsigned int mode); +void __wake_up_locked (wait_queue_head_t *q,unsigned int mode,int nr);void __wake_up_sync (wait_queue_head_t *q,unsigned int mode,int nr);void __wake_up_bit (wait_queue_head_t *,void *,int );int __wait_on_bit (wait_queue_head_t *,struct wait_bit_queue *,int (*)(void *),unsigned );
@@ -170,7 +170,8 @@ wait_queue_head_t *bit_waitqueue(void *, int);#define wake_up (x) __wake_up(x, TASK_NORMAL, 1, NULL)#define wake_up_nr (x, nr) __wake_up(x, TASK_NORMAL, nr, NULL)#define wake_up_all (x) __wake_up(x, TASK_NORMAL, 0, NULL) -#define wake_up_locked (x) __wake_up_locked((x), TASK_NORMAL) +#define wake_up_locked (x) __wake_up_locked((x), TASK_NORMAL, 1) +#define wake_up_all_locked (x) __wake_up_locked((x), TASK_NORMAL, 0)#define wake_up_interruptible (x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL)#define wake_up_interruptible_nr (x, nr) __wake_up(x, TASK_INTERRUPTIBLE, nr, NULL)
init/main.c +1 -4
@@ -374,11 +374,8 @@ static noinline void __init_refok rest_init(void)* at least once to get things moving: */ init_idle_bootup_task (current); -preempt_enable_no_resched (); -schedule (); - +schedule_preempt_disabled ();/* Call into cpu_idle with preempt disabled */ -preempt_disable ();cpu_idle (); }
kernel/mutex.c +1 -3
@@ -240,9 +240,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,/* didn't get the lock, go to sleep: */ spin_unlock_mutex (&lock->wait_lock, flags); -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled ();spin_lock_mutex (&lock->wait_lock, flags); }
kernel/printk.c +37 -3
@@ -1211,13 +1211,27 @@ int is_console_locked(void)return console_locked; } +/* +* Delayed printk facility, for scheduler-internal messages: +*/ +#define PRINTK_BUF_SIZE 512 + +#define PRINTK_PENDING_WAKEUP 0x01 +#define PRINTK_PENDING_SCHED 0x02 + static DEFINE_PER_CPU(int, printk_pending); +static DEFINE_PER_CPU(char [PRINTK_BUF_SIZE], printk_sched_buf);void printk_tick (void ) {if (__this_cpu_read (printk_pending)) { -__this_cpu_write (printk_pending,0 ); -wake_up_interruptible (&log_wait); +int pending =__this_cpu_xchg (printk_pending,0 ); +if (pending &PRINTK_PENDING_SCHED ) { +char *buf =__get_cpu_var (printk_sched_buf); +printk (KERN_WARNING "[sched_delayed] %s" , buf); + } +if (pending &PRINTK_PENDING_WAKEUP ) +wake_up_interruptible (&log_wait); } }
@@ -1231,7 +1245,7 @@ int printk_needs_cpu(int cpu)void wake_up_klogd (void ) {if (waitqueue_active (&log_wait)) -this_cpu_write (printk_pending,1 ); +this_cpu_or (printk_pending,PRINTK_PENDING_WAKEUP ); }/**
@@ -1624,6 +1638,26 @@ late_initcall(printk_late_init);#if definedCONFIG_PRINTK +int printk_sched (const char *fmt, ...) +{ +unsigned long flags; +va_list args; +char *buf; +int r; + +local_irq_save (flags); + buf =__get_cpu_var (printk_sched_buf); + +va_start (args, fmt); + r =vsnprintf (buf,PRINTK_BUF_SIZE , fmt, args); +va_end (args); + +__this_cpu_or (printk_pending,PRINTK_PENDING_SCHED ); +local_irq_restore (flags); + +return r; +} +/* * printk rate limiting, lifted from the networking subsystem. *
kernel/sched/auto_group.c +6 -6
@@ -195,20 +195,20 @@ __setup("noautogroup", setup_autogroup);#ifdef CONFIG_PROC_FS -int proc_sched_autogroup_set_nice (struct task_struct *p,int *nice) +int proc_sched_autogroup_set_nice (struct task_struct *p,int nice) {static unsigned long next =INITIAL_JIFFIES ;struct autogroup *ag;int err; -if (*nice <-20 || *nice >19 ) +if (nice <-20 || nice >19 )return -EINVAL ; - err =security_task_setnice (current, *nice); + err =security_task_setnice (current, nice);if (err)return err; -if (*nice <0 && !can_nice (current, *nice)) +if (nice <0 && !can_nice (current, nice))return -EPERM ;/* this is a heavy operation taking global locks.. */
@@ -219,9 +219,9 @@ int proc_sched_autogroup_set_nice(struct task_struct *p, int *nice) ag =autogroup_task_get (p);down_write (&ag->lock); - err =sched_group_set_shares (ag->tg, prio_to_weight[*nice +20 ]); + err =sched_group_set_shares (ag->tg, prio_to_weight[nice +20 ]);if (!err) - ag->nice = *nice; + ag->nice = nice;up_write (&ag->lock);autogroup_kref_put (ag);
kernel/sched/core.c +88 -41
255 lines not on this page · raw message
kernel/sched/debug.c +0 -1
@@ -288,7 +288,6 @@ static void print_cpu(struct seq_file *m, int cpu)P (yld_count); -P (sched_switch);P (sched_count);P (sched_goidle);#ifdef CONFIG_SMP
kernel/sched/fair.c +175 -217
612 lines not on this page · raw message
kernel/sched/rt.c +34 -9
87 lines not on this page · raw message
kernel/sched/sched.h +2 -13
@@ -36,11 +36,7 @@ extern __read_mostly int scheduler_running;/* * These are the 'tuning knobs' of the scheduler: -* -* default timeslice is 100 msecs (used only for SCHED_RR tasks). -* Timeslices get refilled after they expire. */ -#define DEF_TIMESLICE (100 * HZ / 1000)/* * single value that denotes runtime == period, ie unlimited time.
@@ -216,9 +212,6 @@ struct cfs_rq {struct rb_root tasks_timeline;struct rb_node *rb_leftmost; -struct list_head tasks; -struct list_head *balance_iterator; -/* * 'curr' points to currently running entity on this cfs_rq. * It is set to NULL otherwise (i.e when none are currently running).
@@ -246,11 +239,6 @@ struct cfs_rq {#ifdef CONFIG_SMP /* -* the part of load.weight contributed by tasks -*/ -unsigned long task_weight; - -/* * h_load = weight * f(tg) * * Where f(tg) is the recursive weight fraction assigned to
@@ -424,6 +412,8 @@ struct rq {int cpu;int online; +struct list_head cfs_tasks; +u64 rt_avg;u64 age_stamp;u64 idle_stamp;
@@ -462,7 +452,6 @@ struct rq {unsigned int yld_count;/* schedule() stats */ -unsigned int sched_switch;unsigned int sched_count;unsigned int sched_goidle;
kernel/sched/stats.c +2 -2
@@ -32,9 +32,9 @@ static int show_schedstat(struct seq_file *seq, void *v)/* runqueue-specific stats */ seq_printf (seq, -"cpu%d %u %u %u %u %u %u %llu %llu %lu" , +"cpu%d %u 0 %u %u %u %u %llu %llu %lu" , cpu, rq->yld_count, - rq->sched_switch, rq->sched_count, rq->sched_goidle, + rq->sched_count, rq->sched_goidle, rq->ttwu_count, rq->ttwu_local, rq->rq_cpu_time, rq->rq_sched_info.run_delay, rq->rq_sched_info.pcount);
kernel/softirq.c +3 -5
@@ -353,7 +353,7 @@ void irq_exit(void)tick_nohz_irq_exit ();#endif rcu_irq_exit (); -preempt_enable_no_resched (); +sched_preempt_enable_no_resched (); }/*
@@ -744,9 +744,7 @@ static int run_ksoftirqd(void * __bind_cpu)while (!kthread_should_stop ()) {preempt_disable ();if (!local_softirq_pending ()) { -preempt_enable_no_resched (); -schedule (); -preempt_disable (); +schedule_preempt_disabled (); }__set_current_state (TASK_RUNNING );
@@ -761,7 +759,7 @@ static int run_ksoftirqd(void * __bind_cpu)if (local_softirq_pending ())__do_softirq ();local_irq_enable (); -preempt_enable_no_resched (); +sched_preempt_enable_no_resched ();cond_resched ();preempt_disable ();rcu_note_context_switch ((long )__bind_cpu);