From: Pingfan Liu <piliu@redhat.com>
To: kexec@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: Pingfan Liu <piliu@redhat.com>, Waiman Long <longman@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Pierre Gondois <pierre.gondois@arm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Baoquan He <bhe@redhat.com>, Ingo Molnar <mingo@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Valentin Schneider <vschneid@redhat.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Joel Granados <joel.granados@kernel.org>
Subject: [RFC 3/3] kexec_core: Promote the kexec to DL task
Date: Wed, 22 Oct 2025 20:13:45 +0800 [thread overview]
Message-ID: <20251022121345.23496-4-piliu@redhat.com> (raw)
In-Reply-To: <20251022121345.23496-1-piliu@redhat.com>
The previous patch lifted the deadline bandwidth check during the kexec
process. As a result, DL tasks may be crowded onto the kexec CPU, which
may starve the kexec task. At this point, the kexec task is the only
task needed to make the reboot proceed, hence promoting it to a deadline
task prevents this starvation.
Signed-off-by: Pingfan Liu <piliu@redhat.com>
Cc: Waiman Long <longman@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Pierre Gondois <pierre.gondois@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Baoquan He <bhe@redhat.com>
To: kexec@lists.infradead.org
To: linux-kernel@vger.kernel.org
---
kernel/kexec_core.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 265de9d1ff5f5..0960bea1a8bab 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -41,6 +41,7 @@
#include <linux/objtool.h>
#include <linux/kmsg_dump.h>
#include <linux/dma-map-ops.h>
+#include <uapi/linux/sched/types.h>
#include <asm/page.h>
#include <asm/sections.h>
@@ -1183,6 +1184,20 @@ int kernel_kexec(void)
} else
#endif
{
+ struct sched_attr attr = {
+ .size = sizeof(struct sched_attr),
+ .sched_policy = SCHED_DEADLINE,
+ .sched_nice = 0,
+ .sched_priority = 0,
+ /*
+ * Fake (unused) bandwidth; workaround to "fix"
+ * priority inheritance.
+ */
+ .sched_runtime = NSEC_PER_MSEC,
+ .sched_deadline = 10 * NSEC_PER_MSEC,
+ .sched_period = 10 * NSEC_PER_MSEC,
+ };
+
/*
* CPU hot-removal path refers to kexec_in_progress, it
* requires a sync to ensure no in-flight hot-removing.
@@ -1202,6 +1217,13 @@ int kernel_kexec(void)
*/
cpu_hotplug_enable();
pr_notice("Starting new kernel\n");
+ /*
+ * During hot-removing cpu, all DL tasks will be migrated to
+ * this cpu. To prevent this task from starving, promoting it
+ * to DL task. And soon, local interrupt will be disabled in
+ * machine_kexec().
+ */
+ sched_setattr_nocheck(current, &attr);
machine_shutdown();
}
--
2.49.0
prev parent reply other threads:[~2025-10-22 12:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-22 12:13 [RFC 0/3] kexec: Force kexec to proceed under heavy deadline load Pingfan Liu
2025-10-22 12:13 ` [RFC 1/3] sched/deadline: Skip the deadline bandwidth check if kexec_in_progress Pingfan Liu
2025-10-22 12:13 ` [RFC 2/3] kernel/cpu: Mark nonboot cpus as inactive when shutting down nonboot cpus Pingfan Liu
2025-10-27 17:06 ` Thomas Gleixner
2025-10-28 2:51 ` Pingfan Liu
2025-10-28 12:59 ` Thomas Gleixner
2025-10-29 11:36 ` Pingfan Liu
2025-10-29 12:13 ` Thomas Gleixner
2025-10-29 13:39 ` Pingfan Liu
2025-10-22 12:13 ` Pingfan Liu [this message]
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=20251022121345.23496-4-piliu@redhat.com \
--to=piliu@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bhe@redhat.com \
--cc=dietmar.eggemann@arm.com \
--cc=joel.granados@kernel.org \
--cc=juri.lelli@redhat.com \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=pierre.gondois@arm.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.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®