public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jarrett Farnitano <jmf@amazon.com>
To: Eric Biederman <ebiederm@xmission.com>
Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
	Jarrett Farnitano <jmf@amazon.com>
Subject: [PATCH] kexec: yield to scheduler when loading kimage segments
Date: Mon, 11 Jun 2018 10:35:46 -0700	[thread overview]
Message-ID: <1528738546-3328-1-git-send-email-jmf@amazon.com> (raw)

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


             reply	other threads:[~2018-06-11 17:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-11 17:35 Jarrett Farnitano [this message]
2018-06-11 22:59 ` [PATCH] kexec: yield to scheduler when loading kimage segments 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

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=1528738546-3328-1-git-send-email-jmf@amazon.com \
    --to=jmf@amazon.com \
    --cc=ebiederm@xmission.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /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