[PATCH bpf-next v2 31/35] bpf: runqslower: don't touch RLIMIT_MEMLOCK

2020-07-27 Thread Roman Gushchin
Since bpf is not using memlock rlimit for memory accounting, there are no more reasons to bump the limit. Signed-off-by: Roman Gushchin --- tools/bpf/runqslower/runqslower.c | 16 1 file changed, 16 deletions(-) diff --git a/tools/bpf/runqslower/runqslower.c b/tools/bpf

[PATCH bpf-next v2 19/35] bpf: eliminate rlimit-based memory accounting for lpm_trie maps

2020-07-27 Thread Roman Gushchin
Do not use rlimit-based memory accounting for lpm_trie maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/lpm_trie.c | 13 - 1 file changed, 13 deletions(-) diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c index

[PATCH bpf-next v2 00/35] bpf: switch to memcg-based memory accounting

2020-07-27 Thread Roman Gushchin
remaining rlimit-based accounting for sockhash maps Roman Gushchin (35): bpf: memcg-based memory accounting for bpf progs bpf: memcg-based memory accounting for bpf maps bpf: refine memcg-based memory accounting for arraymap maps bpf: refine memcg-based memory accounting for cpumap

[PATCH bpf-next v2 35/35] perf: don't touch RLIMIT_MEMLOCK

2020-07-27 Thread Roman Gushchin
Since bpf stopped using memlock rlimit to limit the memory usage, there is no more reason for perf to alter its own limit. Signed-off-by: Roman Gushchin --- tools/perf/builtin-trace.c | 10 -- tools/perf/tests/builtin-test.c | 6 -- tools/perf/util/Build | 1

[PATCH bpf-next v2 30/35] bpf: bpftool: do not touch RLIMIT_MEMLOCK

2020-07-27 Thread Roman Gushchin
Since bpf stopped using memlock rlimit to limit the memory usage, there is no more reason for bpftool to alter its own limits. Signed-off-by: Roman Gushchin --- tools/bpf/bpftool/common.c | 7 --- tools/bpf/bpftool/feature.c| 2 -- tools/bpf/bpftool/main.h | 2 -- tools/bpf

[PATCH bpf-next v2 27/35] bpf: eliminate rlimit-based memory accounting infra for bpf maps

2020-07-27 Thread Roman Gushchin
Remove rlimit-based accounting infrastructure code, which is not used anymore. Signed-off-by: Roman Gushchin --- include/linux/bpf.h | 12 kernel/bpf/syscall.c | 64 +-- .../selftests/bpf/progs/map_ptr_kern.c| 5

[PATCH bpf-next v2 16/35] bpf: eliminate rlimit-based memory accounting for cgroup storage maps

2020-07-27 Thread Roman Gushchin
Do not use rlimit-based memory accounting for cgroup storage maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/local_storage.c | 21 + 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/kernel/bpf

[PATCH bpf-next v2 32/35] bpf: selftests: delete bpf_rlimit.h

2020-07-27 Thread Roman Gushchin
As rlimit-based memory accounting is not used by bpf anymore, there are no more reasons to play with memlock rlimit. Delete bpf_rlimit.h which contained a code to bump the limit. Signed-off-by: Roman Gushchin --- samples/bpf/hbm.c | 1 - tools/testing/selftests/bpf

[PATCH bpf-next v2 26/35] bpf: eliminate rlimit-based memory accounting for xskmap maps

2020-07-27 Thread Roman Gushchin
Do not use rlimit-based memory accounting for xskmap maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- net/xdp/xskmap.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/net/xdp/xskmap.c b/net/xdp/xskmap.c index

[PATCH bpf-next v2 20/35] bpf: eliminate rlimit-based memory accounting for queue_stack_maps maps

2020-07-27 Thread Roman Gushchin
Do not use rlimit-based memory accounting for queue_stack maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/queue_stack_maps.c | 16 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/kernel/bpf

[PATCH bpf-next v2 05/35] bpf: memcg-based memory accounting for cgroup storage maps

2020-07-27 Thread Roman Gushchin
Account memory used by cgroup storage maps including the percpu memory for the percpu flavor of cgroup storage and map metadata. Signed-off-by: Roman Gushchin --- kernel/bpf/local_storage.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/kernel/bpf

[PATCH bpf-next v2 08/35] bpf: memcg-based memory accounting for lpm_trie maps

2020-07-27 Thread Roman Gushchin
Include lpm trie and lpm trie node objects into the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/lpm_trie.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c index 44474bf3ab7a..d85e0fc2cafc

[PATCH bpf-next v2 29/35] bpf: libbpf: cleanup RLIMIT_MEMLOCK usage

2020-07-27 Thread Roman Gushchin
As bpf is not using memlock rlimit for memory accounting anymore, let's remove the related code from libbpf. Bpf operations can't fail because of exceeding the limit anymore. Signed-off-by: Roman Gushchin --- tools/lib/bpf/libbpf.c | 31 +-- tools/lib/bpf/libbpf.h

[PATCH bpf-next v2 25/35] bpf: eliminate rlimit-based memory accounting for socket storage maps

