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  PHC 
Open Source and information security mailing list archives
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 20 Dec 2010 16:24:08 +0100
From:	Frederic Weisbecker <>
To:	LKML <>
Cc:	LKML <>,
	Frederic Weisbecker <>,
	Thomas Gleixner <>,
	Peter Zijlstra <>,
	"Paul E. McKenney" <>,
	Ingo Molnar <>,
	Steven Rostedt <>,
	Lai Jiangshan <>,
	Andrew Morton <>,
	Anton Blanchard <>,
	Tim Pepper <>
Subject: [RFC PATCH 01/15] nohz_task: New mask for cpus having nohz task

A nohz task is a non-idle task that tries to shutdown the tick while
the task is running under some conditions.

This brings a new cpu_has_nohz_task_mask cpu mask that keeps track
of the cpus that have a nohz task. This is a 1:1 mapping: a nohz
task is affine to a single cpu and can't be moved elsewhere, and
a cpu can have only one nohz task.

This tracking will be useful later for rcu or when we need to
find an idle cpu target for a timer.

Signed-off-by: Frederic Weisbecker <>
Cc: Thomas Gleixner <>
Cc: Peter Zijlstra <>
Cc: Paul E. McKenney <>
Cc: Ingo Molnar <>
Cc: Steven Rostedt <>
Cc: Lai Jiangshan <>
Cc: Andrew Morton <>
Cc: Anton Blanchard <>
Cc: Tim Pepper <>
 arch/Kconfig            |    3 +++
 include/linux/cpumask.h |    8 ++++++++
 kernel/cpu.c            |   15 +++++++++++++++
 kernel/time/Kconfig     |    7 +++++++
 4 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 8bf0fa65..e631791 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -175,4 +175,7 @@ config HAVE_PERF_EVENTS_NMI
+	bool
 source "kernel/gcov/Kconfig"
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index bae6fe2..6c4801c 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -100,6 +100,13 @@ extern const struct cpumask *const cpu_active_mask;
 #define cpu_active(cpu)		((cpu) == 0)
+extern const struct cpumask *const cpu_has_nohz_task_mask;
+#define cpu_has_nohz_task(cpu)	cpumask_test_cpu((cpu), cpu_has_nohz_task_mask)
+#define cpu_has_nohz_task(cpu)	0
 /* verify cpu argument to cpumask_* operators */
 static inline unsigned int cpumask_check(unsigned int cpu)
@@ -671,6 +678,7 @@ void set_cpu_possible(unsigned int cpu, bool possible);
 void set_cpu_present(unsigned int cpu, bool present);
 void set_cpu_online(unsigned int cpu, bool online);
 void set_cpu_active(unsigned int cpu, bool active);
+void set_cpu_has_nohz_task(unsigned int cpu, bool has_nohz_task);
 void init_cpu_present(const struct cpumask *src);
 void init_cpu_possible(const struct cpumask *src);
 void init_cpu_online(const struct cpumask *src);
diff --git a/kernel/cpu.c b/kernel/cpu.c
index f6e726f..bc9a93e 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -540,6 +540,11 @@ static DECLARE_BITMAP(cpu_active_bits, CONFIG_NR_CPUS) __read_mostly;
 const struct cpumask *const cpu_active_mask = to_cpumask(cpu_active_bits);
+static DECLARE_BITMAP(cpu_has_nohz_task_bits, CONFIG_NR_CPUS) __read_mostly;
+const struct cpumask *const cpu_has_nohz_task_mask = to_cpumask(cpu_has_nohz_task_bits);
 void set_cpu_possible(unsigned int cpu, bool possible)
 	if (possible)
@@ -572,6 +577,16 @@ void set_cpu_active(unsigned int cpu, bool active)
 		cpumask_clear_cpu(cpu, to_cpumask(cpu_active_bits));
+void set_cpu_has_nohz_task(unsigned int cpu, bool has_nohz_task)
+	if (has_nohz_task)
+		cpumask_set_cpu(cpu, to_cpumask(cpu_has_nohz_task_bits));
+	else
+		cpumask_clear_cpu(cpu, to_cpumask(cpu_has_nohz_task_bits));
 void init_cpu_present(const struct cpumask *src)
 	cpumask_copy(to_cpumask(cpu_present_bits), src);
diff --git a/kernel/time/Kconfig b/kernel/time/Kconfig
index f06a8a3..a460cee 100644
--- a/kernel/time/Kconfig
+++ b/kernel/time/Kconfig
@@ -27,3 +27,10 @@ config GENERIC_CLOCKEVENTS_BUILD
 	default y
+config NO_HZ_TASK
+       bool "Tickless task"
+       depends on HAVE_NO_HZ_TASK && NO_HZ && SMP && HIGH_RES_TIMERS
+       help
+         When a task runs alone on a CPU and switches into this mode,
+         the timer interrupt will only trigger when it is strictly
+         needed.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

Powered by blists - more mailing lists