Live Patching
 help / color / mirror / Atom feed
* question re klp_transition_work kickoff timeout
@ 2023-03-22 15:41 Alexey Dobriyan
  2023-03-22 16:07 ` Miroslav Benes
  2023-03-23 16:09 ` Petr Mladek
  0 siblings, 2 replies; 7+ messages in thread
From: Alexey Dobriyan @ 2023-03-22 15:41 UTC (permalink / raw)
  To: Josh Poimboeuf; +Cc: live-patching

Hi, Josh.

I've been profiling how much time livepatching takes and I have a question
regarding these lines:

	void klp_try_complete_transition(void)
	{
		...
		if (!complete) {
			schedule_delayed_work(&klp_transition_work, round_jiffies_relative(HZ));
			return;
		}

	}

The problem here is that if the system is idle, then the previous loop
checking idle tasks will reliably sets "complete = false" and then
patching wastes time waiting for next second so that klp_transition_work
will repeat the same code without reentering itself.

I've created trivial patch which changes 2 functions and it takes
~1.3 seconds to complete transition:

	[   33.829506] livepatch: 'main': starting patching transition
	[   35.190721] livepatch: 'main': patching complete

I don't know what's the correct timeout to retry transition work
but it can be made near-instant:

	[  100.930758] livepatch: 'main': starting patching transition
	[  100.956190] livepatch: 'main': patching complete


	Alexey (CloudLinux)


--- a/kernel/livepatch/transition.c
+++ b/kernel/livepatch/transition.c
@@ -435,8 +435,7 @@ void klp_try_complete_transition(void)
 		 * later and/or wait for other methods like kernel exit
 		 * switching.
 		 */
-		schedule_delayed_work(&klp_transition_work,
-				      round_jiffies_relative(HZ));
+		schedule_delayed_work(&klp_transition_work, msecs_to_jiffies(1));
 		return;
 	}
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-03-23 16:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-22 15:41 question re klp_transition_work kickoff timeout Alexey Dobriyan
2023-03-22 16:07 ` Miroslav Benes
2023-03-23  9:52   ` Alexey Dobriyan
2023-03-23 15:15     ` Miroslav Benes
2023-03-23 16:09 ` Petr Mladek
2023-03-23 16:22   ` Petr Mladek
2023-03-23 16:31     ` Alexey Dobriyan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox