lkml.org 
[lkml]   [2010]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC PATCH 14/15] nohz_task: Clear nohz task attribute on exit()
    Date
    Clear the nohz task attribute when a task exits, clear the cpu
    mask and restart the tick if necessary.

    Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Anton Blanchard <anton@au1.ibm.com>
    Cc: Tim Pepper <lnxninja@linux.vnet.ibm.com>
    ---
    include/linux/tick.h | 2 ++
    kernel/exit.c | 3 +++
    kernel/time/tick-sched.c | 20 ++++++++++++++++++++
    3 files changed, 25 insertions(+), 0 deletions(-)

    diff --git a/include/linux/tick.h b/include/linux/tick.h
    index a704bb7..37af961 100644
    --- a/include/linux/tick.h
    +++ b/include/linux/tick.h
    @@ -137,6 +137,7 @@ extern void tick_nohz_task_enter_kernel(void);
    extern void tick_nohz_task_exit_kernel(void);
    extern void tick_nohz_task_enter_exception(struct pt_regs *regs);
    extern void tick_nohz_task_exit_exception(struct pt_regs *regs);
    +extern void tick_nohz_task_clear(void);
    extern int tick_nohz_task_mode(void);

    #else /* !NO_HZ_TASK */
    @@ -144,6 +145,7 @@ static inline void tick_nohz_task_enter_kernel(void) { }
    static inline void tick_nohz_task_exit_kernel(void) { }
    static inline void tick_nohz_task_enter_exception(struct pt_regs *regs) { }
    static inline void tick_nohz_task_exit_exception(struct pt_regs *regs) { }
    +static inline void tick_nohz_task_clear(void) { }
    static inline int tick_nohz_task_mode(void) { return 0; }
    #endif /* !NO_HZ_TASK */

    diff --git a/kernel/exit.c b/kernel/exit.c
    index 676149a..250d832 100644
    --- a/kernel/exit.c
    +++ b/kernel/exit.c
    @@ -51,6 +51,7 @@
    #include <trace/events/sched.h>
    #include <linux/hw_breakpoint.h>
    #include <linux/oom.h>
    +#include <linux/tick.h>

    #include <asm/uaccess.h>
    #include <asm/unistd.h>
    @@ -1013,6 +1014,8 @@ NORET_TYPE void do_exit(long code)
    */
    perf_event_exit_task(tsk);

    + tick_nohz_task_clear();
    +
    exit_notify(tsk, group_dead);
    #ifdef CONFIG_NUMA
    task_lock(tsk);
    diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
    index 9a4aa39..06379eb 100644
    --- a/kernel/time/tick-sched.c
    +++ b/kernel/time/tick-sched.c
    @@ -720,6 +720,26 @@ void tick_check_idle(int cpu)
    }

    #ifdef CONFIG_NO_HZ_TASK
    +void tick_nohz_task_clear(void)
    +{
    + int cpu = raw_smp_processor_id();
    +
    + if (!test_thread_flag(TIF_NOHZ))
    + return;
    +
    + set_cpu_has_nohz_task(cpu, 0);
    + clear_tsk_thread_flag(current, TIF_NOHZ);
    +
    + local_irq_disable();
    +
    + if (__get_cpu_var(task_nohz_mode))
    + tick_nohz_restart_sched_tick();
    +
    + __get_cpu_var(task_nohz_mode) = 0;
    +
    + local_irq_enable();
    +}
    +
    DEFINE_PER_CPU(int, nohz_task_ext_qs);

    void tick_nohz_task_exit_kernel(void)
    --
    1.7.3.2


    \
     
     \ /
      Last update: 2010-12-20 16:27    [W:0.022 / U:0.712 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site