Skip to contentSkip to conversation

nohz: minor cleanups

PATCH In review Luiz Capitulino 2 participants 7 messages Sep 10, 2015 – Sep 24, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover nohz: minor cleanups

Hi,

These are a few minor cleanups I did while doing a code reading, patches should be self explanatory.

Luiz Capitulino (3):
nohz: mark tick_nohz_full_running as __read_mostly
nohz: mark tick_nohz_init_all() as __init
sched: add_nr_running(): drop tick_nohz_full_cpu() check

 kernel/sched/sched.h     | 20 +++++++++-----------
 kernel/time/tick-sched.c |  4 ++--
 2 files changed, 11 insertions(+), 13 deletions(-)
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/3 nohz: mark tick_nohz_full_running as __read_mostly

---
 kernel/time/tick-sched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/tick-sched.c +1 -1
index 3319e16..8d45638 100644
@@ -155,7 +155,7 @@ static void tick_sched_handle(struct tick_sched *ts, struct pt_regs *regs)
 #ifdef CONFIG_NO_HZ_FULL
 cpumask_var_t tick_nohz_full_mask;
 cpumask_var_t housekeeping_mask;
-bool tick_nohz_full_running;
+bool tick_nohz_full_running __read_mostly;
 
 static bool can_stop_full_tick(void)
 {
Signature · 1 line
2.1.0
#2 lore raw

PATCH 2/3 nohz: mark tick_nohz_init_all() as __init

In reply to Luiz Capitulino

It's only called by tick_nohz_init().

---
 kernel/time/tick-sched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/tick-sched.c +1 -1
index 8d45638..4cc6df03 100644
@@ -308,7 +308,7 @@ static int tick_nohz_cpu_down_callback(struct notifier_block *nfb,
 	return NOTIFY_OK;
 }
 
-static int tick_nohz_init_all(void)
+static int __init tick_nohz_init_all(void)
 {
 	int err = -1;
 
Signature · 1 line
2.1.0
#3 lore raw

Re: [PATCH 2/3] nohz: mark tick_nohz_init_all() as __init

Quoted 12 lines · Luiz Capitulino

It's only called by tick_nohz_init().

---
 kernel/time/tick-sched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/tick-sched.c +0 -0
index 8d45638..4cc6df03 100644

kernel/time/tick-sched.c static int tick_nohz_cpu_down_callback(struct notifier_block *nfb, · line 313

Quoted 7 lines
kernel/time/tick-sched.c +1 -1
@@ -308,7 +308,7 @@ static int tick_nohz_cpu_down_callback(struct notifier_block *nfb,
 	return NOTIFY_OK;
 }
 
-static int tick_nohz_init_all(void)
+static int __init tick_nohz_init_all(void)
 {
 	int err = -1;

For some reasons I thought sections don't apply to static functions. Well I still don't know but I guess it works as long as the function doesn't get inlined. Or likely it prevents it from being inlined.

Anyway, I think we can take the patch.

Thanks.

Quoted 4 lines
Signature · 2 lines
-- 
2.1.0
#4 lore raw

PATCH 3/3 sched: add_nr_running(): drop tick_nohz_full_cpu() check

In reply to Luiz Capitulino

tick_nohz_full_kick_cpu() performs the same check.

---
 kernel/sched/sched.h | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
kernel/sched/sched.h +9 -11
index 68cda11..102eb18 100644
@@ -1323,17 +1323,15 @@ static inline void add_nr_running(struct rq *rq, unsigned count)
 #endif
 
 #ifdef CONFIG_NO_HZ_FULL
-		if (tick_nohz_full_cpu(rq->cpu)) {
-			/*
-			 * Tick is needed if more than one task runs on a CPU.
-			 * Send the target an IPI to kick it out of nohz mode.
-			 *
-			 * We assume that IPI implies full memory barrier and the
-			 * new value of rq->nr_running is visible on reception
-			 * from the target.
-			 */
-			tick_nohz_full_kick_cpu(rq->cpu);
-		}
+		/*
+		 * Tick is needed if more than one task runs on a CPU.
+		 * Send the target an IPI to kick it out of nohz mode.
+		 *
+		 * We assume that IPI implies full memory barrier and the
+		 * new value of rq->nr_running is visible on reception
+		 * from the target.
+		 */
+		tick_nohz_full_kick_cpu(rq->cpu);
 #endif
 	}
 }
Signature · 1 line
2.1.0
#5 lore raw

Re: [PATCH 3/3] sched: add_nr_running(): drop tick_nohz_full_cpu() check

Quoted 25 lines · Luiz Capitulino

tick_nohz_full_kick_cpu() performs the same check.

---
 kernel/sched/sched.h | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
kernel/sched/sched.h +0 -10
index 68cda11..102eb18 100644
@@ -1323,17 +1323,15 @@ static inline void add_nr_running(struct rq *rq, unsigned count)
 #endif
 
 #ifdef CONFIG_NO_HZ_FULL
-		if (tick_nohz_full_cpu(rq->cpu)) {
-			/*
-			 * Tick is needed if more than one task runs on a CPU.
-			 * Send the target an IPI to kick it out of nohz mode.
-			 *
-			 * We assume that IPI implies full memory barrier and the
-			 * new value of rq->nr_running is visible on reception
-			 * from the target.
-			 */
-			tick_nohz_full_kick_cpu(rq->cpu);

kernel/sched/sched.h static inline void add_nr_running(struct rq *rq, unsigned count) · line 1334

Quoted 10 lines
kernel/sched/sched.h +9 -1
-		}
+		/*
+		 * Tick is needed if more than one task runs on a CPU.
+		 * Send the target an IPI to kick it out of nohz mode.
+		 *
+		 * We assume that IPI implies full memory barrier and the
+		 * new value of rq->nr_running is visible on reception
+		 * from the target.
+		 */
+		tick_nohz_full_kick_cpu(rq->cpu);

Nope, we want to keep this because tick_nohz_full_cpu() does a static key check. Most users don't care about nohz_full and I really want to keep nohz full off case overhead to the bare minimum.

Thanks.

Quoted 6 lines
kernel/sched/sched.h +0 -0
 #endif
 	}
 }
