0001
0002
0003
0004 #include "vmlinux.h"
0005
0006 #include <bpf/bpf_helpers.h>
0007
0008 extern const struct rq runqueues __ksym;
0009 extern const int bpf_prog_active __ksym;
0010
0011 SEC("raw_tp/sys_enter")
0012 int handler(const void *ctx)
0013 {
0014 struct rq *rq;
0015 int *active;
0016 __u32 cpu;
0017
0018 cpu = bpf_get_smp_processor_id();
0019 rq = (struct rq *)bpf_per_cpu_ptr(&runqueues, cpu);
0020 active = (int *)bpf_per_cpu_ptr(&bpf_prog_active, cpu);
0021 if (active) {
0022
0023 *(volatile int *)active;
0024
0025 *(volatile int *)(&rq->cpu);
0026 }
0027
0028 return 0;
0029 }
0030
0031 char _license[] SEC("license") = "GPL";