[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANDhNCokDDQAMkZve5===CC2fw2Rdhjx+RAuQ2auE=+jaPdQmw@mail.gmail.com>
Date: Thu, 4 Jan 2024 15:25:27 -0800
From: John Stultz <jstultz@...gle.com>
To: Metin Kaya <metin.kaya@....com>
Cc: LKML <linux-kernel@...r.kernel.org>, Peter Zijlstra <peterz@...radead.org>,
Joel Fernandes <joelaf@...gle.com>, Qais Yousef <qyousef@...gle.com>, Ingo Molnar <mingo@...hat.com>,
Juri Lelli <juri.lelli@...hat.com>, Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>, Valentin Schneider <vschneid@...hat.com>,
Steven Rostedt <rostedt@...dmis.org>, Ben Segall <bsegall@...gle.com>,
Zimuzo Ezeozue <zezeozue@...gle.com>, Youssef Esmat <youssefesmat@...gle.com>,
Mel Gorman <mgorman@...e.de>, Daniel Bristot de Oliveira <bristot@...hat.com>, Will Deacon <will@...nel.org>,
Waiman Long <longman@...hat.com>, Boqun Feng <boqun.feng@...il.com>,
"Paul E. McKenney" <paulmck@...nel.org>, Xuewen Yan <xuewen.yan94@...il.com>,
K Prateek Nayak <kprateek.nayak@....com>, Thomas Gleixner <tglx@...utronix.de>, kernel-team@...roid.com,
Valentin Schneider <valentin.schneider@....com>
Subject: Re: [PATCH v7 16/23] sched: Add deactivated (sleeping) owner handling
to find_proxy_task()
On Fri, Dec 22, 2023 at 12:33 AM Metin Kaya <metin.kaya@....com> wrote:
> On 20/12/2023 12:18 am, John Stultz wrote:
> > @@ -3936,13 +4063,19 @@ void sched_ttwu_pending(void *arg)
> > update_rq_clock(rq);
> >
> > llist_for_each_entry_safe(p, t, llist, wake_entry.llist) {
> > + int wake_flags;
> > if (WARN_ON_ONCE(p->on_cpu))
> > smp_cond_load_acquire(&p->on_cpu, !VAL);
> >
> > if (WARN_ON_ONCE(task_cpu(p) != cpu_of(rq)))
> > set_task_cpu(p, cpu_of(rq));
> >
> > - ttwu_do_activate(rq, p, p->sched_remote_wakeup ? WF_MIGRATED : 0, &rf);
> > + wake_flags = p->sched_remote_wakeup ? WF_MIGRATED : 0;
> > + ttwu_do_activate(rq, p, wake_flags, &rf);
> > + rq_unlock(rq, &rf);
> > + activate_blocked_entities(rq, p, wake_flags);
>
> I'm unsure if it's a big deal, but IRQs are disabled here and
> activate_blocked_entities() disables them again.
Yeah. activate_blocked_entities() is also called from try_to_wakeup()
where we don't have irqs disabled, so we still need to make sure irqs
are off there.
But activate_blocked_entities does irqsave/restore so it should safely
put us back to the proper state. We could rq_unlock_irqrestore() in
the above, but it seems silly to enable irqs here just to disable them
shortly after.
But let me know if it seems I didn't quite get your concern here.
> > @@ -6663,19 +6797,6 @@ proxy_resched_idle(struct rq *rq, struct task_struct *next)
> > return rq->idle;
> > }
> >
> > -static bool proxy_deactivate(struct rq *rq, struct task_struct *next)
> > -{
> > - unsigned long state = READ_ONCE(next->__state);
> > -
> > - /* Don't deactivate if the state has been changed to TASK_RUNNING */
> > - if (state == TASK_RUNNING)
> > - return false;
> > - if (!try_to_deactivate_task(rq, next, state, true))
>
> Now we can drop the last argument (deactivate_cond) of
> try_to_deactivate_task() since it can be determined via
> !task_is_blocked(p) I think. IOW:
True. I'll add that into the "Drop proxy_deactivate" patch in my
fine-grained series.
Thanks again for the feedback!
-john
Powered by blists - more mailing lists