From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2349481655 for ; Fri, 6 Mar 2026 20:45:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772829914; cv=none; b=uaKrI4OohtWlhzUr+ddbUilRewo0oCrdeI5KMqDDpq/oDqz52i1+7MSGogpLc1vQuUEVHXSNXcwEFibx724PUKJv9XKHm5rJ0ben8vm6F7nc+El9XrKxfW5GerEfg0BCRRBUgJGRhZu7wks176wuJHbCDwu+4dnWLc8Syhu1koY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772829914; c=relaxed/simple; bh=elutkPZW/m+Hbg3tKnjsgvpmyPteDk5HU81VB/n7nlg=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=QVICYY36sb4bORghPop5jlRWHBsehZo2yooAkaId8aE5DHB9dw2WeNBr0lD5fEDkZcvJI0Ay3Um9K4ROew87e99AK857tqWMQfXLx+TRPNPbjQ0MgChg/htA2aOdxGegxuE8WWtNc1RDrJcwk8okZHqYnKw3e/pdxGxif1YLr/c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=etsalapatis.com; spf=pass smtp.mailfrom=etsalapatis.com; dkim=pass (2048-bit key) header.d=etsalapatis-com.20230601.gappssmtp.com header.i=@etsalapatis-com.20230601.gappssmtp.com header.b=K5ZMhGJa; arc=none smtp.client-ip=209.85.219.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=etsalapatis.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=etsalapatis.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=etsalapatis-com.20230601.gappssmtp.com header.i=@etsalapatis-com.20230601.gappssmtp.com header.b="K5ZMhGJa" Received: by mail-qv1-f47.google.com with SMTP id 6a1803df08f44-89a06bc2f1bso91362886d6.1 for ; Fri, 06 Mar 2026 12:45:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=etsalapatis-com.20230601.gappssmtp.com; s=20230601; t=1772829910; x=1773434710; darn=vger.kernel.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=krD/ofUXNj0qIhwSBPz6DnVjO0QOIzp7Ti+676UFGPU=; b=K5ZMhGJaWGgJeoUXY5bbzmfWU5v+cQ7L5s4mqwO4ruazd6RrKn6KNghhRvHVB6iB3U ez8z7ApxMdihLajY23CU7//ATf9wo6LCvv8ChUuR646FU4eJNQyDzMXfN//6ZsaRWmUo v81mhtlavMhERKV07wmDyZzUH3VC53tRpF3hSxkPufQCYwi0HjQ72ycpvlZzQrA9d6Rc lW7BmV4o8FovdMtL+ZvPwykDipbS7M+axaZ4F/9Jxxfn2wMeWtXqlwkWEFgUvw086w5u CK3QWy5KKP2U32nUM5cfTit1H8nfBYHPQauy0eP7H/OA3pS/PGuOs/aDV8p7DMVGp+26 J+Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772829910; x=1773434710; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=krD/ofUXNj0qIhwSBPz6DnVjO0QOIzp7Ti+676UFGPU=; b=WR4O/dpnrZ4D0JIs0RPZK4XfAAC1CUvJj0ogAqUf1qq6tvb3+vAS4jqEOrsRlgoimR Cy27fHEAPmx4QKS1RH7WaJOksO/87EIo6KxI94f20uMWpXgDZr+M4N/f56345eRuTvpV q/BUFaT/cgn8+TKN+vf61xWf96XoWJEBmrqCwyqRv9YORVFK6SIE84pMRRDY7fk/a/59 PtT3UGy1QhHFSdpQmnFtWhAQwOLlJFgCfYdpx6V551xtRsmLww13o5UKjNht0NzEJMKn s7KeV30bkB0F6dZKvY+6ndpcnUPU1bJ3Rqvx6BUvqLORjrq8nB9I3R29f8k3RJZfIXIb SpmQ== X-Forwarded-Encrypted: i=1; AJvYcCU1UpsSJ+TGe2hESlSVr8/LznybaFX5ngsfA3w88by8Jwq6jK9uASGhNcWLU8BWqazjlWlWo/7NIWFa/cU=@vger.kernel.org X-Gm-Message-State: AOJu0YyekN7izTf9JHuuJgPwnTcMHRlZInoW2dKKr2QWzfqvMIHKgW1/ 0UHPFixIPp+B7eUd6jYRFDSaNTSYHDng8ALk4yrdcFqGWl59SqjxbyAwB3c2cNDALmo= X-Gm-Gg: ATEYQzz75tDrH67eyAlYgFZ+liBYRpE0gc4p2YMtyvmzeBnqSplwJxYy279L4M6LtwG RaUO/2eh76/k4zPTg/SxHBItCkucjd3g0Tcq3HtDLTfd1AFpWn6gfI7B4Pkg0f0YTlvu8bLPEBS A708DsTdCmNIfDUC1v9GuQzuq8vPP3Qm9cwWhe7nmjbmYPMBJKQElg7eds1PQhR8A9nGreE3b78 YIwUP7QdcSYWbNU4uy1PLP33M5K7DhU/0NqEFmwD64J3Aa9PxMG9lInEyn87EdQRhT4XAIC7Ago uRZJk6TdEiu8CMy+8e9gZ/4J4C0JkjMyTQCvOWUBmkA7appMXT6hvok0EeJm/ipcl7azINNras6 nADV30x4ya4SU/5DPH/d+9CU/RWynam0ZR2PP9XYnQP73exH/Vz8tOuKMN9/vZqflLAT9su5hE4 7V8Vf79uMdahSs0afkGu2bkNw= X-Received: by 2002:a05:6214:2681:b0:89a:1602:8b08 with SMTP id 6a1803df08f44-89a30a17914mr51065886d6.10.1772829909563; Fri, 06 Mar 2026 12:45:09 -0800 (PST) Received: from localhost ([140.174.219.137]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-89a316da91esm23608096d6.32.2026.03.06.12.45.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Mar 2026 12:45:09 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 06 Mar 2026 15:45:08 -0500 Message-Id: Cc: , , Subject: Re: [PATCH 01/15] sched_ext: Relocate scx_bpf_task_cgroup() and its BTF_ID to the end of kfunc section From: "Emil Tsalapatis" To: "Tejun Heo" , , X-Mailer: aerc 0.20.1 References: <20260306190623.1076074-1-tj@kernel.org> <20260306190623.1076074-2-tj@kernel.org> In-Reply-To: <20260306190623.1076074-2-tj@kernel.org> On Fri Mar 6, 2026 at 2:06 PM EST, Tejun Heo wrote: > Move scx_bpf_task_cgroup() kfunc definition and its BTF_ID entry to the e= nd > of the kfunc section before __bpf_kfunc_end_defs() for cleaner code > organization. > > No functional changes. > > Signed-off-by: Tejun Heo Reviewed-by: Emil Tsalapatis > --- > kernel/sched/ext.c | 78 +++++++++++++++++++++++----------------------- > 1 file changed, 39 insertions(+), 39 deletions(-) > > diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c > index e25b3593dd30..fe222df1d494 100644 > --- a/kernel/sched/ext.c > +++ b/kernel/sched/ext.c > @@ -8628,43 +8628,6 @@ __bpf_kfunc struct task_struct *scx_bpf_cpu_curr(s= 32 cpu, const struct bpf_prog_ > return rcu_dereference(cpu_rq(cpu)->curr); > } > =20 > -/** > - * scx_bpf_task_cgroup - Return the sched cgroup of a task > - * @p: task of interest > - * @aux: implicit BPF argument to access bpf_prog_aux hidden from BPF pr= ogs > - * > - * @p->sched_task_group->css.cgroup represents the cgroup @p is associat= ed with > - * from the scheduler's POV. SCX operations should use this function to > - * determine @p's current cgroup as, unlike following @p->cgroups, > - * @p->sched_task_group is protected by @p's rq lock and thus atomic w.r= .t. all > - * rq-locked operations. Can be called on the parameter tasks of rq-lock= ed > - * operations. The restriction guarantees that @p's rq is locked by the = caller. > - */ > -#ifdef CONFIG_CGROUP_SCHED > -__bpf_kfunc struct cgroup *scx_bpf_task_cgroup(struct task_struct *p, > - const struct bpf_prog_aux *aux) > -{ > - struct task_group *tg =3D p->sched_task_group; > - struct cgroup *cgrp =3D &cgrp_dfl_root.cgrp; > - struct scx_sched *sch; > - > - guard(rcu)(); > - > - sch =3D scx_prog_sched(aux); > - if (unlikely(!sch)) > - goto out; > - > - if (!scx_kf_allowed_on_arg_tasks(sch, __SCX_KF_RQ_LOCKED, p)) > - goto out; > - > - cgrp =3D tg_cgrp(tg); > - > -out: > - cgroup_get(cgrp); > - return cgrp; > -} > -#endif > - > /** > * scx_bpf_now - Returns a high-performance monotonically non-decreasing > * clock for the current CPU. The clock returned is in nanoseconds. > @@ -8779,6 +8742,43 @@ __bpf_kfunc void scx_bpf_events(struct scx_event_s= tats *events, > memcpy(events, &e_sys, events__sz); > } > =20 > +#ifdef CONFIG_CGROUP_SCHED > +/** > + * scx_bpf_task_cgroup - Return the sched cgroup of a task > + * @p: task of interest > + * @aux: implicit BPF argument to access bpf_prog_aux hidden from BPF pr= ogs > + * > + * @p->sched_task_group->css.cgroup represents the cgroup @p is associat= ed with > + * from the scheduler's POV. SCX operations should use this function to > + * determine @p's current cgroup as, unlike following @p->cgroups, > + * @p->sched_task_group is protected by @p's rq lock and thus atomic w.r= .t. all > + * rq-locked operations. Can be called on the parameter tasks of rq-lock= ed > + * operations. The restriction guarantees that @p's rq is locked by the = caller. > + */ > +__bpf_kfunc struct cgroup *scx_bpf_task_cgroup(struct task_struct *p, > + const struct bpf_prog_aux *aux) > +{ > + struct task_group *tg =3D p->sched_task_group; > + struct cgroup *cgrp =3D &cgrp_dfl_root.cgrp; > + struct scx_sched *sch; > + > + guard(rcu)(); > + > + sch =3D scx_prog_sched(aux); > + if (unlikely(!sch)) > + goto out; > + > + if (!scx_kf_allowed_on_arg_tasks(sch, __SCX_KF_RQ_LOCKED, p)) > + goto out; > + > + cgrp =3D tg_cgrp(tg); > + > +out: > + cgroup_get(cgrp); > + return cgrp; > +} > +#endif /* CONFIG_CGROUP_SCHED */ > + > __bpf_kfunc_end_defs(); > =20 > BTF_KFUNCS_START(scx_kfunc_ids_any) > @@ -8808,11 +8808,11 @@ BTF_ID_FLAGS(func, scx_bpf_task_cpu, KF_RCU) > BTF_ID_FLAGS(func, scx_bpf_cpu_rq, KF_IMPLICIT_ARGS) > BTF_ID_FLAGS(func, scx_bpf_locked_rq, KF_IMPLICIT_ARGS | KF_RET_NULL) > BTF_ID_FLAGS(func, scx_bpf_cpu_curr, KF_IMPLICIT_ARGS | KF_RET_NULL | KF= _RCU_PROTECTED) > +BTF_ID_FLAGS(func, scx_bpf_now) > +BTF_ID_FLAGS(func, scx_bpf_events) > #ifdef CONFIG_CGROUP_SCHED > BTF_ID_FLAGS(func, scx_bpf_task_cgroup, KF_IMPLICIT_ARGS | KF_RCU | KF_A= CQUIRE) > #endif > -BTF_ID_FLAGS(func, scx_bpf_now) > -BTF_ID_FLAGS(func, scx_bpf_events) > BTF_KFUNCS_END(scx_kfunc_ids_any) > =20 > static const struct btf_kfunc_id_set scx_kfunc_set_any =3D {