All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Libo Chen <libo.chen@oracle.com>
Cc: vincent.guittot@linaro.org, mgorman@suse.de,
	tim.c.chen@linux.intel.com, 21cnbao@gmail.com,
	dietmar.eggemann@arm.com, linux-kernel@vger.kernel.org,
	tglx@linutronix.de
Subject: Re: [PATCH] sched/fair: no sync wakeup from interrupt context
Date: Thu, 14 Jul 2022 13:26:51 +0200	[thread overview]
Message-ID: <Ys/9e52SDRp8Kpnn@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20220711224704.1672831-1-libo.chen@oracle.com>

On Mon, Jul 11, 2022 at 03:47:04PM -0700, Libo Chen wrote:
> Barry Song first pointed out that replacing sync wakeup with regular wakeup
> seems to reduce overeager wakeup pulling and shows noticeable performance
> improvement.[1]
> 
> This patch argues that allowing sync for wakeups from interrupt context
> is a bug 

Yes.

> The
> assumption is built into wake_affine() where it discounts the waker's presence
> from the runqueue when sync is true. The random waker from interrupts bears no
> relation to the wakee and don't usually go to sleep immediately afterwards
> unless wakeup granularity is reached. 

Exactly that.

> Signed-off-by: Libo Chen <libo.chen@oracle.com>
> ---
>  kernel/sched/fair.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 794c2cb945f8..59b210d2cdb5 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -6704,7 +6704,9 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)
>  static int
>  select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags)
>  {
> -	int sync = (wake_flags & WF_SYNC) && !(current->flags & PF_EXITING);
> +	/* Don't set sync for wakeup from irq/soft ctx */
> +	int sync = in_task() && (wake_flags & WF_SYNC)
> +		   && !(current->flags & PF_EXITING);

That's not a coding style you'll find anywhere near this code though.
I'll fix it up.

>  	struct sched_domain *tmp, *sd = NULL;
>  	int cpu = smp_processor_id();
>  	int new_cpu = prev_cpu;
> --
> 2.31.1
> 

  parent reply	other threads:[~2022-07-14 11:27 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-11 22:47 [PATCH] sched/fair: no sync wakeup from interrupt context Libo Chen
2022-07-13 16:40 ` Tim Chen
     [not found]   ` <0917f479-b6aa-19de-3d6a-6fd422df4d21@oracle.com>
2022-07-13 19:34     ` Libo Chen
2022-07-13 20:51     ` Tim Chen
2022-07-13 21:37       ` Libo Chen
2022-07-14 14:18     ` Mel Gorman
2022-07-14 20:21       ` Libo Chen
2022-07-15 10:07         ` Mel Gorman
2022-07-14 11:26 ` Peter Zijlstra [this message]
2022-07-14 11:35 ` Peter Zijlstra
2022-07-14 18:18   ` Libo Chen
2022-07-21  8:44 ` [tip: sched/core] sched/fair: Disallow " tip-bot2 for Libo Chen
2022-07-29  4:47 ` [PATCH] sched/fair: no " K Prateek Nayak
2022-08-01 13:26   ` Ingo Molnar
2022-08-01 14:59     ` Libo Chen
2022-08-03  9:18       ` Ingo Molnar
2022-08-03 19:37         ` Libo Chen
2022-08-04  8:55           ` Ingo Molnar
2022-08-04  9:51             ` Mel Gorman
2022-08-01 14:57   ` Libo Chen
2022-08-02  4:40     ` K Prateek Nayak

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=Ys/9e52SDRp8Kpnn@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=21cnbao@gmail.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=libo.chen@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=tglx@linutronix.de \
    --cc=tim.c.chen@linux.intel.com \
    --cc=vincent.guittot@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.