mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Loehle <christian.loehle@arm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: mingo@kernel.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	vschneid@redhat.com, tj@kernel.org, void@manifault.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/6] sched/ext: Fix scx vs sched_delayed
Date: Wed, 30 Oct 2024 17:17:43 +0000	[thread overview]
Message-ID: <7e4ebd21-3144-4a1a-a736-d9abef21bd4b@arm.com> (raw)
In-Reply-To: <20241030155403.GO14555@noisy.programming.kicks-ass.net>

On 10/30/24 15:54, Peter Zijlstra wrote:
> On Wed, Oct 30, 2024 at 03:50:05PM +0000, Christian Loehle wrote:
>> On 10/30/24 15:12, Peter Zijlstra wrote:
>>> Commit 98442f0ccd82 ("sched: Fix delayed_dequeue vs
>>> switched_from_fair()") forgot about scx :/
>>>
>>> Fixes: 98442f0ccd82 ("sched: Fix delayed_dequeue vs switched_from_fair()")
>>> Reported-by: Tejun Heo <tj@kernel.org>
>>> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
>>> Link: https://lkml.kernel.org/r/20241030104934.GK14555@noisy.programming.kicks-ass.net
>>> ---
>>>  kernel/sched/ext.c |   14 ++++++++++++--
>>>  1 file changed, 12 insertions(+), 2 deletions(-)
>>>
>>> --- a/kernel/sched/ext.c
>>> +++ b/kernel/sched/ext.c
>>> @@ -4489,11 +4489,16 @@ static void scx_ops_disable_workfn(struc
>>>  	scx_task_iter_start(&sti);
>>>  	while ((p = scx_task_iter_next_locked(&sti))) {
>>>  		const struct sched_class *old_class = p->sched_class;
>>> +		const struct sched_class *new_class =
>>> +			__setscheduler_class(p->policy, p->prio);
>>>  		struct sched_enq_and_set_ctx ctx;
>>>  
>>> +		if (old_class != new_class && p->se.sched_delayed)
>>> +			dequeue_task(task_rq(p), p, DEQUEUE_SLEEP | DEQUEUE_DELAYED);
>>> +
>>>  		sched_deq_and_put_task(p, DEQUEUE_SAVE | DEQUEUE_MOVE, &ctx);
>>>  
>>> -		p->sched_class = __setscheduler_class(p->policy, p->prio);
>>> +		p->sched_class = new_class;
>>>  		check_class_changing(task_rq(p), p, old_class);
>>>  
>>>  		sched_enq_and_set_task(&ctx);
>>> @@ -5199,12 +5204,17 @@ static int scx_ops_enable(struct sched_e
>>>  	scx_task_iter_start(&sti);
>>>  	while ((p = scx_task_iter_next_locked(&sti))) {
>>>  		const struct sched_class *old_class = p->sched_class;
>>> +		const struct sched_class *new_class =
>>> +			__setscheduler_class(p->policy, p->prio);
>>>  		struct sched_enq_and_set_ctx ctx;
>>>  
>>> +		if (old_class != new_class && p->se.sched_delayed)
>>> +			dequeue_task(task_rq(p), p, DEQUEUE_SLEEP | DEQUEE_DELAYED);
>>> +
>>
>> s/DEQUEE_DELAYED/DEQUEUE_DELAYED
> 
> Bah, typing so hard..
> 
>> Anyway, no luck for me applying the series onto sched/core scx's for-next or rc5.
>> Any hint or do you mind supplying a branch?
> 
> I think I did it on top of tip/master..

0b9c113ad1c2 (tip/master) Merge branch into tip/master: 'x86/sev'
results in the following diff for me (line number mismatch by 5), stops applying from 2/6:
-- 

diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 65334c13ffa5..2b5f1742299a 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -4494,11 +4494,16 @@ static void scx_ops_disable_workfn(struct kthread_work *work)
        scx_task_iter_start(&sti);
        while ((p = scx_task_iter_next_locked(&sti))) {
                const struct sched_class *old_class = p->sched_class;
+               const struct sched_class *new_class =
+                       __setscheduler_class(p->policy, p->prio);
                struct sched_enq_and_set_ctx ctx;
 
+               if (old_class != new_class && p->se.sched_delayed)
+                       dequeue_task(task_rq(p), p, DEQUEUE_SLEEP | DEQUEUE_DELAYED);
+
                sched_deq_and_put_task(p, DEQUEUE_SAVE | DEQUEUE_MOVE, &ctx);
 
-               p->sched_class = __setscheduler_class(p->policy, p->prio);
+               p->sched_class = new_class;
                check_class_changing(task_rq(p), p, old_class);
 
                sched_enq_and_set_task(&ctx);

  reply	other threads:[~2024-10-30 17:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-30 15:12 [RFC][PATCH 0/6] clean up class switching Peter Zijlstra
2024-10-30 15:12 ` [PATCH 1/6] sched/ext: Fix scx vs sched_delayed Peter Zijlstra
2024-10-30 15:50   ` Christian Loehle
2024-10-30 15:54     ` Peter Zijlstra
2024-10-30 17:17       ` Christian Loehle [this message]
2024-10-30 20:19   ` Tejun Heo
2024-10-30 15:12 ` [RFC][PATCH 2/6] sched: Employ sched_change guards Peter Zijlstra
2024-10-30 20:58   ` Tejun Heo
2024-10-30 21:09     ` Tejun Heo
2024-10-30 21:11       ` Peter Zijlstra
2024-10-30 15:12 ` [RFC][PATCH 3/6] sched: Re-arrange the {EN,DE}QUEUE flags Peter Zijlstra
2024-10-30 15:12 ` [RFC][PATCH 4/6] sched: Fold sched_class::switch{ing,ed}_{to,from}() into the change pattern Peter Zijlstra
2024-10-30 21:12   ` Tejun Heo
2024-10-30 21:15     ` Peter Zijlstra
2024-10-30 21:29       ` Tejun Heo
2024-10-30 21:37         ` Peter Zijlstra
2024-10-30 21:39           ` Tejun Heo
2024-10-30 15:13 ` [RFC][PATCH 5/6] sched: Add flags to the switch{ing,ed}_{to,from}() methods Peter Zijlstra
2024-10-30 15:13 ` [RFC][PATCH 6/6] sched: Cleanup sched_delayed handling for class switches Peter Zijlstra
2024-10-30 15:45   ` Peter Zijlstra
2024-10-30 21:27     ` Tejun Heo

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=7e4ebd21-3144-4a1a-a736-d9abef21bd4b@arm.com \
    --to=christian.loehle@arm.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tj@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=void@manifault.com \
    --cc=vschneid@redhat.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

all inboxes | Powered by JetHome®