The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: syzbot <syzbot+2cbf10efc23b22ff9c31@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: [PATCH] sched/fair: Skip newidle balance for remote rqs
Date: Thu, 11 Jun 2026 18:50:28 -0700	[thread overview]
Message-ID: <6a2b65e4.99669fcc.12a77b.0002.GAE@google.com> (raw)
In-Reply-To: <6a289c01.39669fcc.33b062.00a9.GAE@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: [PATCH] sched/fair: Skip newidle balance for remote rqs
Author: jie.wang@intel.com

#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 49e02880ec0a8c378e811bc9d85da188d7c6204c

Commit b3a2dfa8b42e ("sched/fair: Add newidle balance to
pick_task_fair()") added sched_balance_newidle() to pick_task_fair().
With CONFIG_SCHED_CORE, the core-wide selection loop in pick_next_task()
calls pick_task() for each sibling rq. When a sibling has no CFS tasks,
pick_task_fair() enters newidle balancing which drops the shared
core-wide rq lock.

During this window, tasks already selected for earlier siblings can be
migrated away, making core_pick stale. This causes task_rq(p) != rq in
hrtick_start_fair().

Skip newidle balance when called for a remote rq. The sibling will do
its own newidle balance when it schedules itself.

Fixes: b3a2dfa8b42e ("sched/fair: Add newidle balance to pick_task_fair()")
Reported-by: syzbot+2cbf10efc23b22ff9c31@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=2cbf10efc23b22ff9c31
Signed-off-by: Jie Wang <jie.wang@intel.com>
---
 kernel/sched/fair.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 1b23e73f48b0..5beb4e1b480b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9942,6 +9942,13 @@ struct task_struct *pick_task_fair(struct rq *rq, struct rq_flags *rf)
 	return p;
 
 idle:
+	/*
+	 * Skip newidle balance for remote rqs -- doing so would drop the
+	 * core-wide rq lock, invalidating already-selected core_picks.
+	 */
+	if (rq != this_rq())
+		return NULL;
+
 	new_tasks = sched_balance_newidle(rq, rf);
 	if (new_tasks < 0)
 		return RETRY_TASK;
-- 
2.43.0

      parent reply	other threads:[~2026-06-12  1:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09 23:04 [syzbot] [cgroups?] [mm?] WARNING in hrtick_start_fair syzbot
2026-06-11  7:56 ` Forwarded: [PATCH] sched/fair: Skip newidle balance for remote rqs syzbot
2026-06-12  1:50 ` syzbot [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=6a2b65e4.99669fcc.12a77b.0002.GAE@google.com \
    --to=syzbot+2cbf10efc23b22ff9c31@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzkaller-bugs@googlegroups.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