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]
Date:   Fri, 4 Nov 2022 12:35:57 +0800
From:   Chen Yu <yu.c.chen@...el.com>
To:     Peter Zijlstra <peterz@...radead.org>
CC:     Vincent Guittot <vincent.guittot@...aro.org>,
        Tim Chen <tim.c.chen@...el.com>,
        Mel Gorman <mgorman@...hsingularity.net>,
        Juri Lelli <juri.lelli@...hat.com>,
        Rik van Riel <riel@...riel.com>,
        Aaron Lu <aaron.lu@...el.com>,
        Abel Wu <wuyun.abel@...edance.com>,
        K Prateek Nayak <kprateek.nayak@....com>,
        Yicong Yang <yangyicong@...ilicon.com>,
        "Gautham R . Shenoy" <gautham.shenoy@....com>,
        Ingo Molnar <mingo@...hat.com>,
        "Dietmar Eggemann" <dietmar.eggemann@....com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ben Segall <bsegall@...gle.com>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        Valentin Schneider <vschneid@...hat.com>,
        Hillf Danton <hdanton@...a.com>,
        Honglei Wang <wanghonglei@...ichuxing.com>,
        Len Brown <len.brown@...el.com>,
        Chen Yu <yu.chen.surf@...il.com>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH v2 2/2] sched/fair: Choose the CPU where short task
 is running during wake up

On 2022-11-03 at 14:04:43 +0100, Peter Zijlstra wrote:
> On Sun, Oct 23, 2022 at 11:33:39PM +0800, Chen Yu wrote:
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 8820d0d14519..3a8ee6232c59 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -6249,6 +6249,11 @@ wake_affine_idle(int this_cpu, int prev_cpu, int sync)
> >  	if (available_idle_cpu(prev_cpu))
> >  		return prev_cpu;
> >  
> > +	/* The only running task is a short duration one. */
> > +	if (cpu_rq(this_cpu)->nr_running == 1 &&
> > +	    is_short_task(cpu_curr(this_cpu)))
> > +		return this_cpu;
> > +
> >  	return nr_cpumask_bits;
> >  }
> 
> This is very close to using is_short_task() as dynamic WF_SYNC hint, no?
>
Yes. I think a short task waker is a subset of WF_SYNC wake up, because a short
task waker might go to sleep soon after wakeup the wakee.
> > @@ -6623,6 +6628,23 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, bool
> >  			/* overloaded LLC is unlikely to have idle cpu/core */
> >  			if (nr == 1)
> >  				return -1;
> > +
> > +			/*
> > +			 * If nr is smaller than 60% of llc_weight, it
> > +			 * indicates that the util_avg% is higher than 50%.
> > +			 * This is calculated by SIS_UTIL in
> > +			 * update_idle_cpu_scan(). The 50% util_avg indicates
> > +			 * a half-busy LLC domain. System busier than this
> > +			 * level could lower its bar to choose a compromised
> > +			 * "idle" CPU, so as to avoid the overhead of cross
> > +			 * CPU wakeup. If the task on target CPU is a short
> > +			 * duration one, and it is the only running task, pick
> > +			 * target directly.
> > +			 */
> > +			if (!has_idle_core && (5 * nr < 3 * sd->span_weight) &&
> > +			    cpu_rq(target)->nr_running == 1 &&
> > +			    is_short_task(cpu_curr(target)))
> > +				return target;
> >  		}
> >  	}
> 
> And here you're basically saying that if the domain is 'busy' and the
> task is short, don't spend time searching for a better location.
> 
> Should we perhaps only consider shortness; after all, spending more time
> searching for an idle cpu than the task would've taken to run is daft.
> Business of the domain seems unrelated to that.
I see, the this_sd->avg_scan_cost could be used for the comparison, I'll
have a try.
> 
> 
> Also, I'm not sure on your criteria for short; but I don't have enough
> thoughts on that yet.
Yes, the criteria to define a short task is arbitrary. If we compare the
avg_duration of a task with the sd->avg_scan_cost then we can skip the
defination of short task.

thanks,
Chenyu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