2020-07-27 Thread Roman Gushchin
Do not use rlimit-based memory accounting for socket storage maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- net/core/bpf_sk_storage.c | 11 --- 1 file changed, 11 deletions(-) diff --git a/net/core/bpf_sk_storage.c b/net/core

[PATCH bpf-next v2 02/35] bpf: memcg-based memory accounting for bpf maps

2020-07-27 Thread Roman Gushchin
This patch enables memcg-based memory accounting for memory allocated by __bpf_map_area_alloc(), which is used by most map types for large allocations. Following patches in the series will refine the accounting for some map types. Signed-off-by: Roman Gushchin --- kernel/bpf/syscall.c | 2

[PATCH bpf-next v2 21/35] bpf: eliminate rlimit-based memory accounting for reuseport_array maps

2020-07-27 Thread Roman Gushchin
Do not use rlimit-based memory accounting for reuseport_array maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/reuseport_array.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/kernel/bpf

[PATCH bpf-next v2 24/35] bpf: eliminate rlimit-based memory accounting for stackmap maps

2020-07-27 Thread Roman Gushchin
Do not use rlimit-based memory accounting for stackmap maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/stackmap.c | 16 +++- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/kernel/bpf/stackmap.c b/kernel

[PATCH bpf-next v2 33/35] bpf: selftests: don't touch RLIMIT_MEMLOCK

2020-07-27 Thread Roman Gushchin
Since bpf is not using memlock rlimit for memory accounting, there are no more reasons to bump the limit. Signed-off-by: Roman Gushchin --- tools/testing/selftests/bpf/bench.c | 16 --- .../selftests/bpf/progs/bpf_iter_bpf_map.c| 5 ++--- tools/testing/selftests/bpf

[PATCH bpf-next v2 28/35] bpf: eliminate rlimit-based memory accounting for bpf progs

2020-07-27 Thread Roman Gushchin
Do not use rlimit-based memory accounting for bpf progs. It has been replaced with memcg-based memory accounting. Signed-off-by: Roman Gushchin --- include/linux/bpf.h | 11 -- kernel/bpf/core.c| 12 ++- kernel/bpf/syscall.c | 86 ++-- 3

[PATCH bpf-next v2 14/35] bpf: eliminate rlimit-based memory accounting for bpf_struct_ops maps

2020-07-27 Thread Roman Gushchin
Do not use rlimit-based memory accounting for bpf_struct_ops maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/bpf_struct_ops.c | 19 +++ 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/kernel/bpf

[PATCH bpf-next v2 23/35] bpf: eliminate rlimit-based memory accounting for sockmap and sockhash maps

2020-07-27 Thread Roman Gushchin
Do not use rlimit-based memory accounting for sockmap and sockhash maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- net/core/sock_map.c | 33 ++--- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/net

[PATCH bpf-next v2 22/35] bpf: eliminate rlimit-based memory accounting for bpf ringbuffer

2020-07-27 Thread Roman Gushchin
a couple of lines in ringbuf_map_alloc() and also makes it look similar to other memory allocating function like kmalloc(). Signed-off-by: Roman Gushchin --- kernel/bpf/ringbuf.c | 24 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/kernel/bpf/ringbuf.c b

[PATCH bpf-next v2 03/35] bpf: refine memcg-based memory accounting for arraymap maps

2020-07-27 Thread Roman Gushchin
Include percpu arrays and auxiliary data into the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/arraymap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c index 8ff419b632a6..9597fecff8da

[PATCH bpf-next v2 01/35] bpf: memcg-based memory accounting for bpf progs

2020-07-27 Thread Roman Gushchin
Include memory used by bpf programs into the memcg-based accounting. This includes the memory used by programs itself, auxiliary data and statistics. Signed-off-by: Roman Gushchin --- kernel/bpf/core.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/bpf/core.c

[PATCH bpf-next v2 06/35] bpf: refine memcg-based memory accounting for devmap maps

2020-07-27 Thread Roman Gushchin
Include map metadata and the node size (struct bpf_dtab_netdev) on element update into the accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/devmap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c index 10abb06065bb

[PATCH bpf-next v2 18/35] bpf: eliminate rlimit-based memory accounting for hashtab maps

2020-07-27 Thread Roman Gushchin
Do not use rlimit-based memory accounting for hashtab maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/hashtab.c | 19 +-- 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/kernel/bpf/hashtab.c b/kernel

[PATCH bpf-next v2 13/35] bpf: eliminate rlimit-based memory accounting for arraymap maps

2020-07-27 Thread Roman Gushchin
Do not use rlimit-based memory accounting for arraymap maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/arraymap.c | 24 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/kernel/bpf/arraymap.c b

[PATCH bpf-next v2 09/35] bpf: memcg-based memory accounting for bpf ringbuffer

2020-07-27 Thread Roman Gushchin
Enable the memcg-based memory accounting for the memory used by the bpf ringbuffer. Signed-off-by: Roman Gushchin --- kernel/bpf/ringbuf.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kernel/bpf/ringbuf.c b/kernel/bpf/ringbuf.c index 002f8a5c9e51..e8e2c39cbdc9

[PATCH bpf-next 04/35] bpf: refine memcg-based memory accounting for cpumap maps

2020-07-24 Thread Roman Gushchin
Include metadata and percpu data into the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/cpumap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c index f1c46529929b..74ae9fcbe82e 100644 --- a/kernel

[PATCH bpf-next 02/35] bpf: memcg-based memory accounting for bpf maps

2020-07-24 Thread Roman Gushchin
This patch enables memcg-based memory accounting for memory allocated by __bpf_map_area_alloc(), which is used by most map types for large allocations. Following patches in the series will refine the accounting for some map types. Signed-off-by: Roman Gushchin --- kernel/bpf/syscall.c | 2

[PATCH bpf-next 07/35] bpf: refine memcg-based memory accounting for hashtab maps

2020-07-24 Thread Roman Gushchin
Include percpu objects and the size of map metadata into the accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/hashtab.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c index 024276787055..9d0432170812 100644

[PATCH bpf-next 13/35] bpf: eliminate rlimit-based memory accounting for arraymap maps

2020-07-24 Thread Roman Gushchin
Do not use rlimit-based memory accounting for arraymap maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/arraymap.c | 24 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/kernel/bpf/arraymap.c b

[PATCH bpf-next 11/35] bpf: refine memcg-based memory accounting for sockmap maps

2020-07-24 Thread Roman Gushchin
Include sockmap internal metadata into the memcg-based memory accounting. Also include the memory allocated on updating an element. Signed-off-by: Roman Gushchin --- net/core/sock_map.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/core/sock_map.c b/net/core

[PATCH bpf-next 00/35] bpf: switch to memcg-based memory accounting

2020-07-24 Thread Roman Gushchin
way to get the current value and statistics. The patchset consists of the following parts: 1) memcg-based accounting for various bpf objects: progs and maps 2) removal of the rlimit-based accounting 3) removal of rlimit adjustments in userspace tools and tests Roman Gushchin (35): bpf: memcg-ba

[PATCH bpf-next 08/35] bpf: memcg-based memory accounting for lpm_trie maps

2020-07-24 Thread Roman Gushchin
Include lpm trie and lpm trie node objects into the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/lpm_trie.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c index 44474bf3ab7a..d85e0fc2cafc

[PATCH bpf-next 16/35] bpf: eliminate rlimit-based memory accounting for cgroup storage maps

2020-07-24 Thread Roman Gushchin
Do not use rlimit-based memory accounting for cgroup storage maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/local_storage.c | 21 + 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/kernel/bpf

[PATCH bpf-next 25/35] bpf: eliminate rlimit-based memory accounting for socket storage maps

2020-07-24 Thread Roman Gushchin
Do not use rlimit-based memory accounting for socket storage maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- net/core/bpf_sk_storage.c | 11 --- 1 file changed, 11 deletions(-) diff --git a/net/core/bpf_sk_storage.c b/net/core

[PATCH bpf-next 20/35] bpf: eliminate rlimit-based memory accounting for queue_stack_maps maps

2020-07-24 Thread Roman Gushchin
Do not use rlimit-based memory accounting for queue_stack maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/queue_stack_maps.c | 16 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/kernel/bpf

[PATCH bpf-next 03/35] bpf: refine memcg-based memory accounting for arraymap maps

2020-07-24 Thread Roman Gushchin
Include percpu arrays and auxiliary data into the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/arraymap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c index 8ff419b632a6..9597fecff8da

[PATCH bpf-next 19/35] bpf: eliminate rlimit-based memory accounting for lpm_trie maps

2020-07-24 Thread Roman Gushchin
Do not use rlimit-based memory accounting for lpm_trie maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/lpm_trie.c | 13 - 1 file changed, 13 deletions(-) diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c index

[PATCH bpf-next 05/35] bpf: memcg-based memory accounting for cgroup storage maps

2020-07-24 Thread Roman Gushchin
Account memory used by cgroup storage maps including the percpu memory for the percpu flavor of cgroup storage and map metadata. Signed-off-by: Roman Gushchin --- kernel/bpf/local_storage.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/kernel/bpf

[PATCH bpf-next 28/35] bpf: eliminate rlimit-based memory accounting for bpf progs

2020-07-24 Thread Roman Gushchin
Do not use rlimit-based memory accounting for bpf progs. It has been replaced with memcg-based memory accounting. Signed-off-by: Roman Gushchin --- include/linux/bpf.h | 11 -- kernel/bpf/core.c| 12 ++- kernel/bpf/syscall.c | 86 ++-- 3

[PATCH bpf-next 18/35] bpf: eliminate rlimit-based memory accounting for hashtab maps

2020-07-24 Thread Roman Gushchin
Do not use rlimit-based memory accounting for hashtab maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/hashtab.c | 19 +-- 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/kernel/bpf/hashtab.c b/kernel

[PATCH bpf-next 10/35] bpf: memcg-based memory accounting for socket storage maps

2020-07-24 Thread Roman Gushchin
Account memory used by the socket storage. Signed-off-by: Roman Gushchin --- net/core/bpf_sk_storage.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c index eafcd15e7dfd..fbcd03cd00d3 100644 --- a/net/core

[PATCH bpf-next 26/35] bpf: eliminate rlimit-based memory accounting for xskmap maps

2020-07-24 Thread Roman Gushchin
Do not use rlimit-based memory accounting for xskmap maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- net/xdp/xskmap.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/net/xdp/xskmap.c b/net/xdp/xskmap.c index

[PATCH bpf-next 35/35] perf: don't touch RLIMIT_MEMLOCK

2020-07-24 Thread Roman Gushchin
Since bpf stopped using memlock rlimit to limit the memory usage, there is no more reason for perf to alter its own limit. Signed-off-by: Roman Gushchin --- tools/perf/builtin-trace.c | 10 -- tools/perf/tests/builtin-test.c | 6 -- tools/perf/util/Build | 1

[PATCH bpf-next 24/35] bpf: eliminate rlimit-based memory accounting for stackmap maps

2020-07-24 Thread Roman Gushchin
Do not use rlimit-based memory accounting for stackmap maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/stackmap.c | 16 +++- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/kernel/bpf/stackmap.c b/kernel

[PATCH bpf-next 23/35] bpf: eliminate rlimit-based memory accounting for sock_map maps

2020-07-24 Thread Roman Gushchin
Do not use rlimit-based memory accounting for sock_map maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- net/core/sock_map.c | 21 ++--- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/net/core/sock_map.c b/net

[PATCH bpf-next 06/35] bpf: refine memcg-based memory accounting for devmap maps

2020-07-24 Thread Roman Gushchin
Include map metadata and the node size (struct bpf_dtab_netdev) on element update into the accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/devmap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c index 10abb06065bb

[PATCH bpf-next 14/35] bpf: eliminate rlimit-based memory accounting for bpf_struct_ops maps

2020-07-24 Thread Roman Gushchin
Do not use rlimit-based memory accounting for bpf_struct_ops maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/bpf_struct_ops.c | 19 +++ 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/kernel/bpf

[PATCH bpf-next 27/35] bpf: eliminate rlimit-based memory accounting infra for bpf maps

2020-07-24 Thread Roman Gushchin
Remove rlimit-based accounting infrastructure code, which is not used anymore. Signed-off-by: Roman Gushchin --- include/linux/bpf.h | 12 kernel/bpf/syscall.c | 64 +-- .../selftests/bpf/progs/map_ptr_kern.c| 5

[PATCH bpf-next 22/35] bpf: eliminate rlimit-based memory accounting for bpf ringbuffer

2020-07-24 Thread Roman Gushchin
a couple of lines in ringbuf_map_alloc() and also makes it look similar to other memory allocating function like kmalloc(). Signed-off-by: Roman Gushchin --- kernel/bpf/ringbuf.c | 24 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/kernel/bpf/ringbuf.c b

[PATCH bpf-next 09/35] bpf: memcg-based memory accounting for bpf ringbuffer

2020-07-24 Thread Roman Gushchin
Enable the memcg-based memory accounting for the memory used by the bpf ringbuffer. Signed-off-by: Roman Gushchin --- kernel/bpf/ringbuf.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kernel/bpf/ringbuf.c b/kernel/bpf/ringbuf.c index 002f8a5c9e51..e8e2c39cbdc9

[PATCH bpf-next 21/35] bpf: eliminate rlimit-based memory accounting for reuseport_array maps

2020-07-24 Thread Roman Gushchin
Do not use rlimit-based memory accounting for reuseport_array maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/reuseport_array.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/kernel/bpf

[PATCH bpf-next 17/35] bpf: eliminate rlimit-based memory accounting for devmap maps

2020-07-24 Thread Roman Gushchin
Do not use rlimit-based memory accounting for devmap maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/devmap.c | 18 ++ 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/kernel/bpf/devmap.c b/kernel/bpf

[PATCH bpf-next 15/35] bpf: eliminate rlimit-based memory accounting for cpumap maps

2020-07-24 Thread Roman Gushchin
Do not use rlimit-based memory accounting for cpumap maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/cpumap.c | 16 +--- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/kernel/bpf/cpumap.c b/kernel/bpf

[PATCH bpf-next 34/35] bpf: samples: do not touch RLIMIT_MEMLOCK

2020-07-24 Thread Roman Gushchin
Since bpf is not using rlimit memlock for the memory accounting and control, do not change the limit in sample applications. Signed-off-by: Roman Gushchin --- samples/bpf/map_perf_test_user.c| 11 --- samples/bpf/offwaketime_user.c | 2 -- samples/bpf/sockex2_user.c

[PATCH bpf-next 30/35] bpf: bpftool: do not touch RLIMIT_MEMLOCK

2020-07-24 Thread Roman Gushchin
Since bpf stopped using memlock rlimit to limit the memory usage, there is no more reason for bpftool to alter its own limits. Signed-off-by: Roman Gushchin --- tools/bpf/bpftool/common.c | 7 --- tools/bpf/bpftool/feature.c| 2 -- tools/bpf/bpftool/main.h | 2 -- tools/bpf

