From: Abel Wu <wuyun.abel@bytedance.com>
To: Chen Yu <yu.c.chen@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Mel Gorman <mgorman@suse.de>,
Vincent Guittot <vincent.guittot@linaro.org>,
Josh Don <joshdon@google.com>,
Tim Chen <tim.c.chen@linux.intel.com>,
K Prateek Nayak <kprateek.nayak@amd.com>,
"Gautham R . Shenoy" <gautham.shenoy@amd.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 3/5] sched/fair: Skip core update if task pending
Date: Fri, 9 Sep 2022 18:13:38 +0800 [thread overview]
Message-ID: <430e6ac7-145c-2b74-93a9-c77338e488b1@bytedance.com> (raw)
In-Reply-To: <YxsLXunUjY2vBeDX@chenyu5-mobl1>
On 9/9/22 6:09 PM, Chen Yu wrote:
> On 2022-09-09 at 13:53:02 +0800, Abel Wu wrote:
>> The function __update_idle_core() considers this cpu is idle so
>> only checks its siblings to decide whether the resident core is
>> idle or not and update has_idle_cores hint if necessary. But the
>> problem is that this cpu might not be idle at that moment any
>> more, resulting in the hint being misleading.
>>
>> It's not proper to make this check everywhere in the idle path,
>> but checking just before core updating can make the has_idle_core
>> hint more reliable with negligible cost.
>>
>> Signed-off-by: Abel Wu <wuyun.abel@bytedance.com>
>> ---
>> kernel/sched/fair.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index 7abe188a1533..fad289530e07 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -6294,6 +6294,9 @@ void __update_idle_core(struct rq *rq)
>> int core = cpu_of(rq);
>> int cpu;
>>
>> + if (rq->ttwu_pending)
>> + return;
>> +
> Is it to deal with the race condition? I'm thinking of the
> following scenario: task p1 on rq1 is about to switch to idle.
> However when p1 reaches __update_idle_core(), someone on other
> CPU tries to wake up p2, and leverages rq1 to queue p2
> thus set the ttwu_pending flag on rq1. It is likely that
> rq1 becomes idle but soon finds that TF_NEED_RESCHED is set, thus
> quits the idle loop. As a result rq will not be idle and we will
> get false positive here.
Yes, exactly as you said.
next prev parent reply other threads:[~2022-09-09 10:13 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-09 5:52 [PATCH v5 0/5] sched/fair: Improve scan efficiency of SIS Abel Wu
2022-09-09 5:53 ` [PATCH v5 1/5] sched/fair: Ignore SIS_UTIL when has idle core Abel Wu
2022-09-14 21:58 ` Tim Chen
2022-09-09 5:53 ` [PATCH v5 2/5] sched/fair: Limited scan for idle cores when overloaded Abel Wu
2022-09-09 9:29 ` Chen Yu
2022-09-09 10:11 ` Abel Wu
2022-09-14 22:25 ` Tim Chen
2022-09-15 3:08 ` Abel Wu
2022-09-09 5:53 ` [PATCH v5 3/5] sched/fair: Skip core update if task pending Abel Wu
2022-09-09 10:09 ` Chen Yu
2022-09-09 10:13 ` Abel Wu [this message]
2022-09-14 22:37 ` Tim Chen
2022-09-09 5:53 ` [PATCH v5 4/5] sched/fair: Skip SIS domain scan if fully busy Abel Wu
2022-09-14 6:21 ` Yicong Yang
2022-09-14 7:43 ` Abel Wu
2022-09-15 0:22 ` Tim Chen
2022-09-15 3:11 ` Abel Wu
2022-09-09 5:53 ` [PATCH v5 5/5] sched/fair: Introduce SIS_FILTER Abel Wu
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=430e6ac7-145c-2b74-93a9-c77338e488b1@bytedance.com \
--to=wuyun.abel@bytedance.com \
--cc=gautham.shenoy@amd.com \
--cc=joshdon@google.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=peterz@infradead.org \
--cc=tim.c.chen@linux.intel.com \
--cc=vincent.guittot@linaro.org \
--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
all inboxes | Powered by JetHome®