[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YnkuFrm1YR46OFx/@alley>
Date: Mon, 9 May 2022 17:07:02 +0200
From: Petr Mladek <pmladek@...e.com>
To: Song Liu <song@...nel.org>
Cc: linux-kernel@...r.kernel.org, live-patching@...r.kernel.org,
mingo@...hat.com, peterz@...radead.org, vincent.guittot@...aro.org,
jpoimboe@...hat.com, joe.lawrence@...hat.com, kernel-team@...com
Subject: Re: [RFC] sched,livepatch: call klp_try_switch_task in __cond_resched
On Sat 2022-05-07 10:46:28, Song Liu wrote:
> Busy kernel threads may block the transition of livepatch. Call
> klp_try_switch_task from __cond_resched to make the transition easier.
Do you have some numbers how this speeds up the transition
and how it slows down the scheduler, please?
cond_resched() is typically called in cycles with many interactions
where the task might spend a lot of time. There are two possibilities.
cond_resched() is called in:
+ livepatched function
In this case, klp_try_switch_task(current) will always fail.
And it will non-necessarily slow down every iteration by
checking the very same stack.
+ non-livepatched function
In this case, the transition will succeed on the first attempt.
OK, but it would succeed also without that patch. The task would
most likely sleep in this cond_resched() so that it might
be successfully transitioned on the next occasion.
>From my POV this patch this patch brings more harm than good.
Note that scheduling is a fast path. It is repeated zillion-times
on any system. But livepatch transition is a slow path. It does not
matter if it takes 1 second or 1 hour.
Best Regards,
Petr
Powered by blists - more mailing lists