lkml.org 
[lkml]   [2023]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 4/5] seccomp: add the synchronous mode for seccomp_unotify
On Thu, Jan 12, 2023 at 7:00 AM Tycho Andersen <tycho@tycho.pizza> wrote:
>
> On Tue, Jan 10, 2023 at 01:30:09PM -0800, Andrei Vagin wrote:
> > From: Andrei Vagin <avagin@gmail.com>
> >
> > seccomp_unotify allows more privileged processes do actions on behalf
> > of less privileged processes.
> >
> > In many cases, the workflow is fully synchronous. It means a target
> > process triggers a system call and passes controls to a supervisor
> > process that handles the system call and returns controls to the target
> > process. In this context, "synchronous" means that only one process is
> > running and another one is waiting.
> >
> > There is the WF_CURRENT_CPU flag that is used to advise the scheduler to
> > move the wakee to the current CPU. For such synchronous workflows, it
> > makes context switches a few times faster.
> >
> > Right now, each interaction takes 12盜. With this patch, it takes about
> > 3盜.
> >
> > This change introduces the SECCOMP_USER_NOTIF_FD_SYNC_WAKE_UP flag that
> > it used to enable the sync mode.
>
> What about just not having a flag and using the new primitives all the
> time? Is there any reason not to?

I was thinking about that but then I decided that it can have a
negative impact in cases
when workflows are not synchronous. This can happen when one process wakes up
another one and continues running on cpu. With the flag, both
processes are scheduled
on the same cpu. Without the flag, they can be scheduled on different
cpu-s and run
concurrently.

In the seccomp unotify, switches from tracee to supervisor are always
synchronous.
Switches into the opposite direction can be either type.

I think it is better to let users decide what type is more suitable
for their workloads.

Thanks,
Andrei

\
 
 \ /
  Last update: 2023-03-26 23:41    [W:0.653 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site