* [PATCH] tools/sched_ext: Provide consistent access to scx flags
@ 2025-02-24 22:49 Andrea Righi
2025-02-24 23:03 ` Changwoo Min
2025-02-25 18:36 ` Tejun Heo
0 siblings, 2 replies; 3+ messages in thread
From: Andrea Righi @ 2025-02-24 22:49 UTC (permalink / raw)
To: Tejun Heo, David Vernet, Changwoo Min; +Cc: linux-kernel
Make all the SCX_OPS_* and SCX_PICK_IDLE_* flags available to the
user-space part of the schedulers via the compat interface.
This allows schedulers / selftests to set all the ops flags in
user-space, rather than having them split between BPF and user-space.
Signed-off-by: Andrea Righi <arighi@nvidia.com>
---
tools/sched_ext/include/scx/compat.h | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/tools/sched_ext/include/scx/compat.h b/tools/sched_ext/include/scx/compat.h
index 03e06bd15c738..35c67c5174ac0 100644
--- a/tools/sched_ext/include/scx/compat.h
+++ b/tools/sched_ext/include/scx/compat.h
@@ -106,14 +106,20 @@ static inline bool __COMPAT_struct_has_field(const char *type, const char *field
return false;
}
-#define SCX_OPS_SWITCH_PARTIAL \
- __COMPAT_ENUM_OR_ZERO("scx_ops_flags", "SCX_OPS_SWITCH_PARTIAL")
+#define SCX_OPS_FLAG(name) __COMPAT_ENUM_OR_ZERO("scx_ops_flags", #name)
-#define SCX_OPS_BUILTIN_IDLE_PER_NODE \
- __COMPAT_ENUM_OR_ZERO("scx_ops_flags", "SCX_OPS_BUILTIN_IDLE_PER_NODE")
+#define SCX_OPS_KEEP_BUILTIN_IDLE SCX_OPS_FLAG(SCX_OPS_KEEP_BUILTIN_IDLE)
+#define SCX_OPS_ENQ_LAST SCX_OPS_FLAG(SCX_OPS_ENQ_LAST)
+#define SCX_OPS_ENQ_EXITING SCX_OPS_FLAG(SCX_OPS_ENQ_EXITING)
+#define SCX_OPS_SWITCH_PARTIAL SCX_OPS_FLAG(SCX_OPS_SWITCH_PARTIAL)
+#define SCX_OPS_ENQ_MIGRATION_DISABLED SCX_OPS_FLAG(SCX_OPS_ENQ_MIGRATION_DISABLED)
+#define SCX_OPS_ALLOW_QUEUED_WAKEUP SCX_OPS_FLAG(SCX_OPS_ALLOW_QUEUED_WAKEUP)
+#define SCX_OPS_BUILTIN_IDLE_PER_NODE SCX_OPS_FLAG(SCX_OPS_BUILTIN_IDLE_PER_NODE)
-#define SCX_PICK_IDLE_IN_NODE \
- __COMPAT_ENUM_OR_ZERO("scx_pick_idle_cpu_flags", "SCX_PICK_IDLE_IN_NODE")
+#define SCX_PICK_IDLE_FLAG(name) __COMPAT_ENUM_OR_ZERO("scx_pick_idle_cpu_flags", #name)
+
+#define SCX_PICK_IDLE_CORE SCX_PICK_IDLE_FLAG(SCX_PICK_IDLE_CORE)
+#define SCX_PICK_IDLE_IN_NODE SCX_PICK_IDLE_FLAG(SCX_PICK_IDLE_IN_NODE)
static inline long scx_hotplug_seq(void)
{
--
2.48.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tools/sched_ext: Provide consistent access to scx flags
2025-02-24 22:49 [PATCH] tools/sched_ext: Provide consistent access to scx flags Andrea Righi
@ 2025-02-24 23:03 ` Changwoo Min
2025-02-25 18:36 ` Tejun Heo
1 sibling, 0 replies; 3+ messages in thread
From: Changwoo Min @ 2025-02-24 23:03 UTC (permalink / raw)
To: Andrea Righi, Tejun Heo, David Vernet; +Cc: linux-kernel
Hi Andrea,
On 25. 2. 25. 07:49, Andrea Righi wrote:
> Make all the SCX_OPS_* and SCX_PICK_IDLE_* flags available to the
> user-space part of the schedulers via the compat interface.
>
> This allows schedulers / selftests to set all the ops flags in
> user-space, rather than having them split between BPF and user-space.
>
> Signed-off-by: Andrea Righi <arighi@nvidia.com>
> ---
> tools/sched_ext/include/scx/compat.h | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/tools/sched_ext/include/scx/compat.h b/tools/sched_ext/include/scx/compat.h
> index 03e06bd15c738..35c67c5174ac0 100644
> --- a/tools/sched_ext/include/scx/compat.h
> +++ b/tools/sched_ext/include/scx/compat.h
> @@ -106,14 +106,20 @@ static inline bool __COMPAT_struct_has_field(const char *type, const char *field
> return false;
> }
>
> -#define SCX_OPS_SWITCH_PARTIAL \
> - __COMPAT_ENUM_OR_ZERO("scx_ops_flags", "SCX_OPS_SWITCH_PARTIAL")
> +#define SCX_OPS_FLAG(name) __COMPAT_ENUM_OR_ZERO("scx_ops_flags", #name)
>
> -#define SCX_OPS_BUILTIN_IDLE_PER_NODE \
> - __COMPAT_ENUM_OR_ZERO("scx_ops_flags", "SCX_OPS_BUILTIN_IDLE_PER_NODE")
> +#define SCX_OPS_KEEP_BUILTIN_IDLE SCX_OPS_FLAG(SCX_OPS_KEEP_BUILTIN_IDLE)
> +#define SCX_OPS_ENQ_LAST SCX_OPS_FLAG(SCX_OPS_ENQ_LAST)
> +#define SCX_OPS_ENQ_EXITING SCX_OPS_FLAG(SCX_OPS_ENQ_EXITING)
> +#define SCX_OPS_SWITCH_PARTIAL SCX_OPS_FLAG(SCX_OPS_SWITCH_PARTIAL)
> +#define SCX_OPS_ENQ_MIGRATION_DISABLED SCX_OPS_FLAG(SCX_OPS_ENQ_MIGRATION_DISABLED)
> +#define SCX_OPS_ALLOW_QUEUED_WAKEUP SCX_OPS_FLAG(SCX_OPS_ALLOW_QUEUED_WAKEUP)
> +#define SCX_OPS_BUILTIN_IDLE_PER_NODE SCX_OPS_FLAG(SCX_OPS_BUILTIN_IDLE_PER_NODE)
>
> -#define SCX_PICK_IDLE_IN_NODE \
> - __COMPAT_ENUM_OR_ZERO("scx_pick_idle_cpu_flags", "SCX_PICK_IDLE_IN_NODE")
> +#define SCX_PICK_IDLE_FLAG(name) __COMPAT_ENUM_OR_ZERO("scx_pick_idle_cpu_flags", #name)
> +
> +#define SCX_PICK_IDLE_CORE SCX_PICK_IDLE_FLAG(SCX_PICK_IDLE_CORE)
> +#define SCX_PICK_IDLE_IN_NODE SCX_PICK_IDLE_FLAG(SCX_PICK_IDLE_IN_NODE)
>
> static inline long scx_hotplug_seq(void)
> {
Looks good to me. Thanks!
Acked-by: Changwoo Min <changwoo@igalia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tools/sched_ext: Provide consistent access to scx flags
2025-02-24 22:49 [PATCH] tools/sched_ext: Provide consistent access to scx flags Andrea Righi
2025-02-24 23:03 ` Changwoo Min
@ 2025-02-25 18:36 ` Tejun Heo
1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2025-02-25 18:36 UTC (permalink / raw)
To: Andrea Righi; +Cc: David Vernet, Changwoo Min, linux-kernel
On Mon, Feb 24, 2025 at 11:49:59PM +0100, Andrea Righi wrote:
> Make all the SCX_OPS_* and SCX_PICK_IDLE_* flags available to the
> user-space part of the schedulers via the compat interface.
>
> This allows schedulers / selftests to set all the ops flags in
> user-space, rather than having them split between BPF and user-space.
>
> Signed-off-by: Andrea Righi <arighi@nvidia.com>
Applied to sched_ext/for-6.15.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-25 18:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-24 22:49 [PATCH] tools/sched_ext: Provide consistent access to scx flags Andrea Righi
2025-02-24 23:03 ` Changwoo Min
2025-02-25 18:36 ` Tejun Heo
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®