[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aJp-2TPbNKO3k_lq@slm.duckdns.org>
Date: Mon, 11 Aug 2025 13:38:01 -1000
From: Tejun Heo <tj@...nel.org>
To: Christian Loehle <christian.loehle@....com>
Cc: arighi@...dia.com, void@...ifault.com, linux-kernel@...r.kernel.org,
sched-ext@...ts.linux.dev, changwoo@...lia.com, hodgesd@...a.com,
mingo@...hat.com, peterz@...radead.org, jake@...lion.co.uk
Subject: Re: [PATCH v4 1/3] sched_ext: Introduce scx_bpf_cpu_rq_locked()
Hello,
On Mon, Aug 11, 2025 at 10:21:48PM +0100, Christian Loehle wrote:
> +/**
> + * scx_bpf_cpu_rq_locked - Fetch the locked rq of a CPU
> + * @cpu: CPU of the rq
> + */
> +__bpf_kfunc struct rq *scx_bpf_cpu_rq_locked(s32 cpu)
> +{
> + struct rq *rq;
> +
> + if (!kf_cpu_valid(cpu, NULL))
> + return NULL;
> +
> + preempt_disable();
> + rq = cpu_rq(cpu);
> + if (rq != scx_locked_rq()) {
> + scx_kf_error("Accessing not locked rq %d", cpu);
> + rq = NULL;
> + }
> + preempt_enable();
> + return rq;
> +}
Do we need @cpu? What do you think about making the function not take any
arguments and just return the locked rq?
Thanks.
--
tejun
Powered by blists - more mailing lists