public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea Righi <righi.andrea@gmail.com>
To: Tejun Heo <tj@kernel.org>
Cc: void@manifault.com, linux-kernel@vger.kernel.org,
	kernel-team@meta.com, schatzberg.dan@gmail.com, mingo@redhat.com,
	peterz@infradead.org, changwoo@igalia.com
Subject: Re: [PATCH 2/6] sched_ext: Open-code task_linked_on_dsq()
Date: Wed, 10 Jul 2024 10:56:31 +0200	[thread overview]
Message-ID: <Zo5Mv4aIe2wDSHyJ@gpd> (raw)
In-Reply-To: <20240709212137.1199269-3-tj@kernel.org>

On Tue, Jul 09, 2024 at 11:21:08AM -1000, Tejun Heo wrote:
> task_linked_on_dsq() exists as a helper becauase it used to test both the

small nit: becauase -> because.

> rbtree and list nodes. It now only tests the list node and the list node
> will soon be used for something else too. The helper doesn't improve
> anything materially and the naming will become confusing. Open-code the list
> node testing and remove task_linked_on_dsq()
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: David Vernet <void@manifault.com>
> ---
>  kernel/sched/ext.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
> index f16d72d72635..52340ac8038f 100644
> --- a/kernel/sched/ext.c
> +++ b/kernel/sched/ext.c
> @@ -1572,18 +1572,13 @@ static void task_unlink_from_dsq(struct task_struct *p,
>  	list_del_init(&p->scx.dsq_list.node);
>  }
>  
> -static bool task_linked_on_dsq(struct task_struct *p)
> -{
> -	return !list_empty(&p->scx.dsq_list.node);
> -}
> -
>  static void dispatch_dequeue(struct rq *rq, struct task_struct *p)
>  {
>  	struct scx_dispatch_q *dsq = p->scx.dsq;
>  	bool is_local = dsq == &rq->scx.local_dsq;
>  
>  	if (!dsq) {
> -		WARN_ON_ONCE(task_linked_on_dsq(p));
> +		WARN_ON_ONCE(!list_empty(&p->scx.dsq_list.node));
>  		/*
>  		 * When dispatching directly from the BPF scheduler to a local
>  		 * DSQ, the task isn't associated with any DSQ but
> @@ -1604,7 +1599,7 @@ static void dispatch_dequeue(struct rq *rq, struct task_struct *p)
>  	*/
>  	if (p->scx.holding_cpu < 0) {
>  		/* @p must still be on @dsq, dequeue */
> -		WARN_ON_ONCE(!task_linked_on_dsq(p));
> +		WARN_ON_ONCE(list_empty(&p->scx.dsq_list.node));
>  		task_unlink_from_dsq(p, dsq);
>  		dsq_mod_nr(dsq, -1);
>  	} else {
> @@ -1614,7 +1609,7 @@ static void dispatch_dequeue(struct rq *rq, struct task_struct *p)
>  		 * holding_cpu which tells dispatch_to_local_dsq() that it lost
>  		 * the race.
>  		 */
> -		WARN_ON_ONCE(task_linked_on_dsq(p));
> +		WARN_ON_ONCE(!list_empty(&p->scx.dsq_list.node));
>  		p->scx.holding_cpu = -1;
>  	}
>  	p->scx.dsq = NULL;
> -- 
> 2.45.2

  reply	other threads:[~2024-07-10  8:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-09 21:21 [PATCHSET sched_ext/for-6.11] sched_ext: Allow SCX_DSQ_LOCAL_ON for direct dispatches Tejun Heo
2024-07-09 21:21 ` [PATCH 1/6] sched: Move struct balance_callback definition upward Tejun Heo
2024-07-10 18:53   ` David Vernet
2024-07-09 21:21 ` [PATCH 2/6] sched_ext: Open-code task_linked_on_dsq() Tejun Heo
2024-07-10  8:56   ` Andrea Righi [this message]
2024-07-10 18:53   ` David Vernet
2024-07-09 21:21 ` [PATCH 3/6] sched_ext: Make @rf optional for dispatch_to_local_dsq() Tejun Heo
2024-07-10  8:59   ` Andrea Righi
2024-07-10 11:41     ` Peter Zijlstra
2024-07-10 16:39       ` Tejun Heo
2024-07-10 16:10   ` David Vernet
2024-07-10 16:46     ` Tejun Heo
2024-07-09 21:21 ` [PATCH 4/6] sched_ext: s/SCX_RQ_BALANCING/SCX_RQ_IN_BALANCE/ and add SCX_RQ_IN_WAKEUP Tejun Heo
2024-07-10 18:54   ` David Vernet
2024-07-09 21:21 ` [PATCH 5/6] sched_ext: Allow SCX_DSQ_LOCAL_ON for direct dispatches Tejun Heo
2024-07-10 18:51   ` David Vernet
2024-07-10 23:43     ` Tejun Heo
2024-07-09 21:21 ` [PATCH 6/6] sched_ext/scx_qmap: Pick idle CPU for direct dispatch on !wakeup enqueues Tejun Heo
2024-07-10 19:25   ` David Vernet
2024-07-11  0:05     ` Tejun Heo
2024-07-10  9:01 ` [PATCHSET sched_ext/for-6.11] sched_ext: Allow SCX_DSQ_LOCAL_ON for direct dispatches Andrea Righi
  -- strict thread matches above, loose matches on Subject: below --
2024-07-11  1:13 [PATCHSET v2 " Tejun Heo
2024-07-11  1:13 ` [PATCH 2/6] sched_ext: Open-code task_linked_on_dsq() 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=Zo5Mv4aIe2wDSHyJ@gpd \
    --to=righi.andrea@gmail.com \
    --cc=changwoo@igalia.com \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=schatzberg.dan@gmail.com \
    --cc=tj@kernel.org \
    --cc=void@manifault.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