Files
android_kernel_xiaomi_sm8450/include/linux
Martin KaFai Lau 96eabe7a40 bpf: Allow selecting numa node during map creation
The current map creation API does not allow to provide the numa-node
preference.  The memory usually comes from where the map-creation-process
is running.  The performance is not ideal if the bpf_prog is known to
always run in a numa node different from the map-creation-process.

One of the use case is sharding on CPU to different LRU maps (i.e.
an array of LRU maps).  Here is the test result of map_perf_test on
the INNER_LRU_HASH_PREALLOC test if we force the lru map used by
CPU0 to be allocated from a remote numa node:

[ The machine has 20 cores. CPU0-9 at node 0. CPU10-19 at node 1 ]

># taskset -c 10 ./map_perf_test 512 8 1260000 8000000
5:inner_lru_hash_map_perf pre-alloc 1628380 events per sec
4:inner_lru_hash_map_perf pre-alloc 1626396 events per sec
3:inner_lru_hash_map_perf pre-alloc 1626144 events per sec
6:inner_lru_hash_map_perf pre-alloc 1621657 events per sec
2:inner_lru_hash_map_perf pre-alloc 1621534 events per sec
1:inner_lru_hash_map_perf pre-alloc 1620292 events per sec
7:inner_lru_hash_map_perf pre-alloc 1613305 events per sec
0:inner_lru_hash_map_perf pre-alloc 1239150 events per sec  #<<<

After specifying numa node:
># taskset -c 10 ./map_perf_test 512 8 1260000 8000000
5:inner_lru_hash_map_perf pre-alloc 1629627 events per sec
3:inner_lru_hash_map_perf pre-alloc 1628057 events per sec
1:inner_lru_hash_map_perf pre-alloc 1623054 events per sec
6:inner_lru_hash_map_perf pre-alloc 1616033 events per sec
2:inner_lru_hash_map_perf pre-alloc 1614630 events per sec
4:inner_lru_hash_map_perf pre-alloc 1612651 events per sec
7:inner_lru_hash_map_perf pre-alloc 1609337 events per sec
0:inner_lru_hash_map_perf pre-alloc 1619340 events per sec #<<<

This patch adds one field, numa_node, to the bpf_attr.  Since numa node 0
is a valid node, a new flag BPF_F_NUMA_NODE is also added.  The numa_node
field is honored if and only if the BPF_F_NUMA_NODE flag is set.

Numa node selection is not supported for percpu map.

This patch does not change all the kmalloc.  F.e.
'htab = kzalloc()' is not changed since the object
is small enough to stay in the cache.

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-19 21:35:43 -07:00
..
2017-06-03 19:29:26 +09:00
2017-08-03 21:37:30 -07:00
2017-06-08 18:52:36 -07:00
2017-07-03 17:00:59 -06:00
2017-07-06 16:24:33 -07:00
2017-07-03 16:56:28 -06:00
2017-05-24 12:43:30 -04:00
2017-06-05 16:59:12 +02:00
2017-04-18 20:41:12 +02:00
2017-06-22 15:43:47 +01:00
2017-06-09 11:52:07 +02:00
2017-04-10 17:15:02 +02:00
2017-04-27 05:13:04 -04:00
2017-08-16 11:27:53 -07:00
2017-07-07 20:09:10 -04:00
2017-06-05 16:59:10 +02:00
2017-03-21 10:15:47 +02:00
2017-05-18 10:07:41 -04:00
2017-05-18 10:07:40 -04:00
2017-06-21 14:37:12 -04:00
2017-07-10 16:32:34 -07:00
2017-05-03 15:52:10 -07:00
2017-07-10 13:41:04 -04:00
2017-02-24 17:46:57 -08:00
2017-04-24 14:30:46 -04:00
2017-07-13 16:00:15 -04:00
2017-07-12 16:26:02 -07:00
2017-07-06 11:30:07 -04:00
2017-07-25 18:05:25 +02:00
2017-05-26 10:10:37 +02:00
2017-08-06 20:55:29 -07:00
2017-08-06 20:55:29 -07:00
2017-05-18 10:07:40 -04:00
2017-06-29 10:48:57 +01:00
2017-05-03 15:52:10 -07:00
2017-07-12 23:11:23 +02:00
2017-06-08 10:35:49 +02:00
2017-07-06 16:24:30 -07:00
2017-03-26 15:09:45 +02:00
2017-08-03 21:37:29 -07:00
2017-06-08 18:52:42 -07:00
2017-06-01 14:53:04 -04:00
2017-03-09 15:42:33 +01:00
2017-07-24 17:50:37 +02:00
2017-05-09 16:43:22 +03:00
2017-06-09 11:54:54 +02:00