[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230308073201.3102738-4-avagin@google.com>
Date: Wed, 26 Apr 2023 16:43:16 +0200
From: Bernd Schubert <bschubert@....com>
To: avagin@...gle.com
Cc: avagin@...il.com, brauner@...nel.org, dietmar.eggemann@....com,
juri.lelli@...hat.com, keescook@...omium.org,
linux-kernel@...r.kernel.org, luto@...capital.net,
mingo@...hat.com, peterz@...radead.org, posk@...gle.com,
tycho@...ho.pizza, vincent.guittot@...aro.org, wad@...omium.org,
yu.c.chen@...el.com
Subject: Re: [PATCH 3/6] sched: add a few helpers to wake up tasks on the current cpu
> Add complete_on_current_cpu, wake_up_poll_on_current_cpu helpers to wake
> up tasks on the current CPU.
> These two helpers are useful when the task needs to make a synchronous context
> switch to another task. In this context, synchronous means it wakes up the
> target task and falls asleep right after that.
> One example of such workloads is seccomp user notifies. This mechanism allows
> the supervisor process handles system calls on behalf of a target process.
> While the supervisor is handling an intercepted system call, the target process
> will be blocked in the kernel, waiting for a response to come back.
> On-CPU context switches are much faster than regular ones.
> Signed-off-by: Andrei Vagin <avagin@...gle.com>
Avoiding cpu switches is very desirable for fuse, I'm working on fuse over uring
with per core queues. In my current branch and running a single threaded bonnie++
I get about 9000 creates/s when I bind the process to a core, about 7000 creates/s
when I set SCHED_IDLE for the ring threads and back to 9000 with SCHED_IDLE and
disabling cpu migration in fs/fuse/dev.c request_wait_answer() before going into
the waitq and enabling it back after waking up.
I had reported this a few weeks back
https://lore.kernel.org/lkml/d0ed1dbd-1b7e-bf98-65c0-7f61dd1a3228@ddn.com/
and had been pointed to your and Prateeks patch series. I'm now going
through these series. Interesting part is that a few weeks I didn't need
SCHED_IDLE, just disabling/enabling migration before/after waking up was
enough.
[...]
> EXPORT_SYMBOL(swake_up_one);
> diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c
> index 133b74730738..47803a0b8d5d 100644
> --- a/kernel/sched/wait.c
> +++ b/kernel/sched/wait.c
> @@ -161,6 +161,11 @@ int __wake_up(struct wait_queue_head *wq_head, unsigned int mode,
> }
> EXPORT_SYMBOL(__wake_up);
> +void __wake_up_on_current_cpu(struct wait_queue_head *wq_head, unsigned int mode, void *key)
> +{
> + __wake_up_common_lock(wq_head, mode, 1, WF_CURRENT_CPU, key);
> +}
I'm about to test this instead of migrate_disable/migrate_enable, but the symbol needs
to be exported - any objection to do that right from the beginning in your patch?
Thanks,
Bernd
Powered by blists - more mailing lists