linux-next: manual merge of the tip tree with Linus' tree

Stephen Rothwell posted 1 patch 3 months, 1 week ago
linux-next: manual merge of the tip tree with Linus' tree
Posted by Stephen Rothwell 3 months, 1 week ago
Hi all,

Today's linux-next merge of the tip tree got a conflict in:

  kernel/sched/ext.c

between commit:

  a8ad873113d3 ("sched_ext: defer queue_balance_callback() until after ops.dispatch")

from Linus' tree and commit:

  4c95380701f5 ("sched/ext: Fold balance_scx() into pick_task_scx()")

from the tip tree.

I fixed it up (see below - but I was not sure if the
"maybe_queue_balance_callback(rq);" is positioned correctly) and can
carry the fix as necessary. This is now fixed as far as linux-next is
concerned, but any non trivial conflicts should be mentioned to your
upstream maintainer when your tree is submitted for merging.  You may
also want to consider cooperating with the maintainer of the conflicting
tree to minimise any particularly complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc kernel/sched/ext.c
index ecb251e883ea,49f4a9e76348..000000000000
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@@ -2368,41 -2298,22 +2332,23 @@@ static struct task_struct *first_local_
  					struct task_struct, scx.dsq_list.node);
  }
  
- static struct task_struct *pick_task_scx(struct rq *rq)
+ static struct task_struct *pick_task_scx(struct rq *rq, struct rq_flags *rf)
  {
  	struct task_struct *prev = rq->curr;
+ 	bool keep_prev, kick_idle = false;
  	struct task_struct *p;
- 	bool keep_prev = rq->scx.flags & SCX_RQ_BAL_KEEP;
- 	bool kick_idle = false;
  
- 	/*
- 	 * WORKAROUND:
- 	 *
- 	 * %SCX_RQ_BAL_KEEP should be set iff $prev is on SCX as it must just
- 	 * have gone through balance_scx(). Unfortunately, there currently is a
- 	 * bug where fair could say yes on balance() but no on pick_task(),
- 	 * which then ends up calling pick_task_scx() without preceding
- 	 * balance_scx().
- 	 *
- 	 * Keep running @prev if possible and avoid stalling from entering idle
- 	 * without balancing.
- 	 *
- 	 * Once fair is fixed, remove the workaround and trigger WARN_ON_ONCE()
- 	 * if pick_task_scx() is called without preceding balance_scx().
- 	 */
- 	if (unlikely(rq->scx.flags & SCX_RQ_BAL_PENDING)) {
- 		if (prev->scx.flags & SCX_TASK_QUEUED) {
- 			keep_prev = true;
- 		} else {
- 			keep_prev = false;
- 			kick_idle = true;
- 		}
- 	} else if (unlikely(keep_prev &&
- 			    prev->sched_class != &ext_sched_class)) {
- 		/*
- 		 * Can happen while enabling as SCX_RQ_BAL_PENDING assertion is
- 		 * conditional on scx_enabled() and may have been skipped.
- 		 */
+ 	rq_modified_clear(rq);
+ 	rq_unpin_lock(rq, rf);
+ 	balance_one(rq, prev);
+ 	rq_repin_lock(rq, rf);
++	maybe_queue_balance_callback(rq);
+ 	if (rq_modified_above(rq, &ext_sched_class))
+ 		return RETRY_TASK;
+ 
+ 	keep_prev = rq->scx.flags & SCX_RQ_BAL_KEEP;
+ 	if (unlikely(keep_prev &&
+ 		     prev->sched_class != &ext_sched_class)) {
  		WARN_ON_ONCE(scx_enable_state() == SCX_ENABLED);
  		keep_prev = false;
  	}
Re: linux-next: manual merge of the tip tree with Linus' tree
Posted by Tejun Heo 3 months, 1 week ago
On Tue, Oct 28, 2025 at 11:22:05AM +1100, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the tip tree got a conflict in:
> 
>   kernel/sched/ext.c
> 
> between commit:
> 
>   a8ad873113d3 ("sched_ext: defer queue_balance_callback() until after ops.dispatch")
> 
> from Linus' tree and commit:
> 
>   4c95380701f5 ("sched/ext: Fold balance_scx() into pick_task_scx()")
> 
> from the tip tree.
> 
> I fixed it up (see below - but I was not sure if the
> "maybe_queue_balance_callback(rq);" is positioned correctly) and can
> carry the fix as necessary. This is now fixed as far as linux-next is
> concerned, but any non trivial conflicts should be mentioned to your
> upstream maintainer when your tree is submitted for merging.  You may
> also want to consider cooperating with the maintainer of the conflicting
> tree to minimise any particularly complex conflicts.

I resolved this in sched_ext/for-6.19 by pulling for-6.18-fixes but yeah the
conflict is through tip/sched/core. I think your resolution is correct and
matches sched_ext/for-6.19 (sans whitespaces).

I don't know how tip tree resolves these conflicts but either way - leaving
it as-is until the merge window, or pulling master and resolving in tip - is
fine from sched_ext POV. I can sync with tip/sched/core as necessary.

Thanks.

-- 
tejun
Re: linux-next: manual merge of the tip tree with Linus' tree
Posted by Peter Zijlstra 3 months, 1 week ago
On Mon, Oct 27, 2025 at 03:10:43PM -1000, Tejun Heo wrote:
> On Tue, Oct 28, 2025 at 11:22:05AM +1100, Stephen Rothwell wrote:
> > Hi all,
> > 
> > Today's linux-next merge of the tip tree got a conflict in:
> > 
> >   kernel/sched/ext.c
> > 
> > between commit:
> > 
> >   a8ad873113d3 ("sched_ext: defer queue_balance_callback() until after ops.dispatch")
> > 
> > from Linus' tree and commit:
> > 
> >   4c95380701f5 ("sched/ext: Fold balance_scx() into pick_task_scx()")
> > 
> > from the tip tree.
> > 
> > I fixed it up (see below - but I was not sure if the
> > "maybe_queue_balance_callback(rq);" is positioned correctly) and can
> > carry the fix as necessary. This is now fixed as far as linux-next is
> > concerned, but any non trivial conflicts should be mentioned to your
> > upstream maintainer when your tree is submitted for merging.  You may
> > also want to consider cooperating with the maintainer of the conflicting
> > tree to minimise any particularly complex conflicts.
> 
> I resolved this in sched_ext/for-6.19 by pulling for-6.18-fixes but yeah the
> conflict is through tip/sched/core. I think your resolution is correct and
> matches sched_ext/for-6.19 (sans whitespaces).
> 
> I don't know how tip tree resolves these conflicts but either way - leaving
> it as-is until the merge window, or pulling master and resolving in tip - is
> fine from sched_ext POV. I can sync with tip/sched/core as necessary.

tip/sched/core should now have that merge resolved properly too.

Thanks!