Signature · 1 line
2.1.0
#6 lore raw

Re: [PATCH 3/3] sched: add_nr_running(): drop tick_nohz_full_cpu() check

Quoted 32 lines · On Thu, 24 Sep 2015 16:44:18 +0200 Frederic Weisbecker <[email protected]>…
Quoted 31 lines · Luiz Capitulino

tick_nohz_full_kick_cpu() performs the same check.

---
 kernel/sched/sched.h | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
kernel/sched/sched.h +5 -11
index 68cda11..102eb18 100644
@@ -1323,17 +1323,15 @@ static inline void add_nr_running(struct rq *rq, unsigned count)
 #endif
 
 #ifdef CONFIG_NO_HZ_FULL
-		if (tick_nohz_full_cpu(rq->cpu)) {
-			/*
-			 * Tick is needed if more than one task runs on a CPU.
-			 * Send the target an IPI to kick it out of nohz mode.
-			 *
-			 * We assume that IPI implies full memory barrier and the
-			 * new value of rq->nr_running is visible on reception
-			 * from the target.
-			 */
-			tick_nohz_full_kick_cpu(rq->cpu);
-		}
+		/*
+		 * Tick is needed if more than one task runs on a CPU.
+		 * Send the target an IPI to kick it out of nohz mode.
+		 *
+		 * We assume that IPI implies full memory barrier and the
Quoted 8 lines

kernel/sched/sched.h static inline void add_nr_running(struct rq *rq, unsigned count) · line 1334

Quoted 4 lines
kernel/sched/sched.h +4 -0
+		 * new value of rq->nr_running is visible on reception
+		 * from the target.
+		 */
+		tick_nohz_full_kick_cpu(rq->cpu);

Nope, we want to keep this because tick_nohz_full_cpu() does a static key check. Most users don't care about nohz_full and I really want to keep nohz full off case overhead to the bare minimum.

Makes sense.

Quoted 10 lines

Thanks.

Quoted 6 lines
kernel/sched/sched.h +0 -0
 #endif
 	}
 }
Signature · 1 line
2.1.0