[PATCH bpf-next 31/35] bpf: runqslower: don't touch RLIMIT_MEMLOCK

2020-07-24 Thread Roman Gushchin
Since bpf is not using memlock rlimit for memory accounting, there are no more reasons to bump the limit. Signed-off-by: Roman Gushchin --- tools/bpf/runqslower/runqslower.c | 16 1 file changed, 16 deletions(-) diff --git a/tools/bpf/runqslower/runqslower.c b/tools/bpf

[PATCH bpf-next 32/35] bpf: selftests: delete bpf_rlimit.h

2020-07-24 Thread Roman Gushchin
As rlimit-based memory accounting is not used by bpf anymore, there are no more reasons to play with memlock rlimit. Delete bpf_rlimit.h which contained a code to bump the limit. Signed-off-by: Roman Gushchin --- samples/bpf/hbm.c | 1 - tools/testing/selftests/bpf

[PATCH bpf-next 29/35] bpf: libbpf: cleanup RLIMIT_MEMLOCK usage

2020-07-24 Thread Roman Gushchin
As bpf is not using memlock rlimit for memory accounting anymore, let's remove the related code from libbpf. Bpf operations can't fail because of exceeding the limit anymore. Signed-off-by: Roman Gushchin --- tools/lib/bpf/libbpf.c | 31 +-- tools/lib/bpf/libbpf.h

[PATCH bpf-next 12/35] bpf: refine memcg-based memory accounting for xskmap maps

2020-07-24 Thread Roman Gushchin
Extend xskmap memory accounting to include the memory taken by the xsk_map_node structure. Signed-off-by: Roman Gushchin --- net/xdp/xskmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/xdp/xskmap.c b/net/xdp/xskmap.c index 8367adbbe9df..e574b22defe5 100644

[PATCH bpf-next 33/35] bpf: selftests: don't touch RLIMIT_MEMLOCK

2020-07-24 Thread Roman Gushchin
Since bpf is not using memlock rlimit for memory accounting, there are no more reasons to bump the limit. Signed-off-by: Roman Gushchin --- tools/testing/selftests/bpf/bench.c | 16 --- .../selftests/bpf/progs/bpf_iter_bpf_map.c| 5 ++--- tools/testing/selftests/bpf

[PATCH bpf-next 01/35] bpf: memcg-based memory accounting for bpf progs

2020-07-24 Thread Roman Gushchin
Include memory used by bpf programs into the memcg-based accounting. This includes the memory used by programs itself, auxiliary data and statistics. Signed-off-by: Roman Gushchin --- kernel/bpf/core.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/bpf/core.c

Re: PROBLEM: cgroup cost too much memory when transfer small files to tmpfs

2020-07-21 Thread Roman Gushchin
On Tue, Jul 21, 2020 at 12:12:58PM -0700, Shakeel Butt wrote: > On Tue, Jul 21, 2020 at 11:51 AM Roman Gushchin wrote: > > > > On Tue, Jul 21, 2020 at 01:41:26PM -0400, Johannes Weiner wrote: > > > On Tue, Jul 21, 2020 at 11:19:52AM +, jingrui wrote: > > >

Re: PROBLEM: cgroup cost too much memory when transfer small files to tmpfs

2020-07-21 Thread Roman Gushchin
On Tue, Jul 21, 2020 at 01:41:26PM -0400, Johannes Weiner wrote: > On Tue, Jul 21, 2020 at 11:19:52AM +, jingrui wrote: > > Cc: Johannes Weiner ; Michal Hocko > > ; Vladimir Davydov > > > > Thanks. > > > > --- > > PROBLEM: cgroup cost too much memory when transfer small files to tmpfs. >

Re: [PATCH v2] mm: vmstat: fix /proc/sys/vm/stat_refresh generating false warnings

2020-07-20 Thread Roman Gushchin
On Mon, Jul 20, 2020 at 10:03:49AM +0200, Michal Hocko wrote: > On Tue 14-07-20 10:39:20, Roman Gushchin wrote: > > I've noticed a number of warnings like "vmstat_refresh: nr_free_cma > > -5" or "vmstat_refresh: nr_zone_write_pending -11" on our production >

Re: [PATCH 5.7 021/244] cgroup: fix cgroup_sk_alloc() for sk_clone_lock()

2020-07-20 Thread Roman Gushchin
group") > Reported-by: Cameron Berkenpas > Reported-by: Peter Geis > Reported-by: Lu Fengqi > Reported-by: Daniƫl Sonck > Reported-by: Zhang Qiang > Tested-by: Cameron Berkenpas > Tested-by: Peter Geis > Tested-by: Thomas Lamprecht > Cc: Daniel Borkmann >

Re: [PATCH v7 17/19] mm: memcg/slab: use a single set of kmem_caches for all allocations

