LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] tick/sched: Drop duplicated tick_sched.inidle
@ 2019-05-22 3:29 Peter Xu
2019-05-22 12:18 ` Frederic Weisbecker
0 siblings, 1 reply; 3+ messages in thread
From: Peter Xu @ 2019-05-22 3:29 UTC (permalink / raw)
To: linux-kernel; +Cc: peterx, Frederic Weisbecker, Thomas Gleixner, Ingo Molnar
It is set before entering idle and cleared when quitting idle, though
it seems to be a complete duplicate of tick_sched.idle_active. We
should probably be able to use any one of them to replace the other.
CC: Frederic Weisbecker <fweisbec@gmail.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Ingo Molnar <mingo@kernel.org>
CC: linux-kernel@vger.kernel.org
Signed-off-by: Peter Xu <peterx@redhat.com>
---
kernel/time/tick-sched.c | 11 ++++-------
kernel/time/tick-sched.h | 3 +--
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index f4ee1a3428ae..6bb5ad03e962 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -137,7 +137,7 @@ static void tick_sched_do_timer(struct tick_sched *ts, ktime_t now)
if (tick_do_timer_cpu == cpu)
tick_do_update_jiffies64(now);
- if (ts->inidle)
+ if (ts->idle_active)
ts->got_idle_tick = 1;
}
@@ -534,7 +534,6 @@ static void tick_nohz_stop_idle(struct tick_sched *ts, ktime_t now)
{
update_ts_time_stats(smp_processor_id(), ts, now, NULL);
ts->idle_active = 0;
-
sched_clock_idle_wakeup_event();
}
@@ -999,7 +998,6 @@ void tick_nohz_idle_enter(void)
WARN_ON_ONCE(ts->timer_expires_base);
- ts->inidle = 1;
tick_nohz_start_idle(ts);
local_irq_enable();
@@ -1017,7 +1015,7 @@ void tick_nohz_irq_exit(void)
{
struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched);
- if (ts->inidle)
+ if (ts->idle_active)
tick_nohz_start_idle(ts);
else
tick_nohz_full_update_tick(ts);
@@ -1067,7 +1065,7 @@ ktime_t tick_nohz_get_sleep_length(ktime_t *delta_next)
ktime_t now = ts->idle_entrytime;
ktime_t next_event;
- WARN_ON_ONCE(!ts->inidle);
+ WARN_ON_ONCE(!ts->idle_active);
*delta_next = ktime_sub(dev->next_event, now);
@@ -1163,10 +1161,9 @@ void tick_nohz_idle_exit(void)
local_irq_disable();
- WARN_ON_ONCE(!ts->inidle);
+ WARN_ON_ONCE(!ts->idle_active);
WARN_ON_ONCE(ts->timer_expires_base);
- ts->inidle = 0;
idle_active = ts->idle_active;
tick_stopped = ts->tick_stopped;
diff --git a/kernel/time/tick-sched.h b/kernel/time/tick-sched.h
index 4fb06527cf64..ae9335d019f0 100644
--- a/kernel/time/tick-sched.h
+++ b/kernel/time/tick-sched.h
@@ -31,7 +31,7 @@ enum tick_nohz_mode {
* @idle_active: Indicator that the CPU is actively in the tick idle mode;
* it is resetted during irq handling phases.
* @do_timer_lst: CPU was the last one doing do_timer before going idle
- * @got_idle_tick: Tick timer function has run with @inidle set
+ * @got_idle_tick: Tick timer function has run with @idle_active set
* @last_tick: Store the last tick expiry time when the tick
* timer is modified for nohz sleeps. This is necessary
* to resume the tick timer operation in the timeline
@@ -55,7 +55,6 @@ struct tick_sched {
unsigned long check_clocks;
enum tick_nohz_mode nohz_mode;
- unsigned int inidle : 1;
unsigned int tick_stopped : 1;
unsigned int idle_active : 1;
unsigned int do_timer_last : 1;
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tick/sched: Drop duplicated tick_sched.inidle
2019-05-22 3:29 [PATCH] tick/sched: Drop duplicated tick_sched.inidle Peter Xu
@ 2019-05-22 12:18 ` Frederic Weisbecker
2019-05-23 5:32 ` Peter Xu
0 siblings, 1 reply; 3+ messages in thread
From: Frederic Weisbecker @ 2019-05-22 12:18 UTC (permalink / raw)
To: Peter Xu; +Cc: linux-kernel, Frederic Weisbecker, Thomas Gleixner, Ingo Molnar
On Wed, May 22, 2019 at 11:29:06AM +0800, Peter Xu wrote:
> It is set before entering idle and cleared when quitting idle, though
> it seems to be a complete duplicate of tick_sched.idle_active. We
> should probably be able to use any one of them to replace the other.
Not exactly.
@inidle is set on idle entry and cleared on idle exit.
@idle_active is the same but it's cleared during idle interrupts
so that idle_sleeptime only account real idle time.
And note below:
> @@ -1017,7 +1015,7 @@ void tick_nohz_irq_exit(void)
> {
> struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched);
>
> - if (ts->inidle)
> + if (ts->idle_active)
> tick_nohz_start_idle(ts);
idle_active will always be cleared here from tick_nohz_irq_enter().
We actually want to conditionally set it again depending on the inidle value.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tick/sched: Drop duplicated tick_sched.inidle
2019-05-22 12:18 ` Frederic Weisbecker
@ 2019-05-23 5:32 ` Peter Xu
0 siblings, 0 replies; 3+ messages in thread
From: Peter Xu @ 2019-05-23 5:32 UTC (permalink / raw)
To: Frederic Weisbecker
Cc: linux-kernel, Frederic Weisbecker, Thomas Gleixner, Ingo Molnar
On Wed, May 22, 2019 at 02:18:41PM +0200, Frederic Weisbecker wrote:
> On Wed, May 22, 2019 at 11:29:06AM +0800, Peter Xu wrote:
> > It is set before entering idle and cleared when quitting idle, though
> > it seems to be a complete duplicate of tick_sched.idle_active. We
> > should probably be able to use any one of them to replace the other.
>
> Not exactly.
>
> @inidle is set on idle entry and cleared on idle exit.
> @idle_active is the same but it's cleared during idle interrupts
> so that idle_sleeptime only account real idle time.
>
> And note below:
>
> > @@ -1017,7 +1015,7 @@ void tick_nohz_irq_exit(void)
> > {
> > struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched);
> >
> > - if (ts->inidle)
> > + if (ts->idle_active)
> > tick_nohz_start_idle(ts);
>
> idle_active will always be cleared here from tick_nohz_irq_enter().
> We actually want to conditionally set it again depending on the inidle value.
You are right; I've missed the calls from irq enter/exit. Thanks, Frederic.
--
Peter Xu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-05-23 5:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22 3:29 [PATCH] tick/sched: Drop duplicated tick_sched.inidle Peter Xu
2019-05-22 12:18 ` Frederic Weisbecker
2019-05-23 5:32 ` Peter Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).