mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ravindran, Binoy" <binoy@vt.edu>
To: Petr Mladek <pmladek@suse.com>, Yafang Shao <laoar.shao@gmail.com>
Cc: "Paul E. McKenney" <paulmck@kernel.org>,
	Frederic Weisbecker <frederic@kernel.org>,
	Neeraj Upadhyay <neeraj.upadhyay@kernel.org>,
	Joel Fernandes <joelagnelf@nvidia.com>,
	Josh Triplett <josh@joshtriplett.org>,
	Boqun Feng <boqun@kernel.org>,
	Uladzislau Rezki <urezki@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Zqiang <qiang.zhang@linux.dev>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Miroslav Benes <mbenes@suse.cz>,
	Joe Lawrence <joe.lawrence@redhat.com>,
	Song Liu <song@kernel.org>, Ingo Molnar <mingo@kernel.org>,
	Jiri Kosina <jikos@kernel.org>,
	"sashiko-reviews@lists.linux.dev"
	<sashiko-reviews@lists.linux.dev>,
	"live-patching@vger.kernel.org" <live-patching@vger.kernel.org>,
	"Shastri, Jaidev" <jaidevshastri@vt.edu>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"rcu@vger.kernel.org" <rcu@vger.kernel.org>
Subject: Re: [PATCH v3 2/3] livepatch: Include exiting tasks in the transition
Date: Fri, 27 Nov 2026 19:13:20 +0000	[thread overview]
Message-ID: <DM6PR05MB413770978C88C4345C856FC4D1412@DM6PR05MB4137.namprd05.prod.outlook.com> (raw)
In-Reply-To: <awmdVLfnwgrS9VfS@pathway.suse.cz>


Hi Petr,

> By other words, the task is removed from the rcu_tasks_exit_list
> in the later 2nd RCU period. So, if synchronize_rcu() is going
> to wait for this 2nd period then it might end prematurely because
> the quiescent state is reported by rcu_note_context_switch()
> early in __schedule().

Yes, that matches my reading.

> But I might miss something. I am not sure which period
> synchronize_rcu() is waiting for.

synchronize_rcu() waits for RCU readers that started before it. Of the
two sections that the comment above rcu_tasks_postscan() describes,
only the second is an RCU reader: the stretch from the final
preempt_disable() in do_exit() to the final schedule().

rcu_note_context_switch() notes the quiescent state early in
__schedule(), before switch_to(). With an expedited grace period in
progress, it also reports it right there, through rcu_report_exp_rdp()
(kernel/rcu/tree_plugin.h). The grace period can then end while the
task still runs traceable code in the rest of __schedule(). RCU does
not need to cover that code, but livepatch does.

klp_synchronize_transition() covers it, because the work item can run
on that CPU only after the task has switched out. It was also cheaper
in my tests. With synchronize_rcu() (v3), the median transition time
went from 8 to 12 ms in the default mode and from 8 ms to 0.8 s with
preempt=full. With klp_synchronize_transition() (v4), the medians were
7 ms and 11 ms.

So v5 keeps klp_synchronize_transition(), with the comment reworded as
you suggested.

Thanks,
Binoy



  reply	other threads:[~2026-11-27 19:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 23:11 [PATCH v3 0/3] livepatch: Do not lose exiting tasks during a transition Binoy Ravindran via B4 Relay
2026-11-25 23:11 ` [PATCH v3 1/3] rcu-tasks: Add helpers to visit tasks on the exit lists Binoy Ravindran via B4 Relay
2026-11-25 23:11 ` [PATCH v3 2/3] livepatch: Include exiting tasks in the transition Binoy Ravindran via B4 Relay
     [not found]   ` <sashiko-outbox-234405@kernel.org>
2026-11-26  0:58     ` Ravindran, Binoy
2026-11-26  3:12       ` Yafang Shao
2026-11-27 14:39         ` Petr Mladek
2026-11-27 15:10           ` Petr Mladek
2026-11-27 19:13             ` Ravindran, Binoy [this message]
2026-11-25 23:11 ` [PATCH v3 3/3] livepatch: Select TASKS_RCU Binoy Ravindran via B4 Relay

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=DM6PR05MB413770978C88C4345C856FC4D1412@DM6PR05MB4137.namprd05.prod.outlook.com \
    --to=binoy@vt.edu \
    --cc=boqun@kernel.org \
    --cc=frederic@kernel.org \
    --cc=jaidevshastri@vt.edu \
    --cc=jiangshanlai@gmail.com \
    --cc=jikos@kernel.org \
    --cc=joe.lawrence@redhat.com \
    --cc=joelagnelf@nvidia.com \
    --cc=josh@joshtriplett.org \
    --cc=jpoimboe@kernel.org \
    --cc=laoar.shao@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mbenes@suse.cz \
    --cc=mingo@kernel.org \
    --cc=neeraj.upadhyay@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=pmladek@suse.com \
    --cc=qiang.zhang@linux.dev \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=song@kernel.org \
    --cc=urezki@gmail.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

all inboxes | Powered by JetHome®