From: Shubhang Kaushik <shubhang@os.amperecomputing.com>
To: K Prateek Nayak <kprateek.nayak@amd.com>,
Peter Zijlstra <peterz@infradead.org>,
mingo@kernel.org
Cc: juri.lelli@redhat.com, vincent.guittot@linaro.org,
dietmar.eggemann@arm.com, rostedt@goodmis.org,
bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
linux-kernel@vger.kernel.org, wangtao554@huawei.com,
quzicheng@huawei.com, wuyun.abel@bytedance.com,
dsmythies@telus.net
Subject: Re: [PATCH 0/4] sched: Various reweight_entity() fixes
Date: Tue, 17 Feb 2026 14:02:13 -0800 (PST) [thread overview]
Message-ID: <0ecb52db-eff3-5a82-3621-e6a3a033f109@os.amperecomputing.com> (raw)
In-Reply-To: <3eefd122-22e5-4ac1-bcaf-fd7016c77bf2@amd.com>
[-- Attachment #1: Type: text/plain, Size: 2988 bytes --]
Hi Prateek,
On Mon, 16 Feb 2026, K Prateek Nayak wrote:
> Hello Shubhang,
>
> On 2/14/2026 12:50 PM, Shubhang Kaushik wrote:
>> Hi Peter,
>>
>> On Fri, 30 Jan 2026, Peter Zijlstra wrote:
>>
>>> Two issues related to reweight_entity() were raised; poking at all that got me
>>> these patches.
>>>
>>> They're in queue.git/sched/core and I spend most of yesterday staring at traces
>>> trying to find anything wrong. So far, so good.
>>>
>>> Please test.
>>>
>>>
>>
>> I’m seeing a consistent NULL pointer dereference in pick_task_fair() when running hackbench on an Ampere Altra (80 cores arm64). This is happening after applying the complete patchset on the latest 6.19.0+ kernel with PREEMPT_DYNAMIC (full), CONFIG_SCHED_CLUSTER and NOHZ_FULL enabled.
>
> Can you confirm you using the latest changes from:
>
> git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git sched/core
>
> at commit bdba3187771c ("sched/fair: Use full weight to __calc_delta()")
> since this series has undergone some churn throughout the week?
>
Okay. I was not using commit bdba3187771c in my first test. After
updating to that commit on sched/core, the issue is resolved on my
machine.
>>
>> The system triggers a level 2 translation fault because pick_eevdf() returns NULL despite the runqueue having active tasks (cfs_rq->nr_running
>>> 0). When pick_next_task_fair() attempts to dereference this NULL pointer
>> to access the task structure, the kernel Oopses at pick_task_fair+0x48/0x148.
>>
>> pick_task_fair <- pick_eevdf() <- [active tasks]
>>
>> The root cause is an underflow in reweight_entity():
>> se->vprot -= avruntime;
>
> But how does it cause failure to pick? All vrpot does at pick is:
>
> /* curr needs to be queued and eligible first. */
> if (curr && (!curr->on_rq || !entity_eligible(cfs_rq, curr)))
> curr = NULL;
>
Because of the precision drift, the min_vruntime jumps ahead of the
actual task runtime. This made the task look ineligible, so curr was
being set to NULL.
> /* vprot only helps for early return below. */
> if (curr && protect && protect_slice(curr))
> return curr;
>
Since curr was already NULL from the step above, the code skipped this
protection check entirely. It then tried to search the rest of the tree
for a new task. But again, as the math was broken it found nothing and
returned NULL. That’s why the kernel crashed.
>
> Worst case "curr" runs till it loses eligibility even if vprot wraps
> and becomes a large value and moreover, wouldn't vruntime_cmp() in
> protect_slice() which compares the signed difference catch it?
>
> --
> Thanks and Regards,
> Prateek
>
>
The vruntime_cmp() should the handle the math, but the drift made
the comparison logic invalid. The rounding errors in set_protect_slice()
caused vprot and vruntime to be out of sync, breaking the eligibility
invariants.
Commit bdba3187771c restores the symmetry using 64-bit math which
prevents the NULL return.
Regards,
Shubhang Kaushik
next prev parent reply other threads:[~2026-02-17 22:02 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-30 9:34 Peter Zijlstra
2026-01-30 9:34 ` [PATCH 1/4] sched/fair: Only set slice protection at pick time Peter Zijlstra
2026-01-30 15:52 ` Vincent Guittot
2026-01-30 9:34 ` [PATCH 2/4] sched/eevdf: Update se->vprot in reweight_entity() Peter Zijlstra
2026-01-30 16:20 ` Vincent Guittot
2026-01-30 9:34 ` [PATCH 3/4] sched/fair: Increase weight bits for avg_vruntime Peter Zijlstra
2026-01-30 9:34 ` [PATCH 4/4] sched/fair: Revert 6d71a9c61604 ("sched/fair: Fix EEVDF entity placement bug causing scheduling lag") Peter Zijlstra
2026-01-31 1:47 ` Zhang Qiao
2026-01-31 15:21 ` Peter Zijlstra
2026-02-02 9:12 ` Peter Zijlstra
2026-02-02 9:24 ` Peter Zijlstra
2026-02-02 11:23 ` Zhang Qiao
2026-02-01 17:13 ` [PATCH 0/4] sched: Various reweight_entity() fixes Doug Smythies
2026-02-03 6:45 ` K Prateek Nayak
2026-02-03 11:11 ` Peter Zijlstra
2026-02-03 12:19 ` K Prateek Nayak
2026-02-03 16:36 ` Doug Smythies
2026-02-10 18:13 ` Peter Zijlstra
2026-02-11 5:51 ` Doug Smythies
2026-02-04 10:15 ` K Prateek Nayak
2026-02-09 15:47 ` Peter Zijlstra
2026-02-09 16:52 ` K Prateek Nayak
2026-02-10 5:16 ` K Prateek Nayak
2026-02-10 10:29 ` Peter Zijlstra
2026-02-10 15:41 ` Doug Smythies
2026-02-10 18:09 ` K Prateek Nayak
2026-02-10 18:35 ` Peter Zijlstra
2026-02-10 20:04 ` K Prateek Nayak
2026-02-11 6:28 ` K Prateek Nayak
2026-02-11 8:50 ` K Prateek Nayak
2026-02-11 23:09 ` Doug Smythies
2026-02-10 18:52 ` Peter Zijlstra
2026-02-10 20:52 ` Vincent Guittot
2026-02-11 5:21 ` Doug Smythies
2026-02-11 8:49 ` Vincent Guittot
2026-02-11 9:01 ` Peter Zijlstra
2026-02-11 10:48 ` Peter Zijlstra
2026-02-11 10:49 ` Peter Zijlstra
2026-02-11 11:15 ` Vincent Guittot
2026-02-11 16:28 ` Peter Zijlstra
2026-02-12 7:43 ` K Prateek Nayak
2026-02-12 11:59 ` Peter Zijlstra
2026-02-12 17:16 ` Peter Zijlstra
2026-02-12 17:24 ` Vincent Guittot
2026-02-12 19:31 ` Peter Zijlstra
2026-02-13 5:22 ` K Prateek Nayak
2026-02-13 6:44 ` Peter Zijlstra
2026-02-13 10:50 ` Peter Zijlstra
2026-02-13 14:29 ` K Prateek Nayak
2026-02-14 6:31 ` Doug Smythies
2026-02-21 22:51 ` Doug Smythies
2026-02-12 19:29 ` Peter Zijlstra
2026-02-12 19:37 ` Doug Smythies
2026-02-13 6:04 ` K Prateek Nayak
2026-02-11 16:21 ` Peter Zijlstra
2026-02-12 5:54 ` Doug Smythies
2026-02-12 7:51 ` Peter Zijlstra
2026-02-12 15:47 ` Doug Smythies
2026-02-12 7:46 ` Peter Zijlstra
2026-02-11 23:25 ` Doug Smythies
2026-02-11 8:48 ` Peter Zijlstra
2026-02-04 10:44 ` Peter Zijlstra
2026-02-14 7:20 ` Shubhang Kaushik
2026-02-16 3:14 ` K Prateek Nayak
2026-02-16 10:59 ` Dietmar Eggemann
2026-02-17 14:37 ` Dietmar Eggemann
2026-02-17 22:02 ` Shubhang Kaushik [this message]
2026-02-17 4:20 ` K Prateek Nayak
2026-02-18 18:37 ` Shubhang Kaushik
2026-02-19 7:53 ` Peter Zijlstra
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=0ecb52db-eff3-5a82-3621-e6a3a033f109@os.amperecomputing.com \
--to=shubhang@os.amperecomputing.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=dsmythies@telus.net \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=quzicheng@huawei.com \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=wangtao554@huawei.com \
--cc=wuyun.abel@bytedance.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
Powered by JetHome