Skip to contentSkip to conversation

time: Optimize nohz idle enter

PATCH Thomas Gleixner 3 participants 4 messages Jul 19, 2016 1 message not in the archive Nohz, dynticks support

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]@spreadtrum.com

#1 lore raw
Quoted 9 lines · Gaurav Jindal (Gaurav Jindal)

tick_nohz_start_idle is called before checking the condition if the idle tick can be stopped. In case when can_stop_idle_tick returns 0, the function called is of no use thus a extra call doing nothing.

Shifting calling of function tick_nohz_start_idle inside the if condition makes sure that corresponding operations are done only if idle tick can be actually stopped. Observance for 1 minute on arm64 architecture shows that shifting code can prevent 1.5% of extra calls thus optimizing the idle call sequence.

Nice.

Quoted 2 lines

This SOB chain is wrong. Sanjeev did not send the patch and is not the author. Please clarify.

Thanks,

tglx

#2 lore raw
Quoted 11 lines · Thomas Gleixner
Quoted 9 lines · Gaurav Jindal (Gaurav Jindal)

tick_nohz_start_idle is called before checking the condition if the idle tick can be stopped. In case when can_stop_idle_tick returns 0, the function called is of no use thus a extra call doing nothing.

Shifting calling of function tick_nohz_start_idle inside the if condition makes sure that corresponding operations are done only if idle tick can be actually stopped. Observance for 1 minute on arm64 architecture shows that shifting code can prevent 1.5% of extra calls thus optimizing the idle call sequence.

Quoted 8 lines

Nice.

Quoted 2 lines

This SOB chain is wrong. Sanjeev did not send the patch and is not the author. Please clarify.

Actually Sanjeev and me worked together, but since only one send the mail so I included his name as SOB.

Quoted 3 lines

Thanks,

tglx

Signature · 3 lines
Regards
Gaurav Jindal
+91-8800803297
#3 lore raw
Quoted 14 lines · Gaurav Jindal (Gaurav Jindal)
Quoted 13 lines · Thomas Gleixner
Quoted 9 lines · Gaurav Jindal (Gaurav Jindal)

tick_nohz_start_idle is called before checking the condition if the idle tick can be stopped. In case when can_stop_idle_tick returns 0, the function called is of no use thus a extra call doing nothing.

Shifting calling of function tick_nohz_start_idle inside the if condition makes sure that corresponding operations are done only if idle tick can be actually stopped. Observance for 1 minute on arm64 architecture shows that shifting code can prevent 1.5% of extra calls thus optimizing the idle call sequence.

Nice.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

This SOB chain is wrong. Sanjeev did not send the patch and is not the author. Please clarify.

Actually Sanjeev and me worked together, but since only one send the mail so I included his name as SOB.

That does not make it more correct. See Documentation/SubmittingPatches. I fixed it up.

Thanks,

tglx

#4 lore raw

[tip:timers/core] tick/nohz: Optimize nohz idle enter

In reply to a message not in the archive
tick/nohz: Optimize nohz idle enter
Commit-ID:  1f3b0f8243cb934307f59bd4d8e43b868e61d4d9
Gitweb:     http://git.kernel.org/tip/1f3b0f8243cb934307f59bd4d8e43b868e61d4d9
Author:     Gaurav Jindal <[email protected]>
AuthorDate: Thu, 14 Jul 2016 12:04:20 +0000
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Tue, 19 Jul 2016 13:48:24 +0200

tick/nohz: Optimize nohz idle enter

tick_nohz_start_idle is called before checking whether the idle tick can be stopped. If the tick cannot be stopped, calling tick_nohz_start_idle() is pointless and just wasting CPU cycles.

Only invoke tick_nohz_start_idle() when can_stop_idle_tick() returns true. A short one minute observation of the effect on ARM64 shows a reduction of calls by 1.5% thus optimizing the idle entry sequence.

[tglx: Massaged changelog ]

---
 kernel/time/tick-sched.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/time/tick-sched.c +1 -2
index 2ec7c00..204fdc8 100644
@@ -908,11 +908,10 @@ static void __tick_nohz_idle_enter(struct tick_sched *ts)
 	ktime_t now, expires;
 	int cpu = smp_processor_id();
 
-	now = tick_nohz_start_idle(ts);
-
 	if (can_stop_idle_tick(cpu, ts)) {
 		int was_stopped = ts->tick_stopped;
 
+		now = tick_nohz_start_idle(ts);
 		ts->idle_calls++;
 
 		expires = tick_nohz_stop_sched_tick(ts, now, cpu);