lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1292858662-5650-15-git-send-email-fweisbec@gmail.com>
Date:	Mon, 20 Dec 2010 16:24:21 +0100
From:	Frederic Weisbecker <fweisbec@...il.com>
To:	LKML <linux-kernel@...r.kernel.org>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	Ingo Molnar <mingo@...e.hu>,
	Steven Rostedt <rostedt@...dmis.org>,
	Lai Jiangshan <laijs@...fujitsu.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Anton Blanchard <anton@....ibm.com>,
	Tim Pepper <lnxninja@...ux.vnet.ibm.com>
Subject: [RFC PATCH 14/15] nohz_task: Clear nohz task attribute on exit()

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@...il.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@...e.hu>
Cc: Steven Rostedt <rostedt@...dmis.org>
Cc: Lai Jiangshan <laijs@...fujitsu.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Anton Blanchard <anton@....ibm.com>
Cc: Tim Pepper <lnxninja@...ux.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