File tree 6 files changed +24
-0
lines changed 6 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -319,6 +319,7 @@ extern const struct bpf_func_proto bpf_map_delete_elem_proto;
319
319
320
320
extern const struct bpf_func_proto bpf_get_prandom_u32_proto ;
321
321
extern const struct bpf_func_proto bpf_get_smp_processor_id_proto ;
322
+ extern const struct bpf_func_proto bpf_get_numa_node_id_proto ;
322
323
extern const struct bpf_func_proto bpf_tail_call_proto ;
323
324
extern const struct bpf_func_proto bpf_ktime_get_ns_proto ;
324
325
extern const struct bpf_func_proto bpf_get_current_pid_tgid_proto ;
Original file line number Diff line number Diff line change @@ -426,6 +426,12 @@ enum bpf_func_id {
426
426
*/
427
427
BPF_FUNC_set_hash_invalid ,
428
428
429
+ /**
430
+ * bpf_get_numa_node_id()
431
+ * Returns the id of the current NUMA node.
432
+ */
433
+ BPF_FUNC_get_numa_node_id ,
434
+
429
435
__BPF_FUNC_MAX_ID ,
430
436
};
431
437
Original file line number Diff line number Diff line change @@ -1043,6 +1043,7 @@ const struct bpf_func_proto bpf_map_delete_elem_proto __weak;
1043
1043
1044
1044
const struct bpf_func_proto bpf_get_prandom_u32_proto __weak ;
1045
1045
const struct bpf_func_proto bpf_get_smp_processor_id_proto __weak ;
1046
+ const struct bpf_func_proto bpf_get_numa_node_id_proto __weak ;
1046
1047
const struct bpf_func_proto bpf_ktime_get_ns_proto __weak ;
1047
1048
1048
1049
const struct bpf_func_proto bpf_get_current_pid_tgid_proto __weak ;
Original file line number Diff line number Diff line change 13
13
#include <linux/rcupdate.h>
14
14
#include <linux/random.h>
15
15
#include <linux/smp.h>
16
+ #include <linux/topology.h>
16
17
#include <linux/ktime.h>
17
18
#include <linux/sched.h>
18
19
#include <linux/uidgid.h>
@@ -92,6 +93,17 @@ const struct bpf_func_proto bpf_get_smp_processor_id_proto = {
92
93
.ret_type = RET_INTEGER ,
93
94
};
94
95
96
+ BPF_CALL_0 (bpf_get_numa_node_id )
97
+ {
98
+ return numa_node_id ();
99
+ }
100
+
101
+ const struct bpf_func_proto bpf_get_numa_node_id_proto = {
102
+ .func = bpf_get_numa_node_id ,
103
+ .gpl_only = false,
104
+ .ret_type = RET_INTEGER ,
105
+ };
106
+
95
107
BPF_CALL_0 (bpf_ktime_get_ns )
96
108
{
97
109
/* NMI safe access to clock monotonic */
Original file line number Diff line number Diff line change @@ -422,6 +422,8 @@ static const struct bpf_func_proto *tracing_func_proto(enum bpf_func_id func_id)
422
422
return bpf_get_trace_printk_proto ();
423
423
case BPF_FUNC_get_smp_processor_id :
424
424
return & bpf_get_smp_processor_id_proto ;
425
+ case BPF_FUNC_get_numa_node_id :
426
+ return & bpf_get_numa_node_id_proto ;
425
427
case BPF_FUNC_perf_event_read :
426
428
return & bpf_perf_event_read_proto ;
427
429
case BPF_FUNC_probe_write_user :
Original file line number Diff line number Diff line change @@ -2492,6 +2492,8 @@ sk_filter_func_proto(enum bpf_func_id func_id)
2492
2492
return & bpf_get_prandom_u32_proto ;
2493
2493
case BPF_FUNC_get_smp_processor_id :
2494
2494
return & bpf_get_raw_smp_processor_id_proto ;
2495
+ case BPF_FUNC_get_numa_node_id :
2496
+ return & bpf_get_numa_node_id_proto ;
2495
2497
case BPF_FUNC_tail_call :
2496
2498
return & bpf_tail_call_proto ;
2497
2499
case BPF_FUNC_ktime_get_ns :
You can’t perform that action at this time.
0 commit comments