lkml.org 
[lkml]   [2020]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 00/13] Reconcile NUMA balancing decisions with the load balancer v6
On Fri, May 22, 2020 at 02:28:54PM +0100, Mel Gorman wrote:

> Is something like this on top of your patch what you had in mind?

All under the assumption that is makes it go faster of course ;-)

> ---8<---

static inline bool ttwu_queue_cond()
{
/*
* If the CPU does not share cache, then queue the task on the
* remote rqs wakelist to avoid accessing remote data.
*/
if (!cpus_share_cache(smp_processor_id(), cpu))
return true;

/*
* If the task is descheduling and the only running task on the
* CPU, ....
*/
if ((wake_flags & WF_ON_RQ) && cpu_rq(cpu)->nr_running <= 1)
return true;

return false;
}

> -static bool ttwu_queue_remote(struct task_struct *p, int cpu, int wake_flags)
> +static bool ttwu_queue_wakelist(struct task_struct *p, int cpu, int wake_flags)
> {
> - if (sched_feat(TTWU_QUEUE) && !cpus_share_cache(smp_processor_id(), cpu)) {
> - sched_clock_cpu(cpu); /* Sync clocks across CPUs */
> - __ttwu_queue_remote(p, cpu, wake_flags);
> - return true;
> + if (sched_feat(TTWU_QUEUE)) {
> + /*
> + * If CPU does not share cache then queue the task on the remote
> + * rqs wakelist to avoid accessing remote data. Alternatively,
> + * if the task is descheduling and the only running task on the
> + * CPU then use the wakelist to offload the task activation to
> + * the CPU that will soon be idle so the waker can continue.
> + * nr_running is checked to avoid unnecessary task stacking.
> + */
> + if (!cpus_share_cache(smp_processor_id(), cpu) ||
> + ((wake_flags & WF_ON_RQ) && cpu_rq(cpu)->nr_running <= 1)) {
> + sched_clock_cpu(cpu); /* Sync clocks across CPUs */
> + __ttwu_queue_wakelist(p, cpu, wake_flags);
> + return true;
> + }

if (sched_feat(TTWU_QUEUE) && ttwu_queue_cond(cpu, wake_flags)) {
sched_clock_cpu(cpu); /* Sync clocks across CPUs */
__ttwu_queue_remote(p, cpu, wake_flags);
return true;

> }
>
> return false;


might be easier to read...

\
 
 \ /
  Last update: 2020-05-22 16:40    [W:0.148 / U:0.460 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site