linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrei Vagin <avagin@google.com>
To: Bernd Schubert <bschubert@ddn.com>
Cc: avagin@gmail.com, brauner@kernel.org, dietmar.eggemann@arm.com,
	juri.lelli@redhat.com, keescook@chromium.org,
	linux-kernel@vger.kernel.org, luto@amacapital.net,
	mingo@redhat.com, peterz@infradead.org, posk@google.com,
	tycho@tycho.pizza, vincent.guittot@linaro.org, wad@chromium.org,
	yu.c.chen@intel.com
Subject: Re: [PATCH 3/6] sched: add a few helpers to wake up tasks on the current cpu
Date: Wed, 26 Apr 2023 11:52:49 -0700	[thread overview]
Message-ID: <CAEWA0a68dgA_sZVV7YWrrvK1=GkpEW1KcF1FNcmFOkDx+QKxYA@mail.gmail.com> (raw)
In-Reply-To: <20230308073201.3102738-4-avagin@google.com>

On Wed, Apr 26, 2023 at 7:43 AM Bernd Schubert <bschubert@ddn.com> wrote:
>
> > 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@google.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?

I think EXPORT_SYMBOL_GPL should not trigger any objections and it
covers your case, doesn't it?

Thanks,
Andrei

  parent reply	other threads:[~2023-04-26 18:53 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-08  7:31 [PATCH 0/6 v5 RESEND] seccomp: add the synchronous mode for seccomp_unotify Andrei Vagin
2023-03-08  7:31 ` [PATCH 1/6] seccomp: don't use semaphore and wait_queue together Andrei Vagin
2023-03-08  7:31 ` [PATCH 2/6] sched: add WF_CURRENT_CPU and externise ttwu Andrei Vagin
2023-04-08  3:20   ` Chen Yu
2023-04-10  4:56     ` Andrei Vagin
2023-04-10 17:27       ` Andy Lutomirski
2023-04-12 19:38         ` Andrei Vagin
2023-04-10 18:16       ` Chen Yu
2023-04-11  1:50         ` Chen Yu
2023-04-17 19:24         ` Andrei Vagin
2023-03-08  7:31 ` [PATCH 3/6] sched: add a few helpers to wake up tasks on the current cpu Andrei Vagin
2023-04-26 14:43   ` Bernd Schubert
2023-04-26 18:52   ` Andrei Vagin [this message]
2023-04-26 19:35     ` Bernd Schubert
2023-04-26 20:57       ` Bernd Schubert
2023-03-08  7:31 ` [PATCH 4/6] seccomp: add the synchronous mode for seccomp_unotify Andrei Vagin
2023-04-06  3:42   ` Andy Lutomirski
2023-04-10  6:59     ` Andrei Vagin
2023-04-10 20:53       ` Andy Lutomirski
2023-03-08  7:32 ` [PATCH 5/6] selftest/seccomp: add a new test for the sync mode of seccomp_user_notify Andrei Vagin
2023-03-08  7:32 ` [PATCH 6/6] perf/benchmark: add a new benchmark for seccom_unotify Andrei Vagin
2023-09-08 17:35   ` [PATCH] perf/benchmark: Fix ifdef in header file uapi/asm/unistd_32.h Vijayendra Suman
2023-09-08 17:38     ` Andrei Vagin
2023-09-08 18:18     ` Tycho Andersen
2023-10-17  8:24   ` [PATCH 6/6] perf/benchmark: add a new benchmark for seccom_unotify Jiri Slaby
2023-03-21 18:19 ` [PATCH 0/6 v5 RESEND] seccomp: add the synchronous mode for seccomp_unotify Andrei Vagin
2023-03-27 10:27 ` Peter Zijlstra
2023-04-03 18:32   ` Andrei Vagin
2023-04-06  3:19     ` Kees Cook
2023-06-28 18:44       ` Andrei Vagin
2023-06-28 23:32         ` Kees Cook
  -- strict thread matches above, loose matches on Subject: below --
2023-02-02  3:04 [PATCH 0/6 v5] " Andrei Vagin
2023-02-02  3:04 ` [PATCH 3/6] sched: add a few helpers to wake up tasks on the current cpu Andrei Vagin
2023-02-15 20:15   ` Andrei Vagin
2023-01-24 23:41 [PATCH 0/6 v4] seccomp: add the synchronous mode for seccomp_unotify Andrei Vagin
2023-01-24 23:41 ` [PATCH 3/6] sched: add a few helpers to wake up tasks on the current cpu Andrei Vagin

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='CAEWA0a68dgA_sZVV7YWrrvK1=GkpEW1KcF1FNcmFOkDx+QKxYA@mail.gmail.com' \
    --to=avagin@google.com \
    --cc=avagin@gmail.com \
    --cc=brauner@kernel.org \
    --cc=bschubert@ddn.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=posk@google.com \
    --cc=tycho@tycho.pizza \
    --cc=vincent.guittot@linaro.org \
    --cc=wad@chromium.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;
as well as URLs for NNTP newsgroup(s).