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] [day] [month] [year] [list]
Message-ID: <ZvqE8MBYdGwHBkVh@chenyu5-mobl2>
Date: Mon, 30 Sep 2024 19:01:04 +0800
From: Chen Yu <yu.c.chen@...el.com>
To: Peter Zijlstra <peterz@...radead.org>
CC: 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>,
	"Chunxin Zang" <zangchunxin@...iang.com>, <linux-kernel@...r.kernel.org>,
	Chen Yu <yu.chen.surf@...il.com>, kernel test robot <oliver.sang@...el.com>,
	"K Prateek Nayak" <kprateek.nayak@....com>
Subject: Re: [PATCH v2] sched/eevdf: Fix wakeup-preempt by checking
 cfs_rq->nr_running

On 2024-09-30 at 09:50:45 +0200, Peter Zijlstra wrote:
> On Wed, Sep 25, 2024 at 04:54:40PM +0800, Chen Yu wrote:
> > Commit 85e511df3cec ("sched/eevdf: Allow shorter slices to wakeup-preempt")
> > introduced a mechanism that a wakee with shorter slice could preempt
> > the current running task. It also lower the bar for the current task
> > to be preempted, by checking the rq->nr_running instead of cfs_rq->nr_running
> > when the current task has ran out of time slice. But there is a scenario
> > that is problematic. Say, if there is 1 cfs task and 1 rt task, before
> > 85e511df3cec, update_deadline() will not trigger a reschedule, and after
> > 85e511df3cec, since rq->nr_running is 2 and resched is true, a resched_curr()
> > would happen.
> > 
> 
> So I'm applying the patch (that change was not indended), but I'm a
> little confused by the above description. If we already have TIF_RESCHED
> set, then doing resched_curr() should be a NO-OP.
> 
> At the same time, how can we have an RT task and not get TIF_RESCHED
> set.

You are right, the curr should have TIF_RESCHED set if there is
RT in the rq, because after the RT task is enqueued, wakeup_preempt()
should set TIF_RESCHED for current CFS task. The 1 RT + 1 CFS task
was just suspicion when trying to figure out why commit 85e511df3cec
increased preemption. (besides the suspicion of
did_preempt_short() -> entity_eligible().) and the test patch
seems to recover the performance 0day reported, so we did not chase
from did_preempt_short().

Another scenario I'm thinking of to increase preemption regarding the
nr_running check might be(and per Honglei's feedback):
There is 1 cfs task p1 in the current cfs_rq1, and 1 cfs task
p2 in the parent cfs_rq2. The rq->nr_running is 2, and the p1's
cfs_rq1->nr_running is 1. Before the commit, there is no preemption
on cfs_rq1, after the commit, p1 is set to TIF_RESCHED and the CPU
reschedule from topdown and pick p2.

thanks,
Chenyu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