lists.openwall.net   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  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210527144412.GB23086@willie-the-truck>
Date:   Thu, 27 May 2021 15:44:12 +0100
From:   Will Deacon <will@...nel.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     linux-arm-kernel@...ts.infradead.org, linux-arch@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Catalin Marinas <catalin.marinas@....com>,
        Marc Zyngier <maz@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Morten Rasmussen <morten.rasmussen@....com>,
        Qais Yousef <qais.yousef@....com>,
        Suren Baghdasaryan <surenb@...gle.com>,
        Quentin Perret <qperret@...gle.com>, Tejun Heo <tj@...nel.org>,
        Johannes Weiner <hannes@...xchg.org>,
        Ingo Molnar <mingo@...hat.com>,
        Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        kernel-team@...roid.com
Subject: Re: [PATCH v7 16/22] sched: Defer wakeup in ttwu() for unschedulable
 frozen tasks

On Thu, May 27, 2021 at 04:31:51PM +0200, Peter Zijlstra wrote:
> On Thu, May 27, 2021 at 04:10:16PM +0200, Peter Zijlstra wrote:
> > On Tue, May 25, 2021 at 04:14:26PM +0100, Will Deacon wrote:
> > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > > index 42e2aecf087c..6cb9677d635a 100644
> > > --- a/kernel/sched/core.c
> > > +++ b/kernel/sched/core.c
> > > @@ -3529,6 +3529,19 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
> > >  	if (!(p->state & state))
> > >  		goto unlock;
> > >  
> > > +#ifdef CONFIG_FREEZER
> > > +	/*
> > > +	 * If we're going to wake up a thread which may be frozen, then
> > > +	 * we can only do so if we have an active CPU which is capable of
> > > +	 * running it. This may not be the case when resuming from suspend,
> > > +	 * as the secondary CPUs may not yet be back online. See __thaw_task()
> > > +	 * for the actual wakeup.
> > > +	 */
> > > +	if (unlikely(frozen_or_skipped(p)) &&
> > > +	    !cpumask_intersects(cpu_active_mask, task_cpu_possible_mask(p)))
> > > +		goto unlock;
> > > +#endif
> > > +
> > >  	trace_sched_waking(p);
> > >  
> > >  	/* We're going to change ->state: */
> > 
> > OK, I really hate this. This is slowing down the very hot wakeup path
> > for the silly freezer that *never* happens. Let me try and figure out if
> > there's another option.
> 
> 
> How's something *completely* untested like this?

I'm not seeing how this handles tasks which weren't put in the freezer
because they have PF_FREEZER_SKIP set. For these tasks, we need to make
sure that they don't become runnable before we have onlined a core which
is capable of running them, and this could occur because of any old
wakeup (i.e. whatever it was that they blocked on).

Will

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