~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/sched_ext/exit.bpf.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/testing/selftests/sched_ext/exit.bpf.c (Architecture i386) and /tools/testing/selftests/sched_ext/exit.bpf.c (Architecture m68k)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*                                                  2 /*
  3  * Copyright (c) 2024 Meta Platforms, Inc. and      3  * Copyright (c) 2024 Meta Platforms, Inc. and affiliates.
  4  * Copyright (c) 2024 David Vernet <dvernet@me      4  * Copyright (c) 2024 David Vernet <dvernet@meta.com>
  5  */                                                 5  */
  6                                                     6 
  7 #include <scx/common.bpf.h>                         7 #include <scx/common.bpf.h>
  8                                                     8 
  9 char _license[] SEC("license") = "GPL";             9 char _license[] SEC("license") = "GPL";
 10                                                    10 
 11 #include "exit_test.h"                             11 #include "exit_test.h"
 12                                                    12 
 13 const volatile int exit_point;                     13 const volatile int exit_point;
 14 UEI_DEFINE(uei);                                   14 UEI_DEFINE(uei);
 15                                                    15 
 16 #define EXIT_CLEANLY() scx_bpf_exit(exit_point     16 #define EXIT_CLEANLY() scx_bpf_exit(exit_point, "%d", exit_point)
 17                                                    17 
 18 #define DSQ_ID 0                                   18 #define DSQ_ID 0
 19                                                    19 
 20 s32 BPF_STRUCT_OPS(exit_select_cpu, struct tas     20 s32 BPF_STRUCT_OPS(exit_select_cpu, struct task_struct *p,
 21                    s32 prev_cpu, u64 wake_flag     21                    s32 prev_cpu, u64 wake_flags)
 22 {                                                  22 {
 23         bool found;                                23         bool found;
 24                                                    24 
 25         if (exit_point == EXIT_SELECT_CPU)         25         if (exit_point == EXIT_SELECT_CPU)
 26                 EXIT_CLEANLY();                    26                 EXIT_CLEANLY();
 27                                                    27 
 28         return scx_bpf_select_cpu_dfl(p, prev_     28         return scx_bpf_select_cpu_dfl(p, prev_cpu, wake_flags, &found);
 29 }                                                  29 }
 30                                                    30 
 31 void BPF_STRUCT_OPS(exit_enqueue, struct task_     31 void BPF_STRUCT_OPS(exit_enqueue, struct task_struct *p, u64 enq_flags)
 32 {                                                  32 {
 33         if (exit_point == EXIT_ENQUEUE)            33         if (exit_point == EXIT_ENQUEUE)
 34                 EXIT_CLEANLY();                    34                 EXIT_CLEANLY();
 35                                                    35 
 36         scx_bpf_dispatch(p, DSQ_ID, SCX_SLICE_     36         scx_bpf_dispatch(p, DSQ_ID, SCX_SLICE_DFL, enq_flags);
 37 }                                                  37 }
 38                                                    38 
 39 void BPF_STRUCT_OPS(exit_dispatch, s32 cpu, st     39 void BPF_STRUCT_OPS(exit_dispatch, s32 cpu, struct task_struct *p)
 40 {                                                  40 {
 41         if (exit_point == EXIT_DISPATCH)           41         if (exit_point == EXIT_DISPATCH)
 42                 EXIT_CLEANLY();                    42                 EXIT_CLEANLY();
 43                                                    43 
 44         scx_bpf_consume(DSQ_ID);                   44         scx_bpf_consume(DSQ_ID);
 45 }                                                  45 }
 46                                                    46 
 47 void BPF_STRUCT_OPS(exit_enable, struct task_s     47 void BPF_STRUCT_OPS(exit_enable, struct task_struct *p)
 48 {                                                  48 {
 49         if (exit_point == EXIT_ENABLE)             49         if (exit_point == EXIT_ENABLE)
 50                 EXIT_CLEANLY();                    50                 EXIT_CLEANLY();
 51 }                                                  51 }
 52                                                    52 
 53 s32 BPF_STRUCT_OPS(exit_init_task, struct task     53 s32 BPF_STRUCT_OPS(exit_init_task, struct task_struct *p,
 54                     struct scx_init_task_args      54                     struct scx_init_task_args *args)
 55 {                                                  55 {
 56         if (exit_point == EXIT_INIT_TASK)          56         if (exit_point == EXIT_INIT_TASK)
 57                 EXIT_CLEANLY();                    57                 EXIT_CLEANLY();
 58                                                    58 
 59         return 0;                                  59         return 0;
 60 }                                                  60 }
 61                                                    61 
 62 void BPF_STRUCT_OPS(exit_exit, struct scx_exit     62 void BPF_STRUCT_OPS(exit_exit, struct scx_exit_info *ei)
 63 {                                                  63 {
 64         UEI_RECORD(uei, ei);                       64         UEI_RECORD(uei, ei);
 65 }                                                  65 }
 66                                                    66 
 67 s32 BPF_STRUCT_OPS_SLEEPABLE(exit_init)            67 s32 BPF_STRUCT_OPS_SLEEPABLE(exit_init)
 68 {                                                  68 {
 69         if (exit_point == EXIT_INIT)               69         if (exit_point == EXIT_INIT)
 70                 EXIT_CLEANLY();                    70                 EXIT_CLEANLY();
 71                                                    71 
 72         return scx_bpf_create_dsq(DSQ_ID, -1);     72         return scx_bpf_create_dsq(DSQ_ID, -1);
 73 }                                                  73 }
 74                                                    74 
 75 SEC(".struct_ops.link")                            75 SEC(".struct_ops.link")
 76 struct sched_ext_ops exit_ops = {                  76 struct sched_ext_ops exit_ops = {
 77         .select_cpu             = (void *) exi     77         .select_cpu             = (void *) exit_select_cpu,
 78         .enqueue                = (void *) exi     78         .enqueue                = (void *) exit_enqueue,
 79         .dispatch               = (void *) exi     79         .dispatch               = (void *) exit_dispatch,
 80         .init_task              = (void *) exi     80         .init_task              = (void *) exit_init_task,
 81         .enable                 = (void *) exi     81         .enable                 = (void *) exit_enable,
 82         .exit                   = (void *) exi     82         .exit                   = (void *) exit_exit,
 83         .init                   = (void *) exi     83         .init                   = (void *) exit_init,
 84         .name                   = "exit",          84         .name                   = "exit",
 85         .timeout_ms             = 1000U,           85         .timeout_ms             = 1000U,
 86 };                                                 86 };
 87                                                    87 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php