[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ys/9e52SDRp8Kpnn@worktop.programming.kicks-ass.net>
Date: Thu, 14 Jul 2022 13:26:51 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Libo Chen <libo.chen@...cle.com>
Cc: vincent.guittot@...aro.org, mgorman@...e.de,
tim.c.chen@...ux.intel.com, 21cnbao@...il.com,
dietmar.eggemann@....com, linux-kernel@...r.kernel.org,
tglx@...utronix.de
Subject: Re: [PATCH] sched/fair: no sync wakeup from interrupt context
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@...cle.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
>
Powered by blists - more mailing lists