public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Yicong Yang <yangyicong@huawei.com>
Cc: mingo@redhat.com, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	tim.c.chen@linux.intel.com, yu.c.chen@intel.com,
	gautham.shenoy@amd.com, mgorman@suse.de, vschneid@redhat.com,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, rostedt@goodmis.org,
	bsegall@google.com, bristot@redhat.com, prime.zeng@huawei.com,
	yangyicong@hisilicon.com, jonathan.cameron@huawei.com,
	ego@linux.vnet.ibm.com, srikar@linux.vnet.ibm.com,
	linuxarm@huawei.com, 21cnbao@gmail.com, kprateek.nayak@amd.com,
	wuyun.abel@bytedance.com
Subject: Re: [PATCH v11 2/3] sched/fair: Scan cluster before scanning LLC in wake-up path
Date: Fri, 20 Oct 2023 15:41:30 +0200	[thread overview]
Message-ID: <20231020134130.GC33965@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20231019033323.54147-3-yangyicong@huawei.com>

On Thu, Oct 19, 2023 at 11:33:22AM +0800, Yicong Yang wrote:

> @@ -7349,8 +7373,13 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target)
>  	 */
>  	if (prev != target && cpus_share_cache(prev, target) &&
>  	    (available_idle_cpu(prev) || sched_idle_cpu(prev)) &&
> -	    asym_fits_cpu(task_util, util_min, util_max, prev))
> -		return prev;
> +	    asym_fits_cpu(task_util, util_min, util_max, prev)) {
> +		if (!static_branch_unlikely(&sched_cluster_active))
> +			return prev;
> +
> +		if (cpus_share_resources(prev, target))
> +			return prev;
> +	}
>  
>  	/*
>  	 * Allow a per-cpu kthread to stack with the wakee if the
> @@ -7377,7 +7406,11 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target)
>  	    (available_idle_cpu(recent_used_cpu) || sched_idle_cpu(recent_used_cpu)) &&
>  	    cpumask_test_cpu(recent_used_cpu, p->cpus_ptr) &&
>  	    asym_fits_cpu(task_util, util_min, util_max, recent_used_cpu)) {
> -		return recent_used_cpu;
> +		if (!static_branch_unlikely(&sched_cluster_active))
> +			return recent_used_cpu;
> +
> +		if (cpus_share_resources(recent_used_cpu, target))
> +			return recent_used_cpu;
>  	}
>  
>  	/*

I've changed those like so:


--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7420,10 +7420,9 @@ static int select_idle_sibling(struct ta
 	if (prev != target && cpus_share_cache(prev, target) &&
 	    (available_idle_cpu(prev) || sched_idle_cpu(prev)) &&
 	    asym_fits_cpu(task_util, util_min, util_max, prev)) {
-		if (!static_branch_unlikely(&sched_cluster_active))
-			return prev;
 
-		if (cpus_share_resources(prev, target))
+		if (!static_branch_unlikely(&sched_cluster_active) ||
+		    cpus_share_resources(prev, target))
 			return prev;
 	}
 
@@ -7452,11 +7451,11 @@ static int select_idle_sibling(struct ta
 	    (available_idle_cpu(recent_used_cpu) || sched_idle_cpu(recent_used_cpu)) &&
 	    cpumask_test_cpu(recent_used_cpu, p->cpus_ptr) &&
 	    asym_fits_cpu(task_util, util_min, util_max, recent_used_cpu)) {
-		if (!static_branch_unlikely(&sched_cluster_active))
-			return recent_used_cpu;
 
-		if (cpus_share_resources(recent_used_cpu, target))
+		if (!static_branch_unlikely(&sched_cluster_active) ||
+		    cpus_share_resources(recent_used_cpu, target))
 			return recent_used_cpu;
+
 	}
 
 	/*

  reply	other threads:[~2023-10-20 13:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19  3:33 [PATCH v11 0/3] sched/fair: Scan cluster before scanning LLC in wake-up path Yicong Yang
2023-10-19  3:33 ` [PATCH v11 1/3] sched: Add cpus_share_resources API Yicong Yang
2023-10-24  8:52   ` [tip: sched/core] " tip-bot2 for Barry Song
2023-10-19  3:33 ` [PATCH v11 2/3] sched/fair: Scan cluster before scanning LLC in wake-up path Yicong Yang
2023-10-20 13:41   ` Peter Zijlstra [this message]
2023-10-24  8:52   ` [tip: sched/core] " tip-bot2 for Barry Song
2023-10-19  3:33 ` [PATCH v11 3/3] sched/fair: Use candidate prev/recent_used CPU if scanning failed for cluster wakeup Yicong Yang
2023-10-19 12:08   ` Vincent Guittot
2023-10-20  7:36   ` Chen Yu
2023-10-24  8:52   ` [tip: sched/core] " tip-bot2 for Yicong Yang
2023-10-20 13:43 ` [PATCH] sched/fair: Remove SIS_PROP Peter Zijlstra
2023-10-20 14:23   ` Vincent Guittot
2023-10-23  3:55   ` Yicong Yang
2023-10-23  8:42   ` Mel Gorman
2023-10-24  8:52   ` [tip: sched/core] " tip-bot2 for Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231020134130.GC33965@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=21cnbao@gmail.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=ego@linux.vnet.ibm.com \
    --cc=gautham.shenoy@amd.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=prime.zeng@huawei.com \
    --cc=rostedt@goodmis.org \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=tim.c.chen@linux.intel.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=wuyun.abel@bytedance.com \
    --cc=yangyicong@hisilicon.com \
    --cc=yangyicong@huawei.com \
    --cc=yu.c.chen@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox