lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250220093257.9380-16-kprateek.nayak@amd.com>
Date: Thu, 20 Feb 2025 09:32:50 +0000
From: K Prateek Nayak <kprateek.nayak@....com>
To: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
	Juri Lelli <juri.lelli@...hat.com>, Vincent Guittot
	<vincent.guittot@...aro.org>, Valentin Schneider <vschneid@...hat.com>, "Ben
 Segall" <bsegall@...gle.com>, Thomas Gleixner <tglx@...utronix.de>, "Andy
 Lutomirski" <luto@...nel.org>, <linux-kernel@...r.kernel.org>
CC: Dietmar Eggemann <dietmar.eggemann@....com>, Steven Rostedt
	<rostedt@...dmis.org>, Mel Gorman <mgorman@...e.de>, "Sebastian Andrzej
 Siewior" <bigeasy@...utronix.de>, Clark Williams <clrkwllms@...nel.org>,
	<linux-rt-devel@...ts.linux.dev>, Tejun Heo <tj@...nel.org>, "Frederic
 Weisbecker" <frederic@...nel.org>, Barret Rhoden <brho@...gle.com>, "Petr
 Mladek" <pmladek@...e.com>, Josh Don <joshdon@...gle.com>, Qais Yousef
	<qyousef@...alina.io>, "Paul E. McKenney" <paulmck@...nel.org>, David Vernet
	<dvernet@...a.com>, K Prateek Nayak <kprateek.nayak@....com>, "Gautham R.
 Shenoy" <gautham.shenoy@....com>, Swapnil Sapkal <swapnil.sapkal@....com>
Subject: [RFC PATCH 15/22] sched/fair: Call resched_curr() from sched_notify_syscall_exit()

With pick_eevdf() marking a pick on throttled hierarchy with
"sched_throttled", reschedule the current when the "kernel_cs_count"
hits 0 if it was picked on a throttled hierarchy.

Signed-off-by: K Prateek Nayak <kprateek.nayak@....com>
---
 kernel/sched/fair.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 68c194169c00..0332e95d36b5 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6839,6 +6839,7 @@ bool cfs_task_bw_constrained(struct task_struct *p)
 
 __always_inline void sched_notify_critical_section_entry(void)
 {
+	SCHED_WARN_ON(current->se.kernel_cs_count);
 	current->se.kernel_cs_count++;
 	/*
 	 * Post this point, the task is considered to be in a kernel
@@ -6848,7 +6849,23 @@ __always_inline void sched_notify_critical_section_entry(void)
 
 __always_inline void sched_notify_critical_section_exit(void)
 {
+	lockdep_assert_irqs_disabled();
+
 	current->se.kernel_cs_count--;
+	SCHED_WARN_ON(current->se.kernel_cs_count);
+
+	/*
+	 * XXX: Can we get away with using set_thread_flag()
+	 * and not grabbing the rq_lock since we'll call
+	 * schedule() soon after enabling interrupts again in
+	 * exit_to_user_mode_loop()?
+	 */
+	if (!current->se.kernel_cs_count && current->se.sched_throttled) {
+		struct rq *rq = this_rq();
+
+		guard(rq_lock_irqsave)(rq);
+		resched_curr(rq);
+	}
 }
 
 static __always_inline int se_in_kernel(struct sched_entity *se)
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