public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Fernand Sieber <sieberf@amazon.com>
To: kernel test robot <oliver.sang@intel.com>
Cc: <oe-lkp@lists.linux.dev>, <lkp@intel.com>,
	<linux-kernel@vger.kernel.org>, <x86@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	<aubrey.li@linux.intel.com>, <yu.c.chen@intel.com>
Subject: Re: [tip:sched/core] [sched/fair] 79104becf4: BUG:kernel_NULL_pointer_dereference,address
Date: Wed, 5 Nov 2025 10:43:33 +0200	[thread overview]
Message-ID: <20251105084335.121098-1-sieberf@amazon.com> (raw)
In-Reply-To: <20251104210456.652800-1-sieberf@amazon.com>

Hi Peter,

I have done more code analysis and I think the following code is a better 
approach to handle proxy tasks:

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 00f9d6c05d4cf..65eb98a779f91 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8983,9 +8983,10 @@ static void put_prev_task_fair(struct rq *rq, struct task_struct *prev, struct t
  */
 static void yield_task_fair(struct rq *rq)
 {
-	struct task_struct *curr = rq->curr;
-	struct cfs_rq *cfs_rq = task_cfs_rq(curr);
-	struct sched_entity *se = &curr->se;
+	struct task_struct *rq_curr = rq->curr;
+	struct cfs_rq *cfs_rq = task_cfs_rq(rq_curr);
+	struct sched_entity *se = &rq_curr->se;
+	bool curr = cfs_rq->curr == se;
 
 	/*
 	 * Are we the only task in the tree?
@@ -9016,8 +9017,12 @@ static void yield_task_fair(struct rq *rq)
 	 * ends up quickly running away.
 	 */
 	if (entity_eligible(cfs_rq, se)) {
+		if (!curr)
+			__dequeue_entity(cfs_rq, se);
 		se->vruntime = se->deadline;
 		se->deadline += calc_delta_fair(se->slice, se);
+		if (!curr)
+			__enqueue_entity(cfs_rq, se);
 		update_min_vruntime(cfs_rq);
 	}
 }

I'll prepare rev4 of the patch accordingly.

--Fernand



Amazon Development Centre (South Africa) (Proprietary) Limited
29 Gogosoa Street, Observatory, Cape Town, Western Cape, 7925, South Africa
Registration Number: 2004 / 034463 / 07


  reply	other threads:[~2025-11-05  8:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-21  5:14 [tip:sched/core] [sched/fair] 79104becf4: BUG:kernel_NULL_pointer_dereference,address kernel test robot
2025-10-21  6:39 ` Chen, Yu C
2025-10-21 11:04 ` Peter Zijlstra
2025-10-27 12:54   ` Peter Zijlstra
2025-10-27 13:14     ` Chen, Yu C
2025-10-27 13:55       ` Peter Zijlstra
2025-10-27 14:07         ` Peter Zijlstra
2025-10-27 14:09           ` Peter Zijlstra
2025-10-28  2:30             ` Chen, Yu C
2025-11-05 11:00               ` Peter Zijlstra
2025-11-05 12:06                 ` Philip Li
2025-11-07 10:16                   ` Philip Li
2025-11-07 10:53                     ` Peter Zijlstra
2025-11-04 21:04 ` Fernand Sieber
2025-11-05  8:43   ` Fernand Sieber [this message]
2025-11-05 11:03   ` Peter Zijlstra
2025-11-05 12:28   ` Peter Zijlstra
2025-11-06 10:54     ` Fernand Sieber
2025-11-06 23:57       ` John Stultz
2025-11-07  8:18         ` Fernand Sieber
  -- strict thread matches above, loose matches on Subject: below --
2025-11-06 10:40 [PATCH] sched: Proxy yields to donor tasks Fernand Sieber
2025-11-06 10:57 ` Peter Zijlstra
2025-11-07  6:54 ` kernel test robot
2025-11-07  8:12   ` Fernand Sieber
2025-11-07  8:25     ` Peter Zijlstra
2025-11-11 11:37 ` [tip: sched/core] sched/proxy: Yield the donor task tip-bot2 for Fernand Sieber

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=20251105084335.121098-1-sieberf@amazon.com \
    --to=sieberf@amazon.com \
    --cc=aubrey.li@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-lkp@lists.linux.dev \
    --cc=oliver.sang@intel.com \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    --cc=yu.c.chen@intel.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