2020-07-18 Thread Roman Gushchin
On Sat, Jul 18, 2020 at 10:24:49AM -0700, Guenter Roeck wrote: > On Tue, Jun 23, 2020 at 10:40:35AM -0700, Roman Gushchin wrote: > > Instead of having two sets of kmem_caches: one for system-wide and > > non-accounted allocations and the second one shared by all accounted > >

[PATCH] mm: slab/memcg: fix build on MIPS

2020-07-17 Thread Roman Gushchin
a recursive inlining. The easies way to fix this is to move memcg_alloc_page_obj_cgroups() to memcontrol.c and make it a generic (not static inline) function. It breaks the inlining recursion and fixes the build. Signed-off-by: Roman Gushchin Reported-by: Naresh Kamboju --- mm/memcontrol.c | 20

Re: linux-next: build warning after merge of the akpm-current tree

2020-07-17 Thread Roman Gushchin
On Fri, Jul 17, 2020 at 08:31:27PM +1000, Stephen Rothwell wrote: > Hi all, > > After merging the akpm-current tree, today's linux-next build (powerpc > ppc64_defconfig) produced this warning: > > mm/vmstat.c:614: warning: "MAX_THRESHOLD" redefined > 614 | #define MAX_THRESHOLD 0 > | >

Re: [PATCH v7 08/19] mm: memcg/slab: save obj_cgroup for non-root slab objects

2020-07-16 Thread Roman Gushchin
On Thu, Jul 16, 2020 at 10:25:01PM +0530, Naresh Kamboju wrote: > On Tue, 23 Jun 2020 at 23:11, Roman Gushchin wrote: > > > > Store the obj_cgroup pointer in the corresponding place of > > page->obj_cgroups for each allocated non-root slab object. Make sure that > &g

Re: [PATCH v3] mm: memcg/slab: fix memory leak at non-root kmem_cache destroy

2020-07-16 Thread Roman Gushchin
> So only when refcount reach zero, we mark the root kmem_cache as dying. > > > > Fixes: 92ee383f6daa ("mm: fix race between kmem_cache destroy, create and > > deactivate") > > Signed-off-by: Muchun Song > > Reviewed-by: Shakeel Butt > >

Re: [External] Re: [PATCH v2] mm: memcg/slab: fix memory leak at non-root kmem_cache destroy

2020-07-16 Thread Roman Gushchin
On Thu, Jul 16, 2020 at 11:54:37PM +0800, Muchun Song wrote: > On Thu, Jul 16, 2020 at 11:46 PM Roman Gushchin wrote: > > > > On Thu, Jul 16, 2020 at 01:07:02PM +0800, Muchun Song wrote: > > > On Thu, Jul 16, 2020 at 1:54 AM Roman Gushchin wrote: > > > > &

Re: [External] Re: [PATCH v2] mm: memcg/slab: fix memory leak at non-root kmem_cache destroy

2020-07-16 Thread Roman Gushchin
On Thu, Jul 16, 2020 at 01:07:02PM +0800, Muchun Song wrote: > On Thu, Jul 16, 2020 at 1:54 AM Roman Gushchin wrote: > > > > On Thu, Jul 16, 2020 at 12:50:22AM +0800, Muchun Song wrote: > > > If the kmem_cache refcount is greater than one, we should not > > >

Re: [PATCH v2] mm: memcg/slab: fix memory leak at non-root kmem_cache destroy

2020-07-15 Thread Roman Gushchin
On Thu, Jul 16, 2020 at 12:50:22AM +0800, Muchun Song wrote: > If the kmem_cache refcount is greater than one, we should not > mark the root kmem_cache as dying. If we mark the root kmem_cache > dying incorrectly, the non-root kmem_cache can never be destroyed. > It resulted in memory leak when

Re: [PATCH v5.4.y, v4.19.y] mm: memcg/slab: fix memory leak at non-root kmem_cache destroy

2020-07-15 Thread Roman Gushchin
On Wed, Jul 15, 2020 at 01:32:00PM +0200, Vlastimil Babka wrote: > On 7/7/20 8:27 AM, Muchun Song wrote: > > If the kmem_cache refcount is greater than one, we should not > > mark the root kmem_cache as dying. If we mark the root kmem_cache > > dying incorrectly, the non-root kmem_cache can never

Re: [PATCH v2] mm/percpu: fix 'defined but not used' warning

