public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kexec: yield to scheduler when loading kimage segments
@ 2018-06-11 17:35 Jarrett Farnitano
  2018-06-11 22:59 ` Eric W. Biederman
  2018-06-12  0:45 ` Eric W. Biederman
  0 siblings, 2 replies; 5+ messages in thread
From: Jarrett Farnitano @ 2018-06-11 17:35 UTC (permalink / raw)
  To: Eric Biederman; +Cc: kexec, linux-kernel, Jarrett Farnitano

Without yielding while loading kimage segments, a large initrd
will block all other work on the CPU performing the load until
it is completed. For example loading an initrd of 200MB on a
low power single core system will lock up the system for a few
seconds.

To increase system responsiveness to other tasks at that time,
call cond_resched() in both the crash kernel and normal kernel
segment loading loops.

Signed-off-by: Jarrett Farnitano <jmf@amazon.com>
---
 kernel/kexec_core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 5616755..8ee07d6 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -783,6 +783,8 @@ static int kimage_load_normal_segment(struct kimage *image,
 		else
 			buf += mchunk;
 		mbytes -= mchunk;
+
+		cond_resched();
 	}
 out:
 	return result;
@@ -847,6 +849,8 @@ static int kimage_load_crash_segment(struct kimage *image,
 		else
 			buf += mchunk;
 		mbytes -= mchunk;
+
+		cond_resched();
 	}
 out:
 	return result;
-- 
2.7.4


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

end of thread, other threads:[~2018-06-12  0:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-11 17:35 [PATCH] kexec: yield to scheduler when loading kimage segments Jarrett Farnitano
2018-06-11 22:59 ` Eric W. Biederman
2018-06-11 23:47   ` Farnitano, Jarrett
2018-06-12  0:45     ` Eric W. Biederman
2018-06-12  0:45 ` Eric W. Biederman

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