From: Frederic Weisbecker <frederic@kernel.org>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: LKML <linux-kernel@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Valentin Schneider <vschneid@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Oleg Nesterov <oleg@redhat.com>
Subject: Re: [RFC PATCH 5/6] sched/isolation: Introduce isolated task work
Date: Wed, 3 Jul 2024 14:47:51 +0200 [thread overview]
Message-ID: <ZoVId-DDDVvdmUZX@localhost.localdomain> (raw)
In-Reply-To: <672db961-6056-426d-bf62-5688344be304@suse.cz>
Le Wed, Jun 26, 2024 at 03:27:59PM +0200, Vlastimil Babka a écrit :
> On 6/25/24 3:52 PM, Frederic Weisbecker wrote:
> > Some asynchronous kernel work may be pending upon resume to userspace
> > and execute later on. On isolated workload this becomes problematic once
> > the process is done with preparatory work involving syscalls and wants
> > to run in userspace without being interrupted.
> >
> > Provide an infrastructure to queue a work to be executed from the current
> > isolated task context right before resuming to userspace. This goes with
> > the assumption that isolated tasks are pinned to a single nohz_full CPU.
> >
> > Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
> > ---
> > include/linux/sched.h | 1 +
> > include/linux/sched/isolation.h | 17 +++++++++++++++++
> > kernel/sched/core.c | 1 +
> > kernel/sched/isolation.c | 31 +++++++++++++++++++++++++++++++
> > kernel/sched/sched.h | 1 +
> > 5 files changed, 51 insertions(+)
> >
> > diff --git a/include/linux/sched.h b/include/linux/sched.h
> > index d531b610c410..f6df21866055 100644
> > --- a/include/linux/sched.h
> > +++ b/include/linux/sched.h
> > @@ -1349,6 +1349,7 @@ struct task_struct {
> > #endif
> >
> > #ifdef CONFIG_NO_HZ_FULL
> > + struct callback_head nohz_full_work;
> > atomic_t tick_dep_mask;
> > #endif
> >
> > diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h
> > index 2b461129d1fa..e69ec5ed1d70 100644
> > --- a/include/linux/sched/isolation.h
> > +++ b/include/linux/sched/isolation.h
> > @@ -72,4 +72,21 @@ static inline bool cpu_is_isolated(int cpu)
> > cpuset_cpu_is_isolated(cpu);
> > }
> >
> > +#if defined(CONFIG_NO_HZ_FULL)
> > +extern int __isolated_task_work_queue(void);
> > +
> > +static inline int isolated_task_work_queue(void)
> > +{
> > + if (!housekeeping_test_cpu(raw_smp_processor_id(), HK_TYPE_TICK))
>
> This is an unconditional call to a function defined in
> kernel/sched/isolation.c, and only there a static_branch_unlikely() test
> happens, but the call overhead is always paid, and the next patch adds that
> to folio_add_lru().
>
> I notice a housekeeping_cpu() function above that does the static branch
> inline, which is great, except it defaults to return true so not directly
> applicable, but this function could be done the same way to keep the static
> branch inline.
Right, there definetly needs some inlining.
Thanks.
next prev parent reply other threads:[~2024-07-03 12:47 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-25 13:52 [RFC PATCH 0/6] mm: LRU drain flush on nohz_full Frederic Weisbecker
2024-06-25 13:52 ` [RFC PATCH 1/6] task_work: Provide means to check if a work is queued Frederic Weisbecker
2024-06-25 14:15 ` Oleg Nesterov
2024-06-25 15:16 ` Oleg Nesterov
2024-07-03 12:42 ` Frederic Weisbecker
2024-07-03 12:41 ` Frederic Weisbecker
2024-07-16 13:00 ` Valentin Schneider
2024-06-25 13:52 ` [RFC PATCH 2/6] sched/fair: Use task_work_queued() on numa_work Frederic Weisbecker
2024-07-16 13:00 ` Valentin Schneider
2024-06-25 13:52 ` [RFC PATCH 3/6] sched: Use task_work_queued() on cid_work Frederic Weisbecker
2024-07-16 13:00 ` Valentin Schneider
2024-06-25 13:52 ` [RFC PATCH 4/6] tick/nohz: Move nohz_full related fields out of hot task struct's places Frederic Weisbecker
2024-06-25 13:52 ` [RFC PATCH 5/6] sched/isolation: Introduce isolated task work Frederic Weisbecker
2024-06-26 13:27 ` Vlastimil Babka
2024-07-03 12:47 ` Frederic Weisbecker [this message]
2024-06-25 13:52 ` [RFC PATCH 6/6] mm: Drain LRUs upon resume to userspace on nohz_full CPUs Frederic Weisbecker
2024-06-25 14:20 ` Michal Hocko
2024-06-26 13:16 ` Vlastimil Babka
2024-06-27 6:54 ` Michal Hocko
2024-07-03 12:52 ` Frederic Weisbecker
2024-07-04 13:11 ` Michal Hocko
2024-07-17 13:21 ` Frederic Weisbecker
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=ZoVId-DDDVvdmUZX@localhost.localdomain \
--to=frederic@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhocko@kernel.org \
--cc=mingo@redhat.com \
--cc=mtosatti@redhat.com \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=vbabka@suse.cz \
--cc=vschneid@redhat.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