2020-07-14 Thread Roman Gushchin
pu_chunk *chunk) > ^~~ > > Add 'inline' to pcpu_chunk_type(),pcpu_is_memcg_chunk() and > pcpu_chunk_list() to clear warning. Acked-by: Roman Gushchin Thank you! > > Fixes: 26c99879ef01 ("mm: memcg/percpu: account percpu memory t

Re: [PATCH] mm: vmstat: fix /proc/sys/vm/stat_refresh generating false warnings

2020-07-14 Thread Roman Gushchin
On Tue, Jul 14, 2020 at 10:37:47AM -0700, Roman Gushchin wrote: > I've noticed a number of warnings like "vmstat_refresh: nr_free_cma > -5" or "vmstat_refresh: nr_zone_write_pending -11" on our production > hosts. The numbers of these warnings were relatively low an

[PATCH v2] mm: vmstat: fix /proc/sys/vm/stat_refresh generating false warnings

2020-07-14 Thread Roman Gushchin
e drift value, which is 125 * number of online CPUs. It will still allow to catch systematic leaks, but will not generate bogus warnings. Signed-off-by: Roman Gushchin Cc: Hugh Dickins --- Documentation/admin-guide/sysctl/vm.rst | 4 ++-- mm/vmstat.c | 30

[PATCH] mm: vmstat: fix /proc/sys/vm/stat_refresh generating false warnings

2020-07-14 Thread Roman Gushchin
e drift value, which is 125 * number of online CPUs. It will still allow to catch systematic leaks, but will not generate bogus warnings. Signed-off-by: Roman Gushchin Cc: Hugh Dickins Signed-off-by: Roman Gushchin --- Documentation/admin-guide/sysctl/vm.rst | 4 ++-- mm/vmstat.c

Re: [PATCH] mm: vmscan: consistent update to pgrefill

2020-07-10 Thread Roman Gushchin
stat. > > Signed-off-by: Shakeel Butt So you went into the opposite direction from the "previous version" ( https://lkml.org/lkml/2020/5/7/1464 ) ? Acked-by: Roman Gushchin Thanks!

Re: [PATCH] mm: memcontrol: avoid workload stalls when lowering memory.high

2020-07-10 Thread Roman Gushchin
On Fri, Jul 10, 2020 at 12:19:37PM -0700, Shakeel Butt wrote: > On Fri, Jul 10, 2020 at 11:42 AM Roman Gushchin wrote: > > > > On Fri, Jul 10, 2020 at 07:12:22AM -0700, Shakeel Butt wrote: > > > On Fri, Jul 10, 2020 at 5:29 AM Michal Hocko wrote: > > > > >

Re: [PATCH] mm: memcontrol: avoid workload stalls when lowering memory.high

2020-07-10 Thread Roman Gushchin
On Fri, Jul 10, 2020 at 07:12:22AM -0700, Shakeel Butt wrote: > On Fri, Jul 10, 2020 at 5:29 AM Michal Hocko wrote: > > > > On Thu 09-07-20 12:47:18, Roman Gushchin wrote: > > > Memory.high limit is implemented in a way such that the kernel > > > penalizes

Re: [PATCH v3] mm/hugetlb: avoid hardcoding while checking if cma is enable

2020-07-08 Thread Roman Gushchin
On Wed, Jul 08, 2020 at 10:45:16AM -0700, Mike Kravetz wrote: > On 7/7/20 12:56 PM, Andrew Morton wrote: > > On Tue, 7 Jul 2020 16:02:04 +1200 Barry Song > > wrote: > > > >> hugetlb_cma[0] can be NULL due to various reasons, for example, node0 has > >> no memory. so NULL hugetlb_cma[0] doesn't

[PATCH 2/3] mm: slab: rename (un)charge_slab_page() to (un)account_slab_page()

2020-07-07 Thread Roman Gushchin
charge_slab_page() and uncharge_slab_page() are not related anymore to memcg charging and uncharging. In order to make their names less confusing, let's rename them to account_slab_page() and unaccount_slab_page() respectively. Signed-off-by: Roman Gushchin --- mm/slab.c | 4 ++-- mm/slab.h | 8

[PATCH 1/3] mm: memcg/slab: remove unused argument by charge_slab_page()

2020-07-07 Thread Roman Gushchin
charge_slab_page() is not using the gfp argument anymore, remove it. Signed-off-by: Roman Gushchin --- mm/slab.c | 2 +- mm/slab.h | 3 +-- mm/slub.c | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/mm/slab.c b/mm/slab.c index 2850fe3c5fb8..fafd46877504 100644 --- a/mm

[PATCH 3/3] mm: kmem: switch to static_branch_likely() in memcg_kmem_enabled()

2020-07-07 Thread Roman Gushchin
. Signed-off-by: Roman Gushchin --- include/linux/memcontrol.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index b8f52a3fed90..ab9322215b2e 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1456,7

Re: [PATCH v2] mm/hugetlb: avoid hardcoding while checking if cma is enable

2020-07-06 Thread Roman Gushchin
gt; > Fixes: cf11e85fc08c ("mm: hugetlb: optionally allocate gigantic hugepages > using cma") > Cc: Roman Gushchin > Cc: Mike Kravetz > Cc: Jonathan Cameron > Signed-off-by: Barry Song > --- > -v2: add hugetlb_cma_enabled() helper to improve readability

Re: [PATCH] mm/hugetlb: avoid hardcoding while checking if cma is reserved

2020-07-06 Thread Roman Gushchin
On Mon, Jul 06, 2020 at 10:30:40PM +, Song Bao Hua (Barry Song) wrote: > > > > -Original Message- > > From: Song Bao Hua (Barry Song) > > Sent: Tuesday, July 7, 2020 10:12 AM > > To: 'Roman Gushchin' > > Cc: a...@linux-foundation.org;

Re: [PATCH] mm/hugetlb: avoid hardcoding while checking if cma is reserved

2020-07-06 Thread Roman Gushchin
her nodes. Just curious, is it a real-life problem you've seen? If so, I wonder how you're using the hugetlb_cma option, and what's the outcome? > > Fixes: cf11e85fc08c ("mm: hugetlb: optionally allocate gigantic hugepages > using cma") > Cc: Roman Gushchin > Cc: Mike Kravetz

Re: [RFC PROPOSAL] memcg: per-memcg user space reclaim interface

2020-07-06 Thread Roman Gushchin
On Fri, Jul 03, 2020 at 09:27:19AM -0700, Shakeel Butt wrote: > On Fri, Jul 3, 2020 at 8:50 AM Roman Gushchin wrote: > > > > On Fri, Jul 03, 2020 at 07:23:14AM -0700, Shakeel Butt wrote: > > > On Thu, Jul 2, 2020 at 11:35 PM Michal Hocko wrote: > > > > >

Re: [RFC PROPOSAL] memcg: per-memcg user space reclaim interface

2020-07-03 Thread Roman Gushchin
On Fri, Jul 03, 2020 at 07:23:14AM -0700, Shakeel Butt wrote: > On Thu, Jul 2, 2020 at 11:35 PM Michal Hocko wrote: > > > > On Thu 02-07-20 08:22:22, Shakeel Butt wrote: > > [...] > > > Interface options: > > > -- > > > > > > 1) memcg interface e.g. 'echo 10M > memory.reclaim' > >

Re: [PATCH v2] mm: kmem: make memcg_kmem_enabled() irreversible

2020-07-02 Thread Roman Gushchin
On Thu, Jul 02, 2020 at 11:09:26AM -0700, Roman Gushchin wrote: > Historically the kernel memory accounting was an opt-in feature, which > could be enabled for individual cgroups. But now it's not true, and > it's on by default both on cgroup v1 and cgroup v2. And as long as a > user

Re: BUG: Bad page state in process - page dumped because: page still charged to cgroup

2020-07-02 Thread Roman Gushchin
On Thu, Jul 02, 2020 at 07:13:02PM +0200, Michal Hocko wrote: > On Thu 02-07-20 09:37:38, Roman Gushchin wrote: > > On Thu, Jul 02, 2020 at 06:22:02PM +0200, Michal Hocko wrote: > > > On Wed 01-07-20 11:45:52, Roman Gushchin wrote: > > > [...] > > > > >Fro

Re: BUG: Bad page state in process - page dumped because: page still charged to cgroup

2020-07-02 Thread Roman Gushchin
On Thu, Jul 02, 2020 at 06:35:31PM +0200, Vlastimil Babka wrote: > On 7/2/20 6:22 PM, Michal Hocko wrote: > > On Wed 01-07-20 11:45:52, Roman Gushchin wrote: > > [...] > >> >From c97afecd32c0db5e024be9ba72f43d22974f5bcd Mon Sep 17 00:00:00 2001 > >> From: Roman

Re: BUG: Bad page state in process - page dumped because: page still charged to cgroup

2020-07-02 Thread Roman Gushchin
On Thu, Jul 02, 2020 at 06:22:02PM +0200, Michal Hocko wrote: > On Wed 01-07-20 11:45:52, Roman Gushchin wrote: > [...] > > >From c97afecd32c0db5e024be9ba72f43d22974f5bcd Mon Sep 17 00:00:00 2001 > > From: Roman Gushchin > > Date: Wed, 1 Jul 2020 11:05:32 -0700 > >

Re: BUG: Bad page state in process - page dumped because: page still charged to cgroup

2020-07-02 Thread Roman Gushchin
On Thu, Jul 02, 2020 at 09:25:08PM +0530, Naresh Kamboju wrote: > On Thu, 2 Jul 2020 at 21:19, Roman Gushchin wrote: > > > > On Thu, Jul 02, 2020 at 12:22:03PM +0530, Naresh Kamboju wrote: > > > On Thu, 2 Jul 2020 at 00:16, Roman Gushchin wrote: > > > > > &

Re: BUG: Bad page state in process - page dumped because: page still charged to cgroup

2020-07-02 Thread Roman Gushchin
On Thu, Jul 02, 2020 at 12:22:03PM +0530, Naresh Kamboju wrote: > On Thu, 2 Jul 2020 at 00:16, Roman Gushchin wrote: > > > > On Wed, Jul 01, 2020 at 10:29:04AM +0200, Michal Hocko wrote: > > > Smells like a different observable problem with the same/similar culp

Re: BUG: Bad page state in process - page dumped because: page still charged to cgroup

2020-07-01 Thread Roman Gushchin
; > 5.8.0-rc3-next-20200630 #1 > > [ 807.607727] Hardware name: Supermicro SYS-5019S-ML/X11SSH-F, BIOS > > 2.0b 07/27/2017 > > [ 807.607731] Workqueue: rpciod rpc_async_schedule > > [ 807.611836] flags: 0x201(head) > > [ 807.619563] Call Trace: > &g

<    3   4   5   6   7   8   9   10   11   12   >