Re: [PATCH bpf-next v3 1/4] bpf: remove __rcu annotations from bpf_prog_array

2019-05-28 Thread Roman Gushchin
* > kernel/bpf/core.c:1935:26: warning: incorrect type in assignment (different > address spaces) > kernel/bpf/core.c:1935:26:expected struct bpf_prog_array_item *[assigned] > existing > kernel/bpf/core.c:1935:26:got struct bpf_prog_array_item [noderef] > * > > v2: > * r

Re: [PATCH bpf-next v3 3/4] bpf: cgroup: properly use bpf_prog_array api

2019-05-28 Thread Roman Gushchin
s on cgroup_bpf.inactive since > it's not read/updated concurrently. > > v3: > * amend cgroup_rcu_dereference to include percpu_ref_is_dying; > cgroup_bpf is now reference counted and we don't hold cgroup_mutex > anymore in cgroup_bpf_release > > v2: > * replace

Re: [PATCH bpf-next v3 3/4] bpf: cgroup: properly use bpf_prog_array api

2019-05-28 Thread Roman Gushchin
s on cgroup_bpf.inactive since > it's not read/updated concurrently. > > v3: > * amend cgroup_rcu_dereference to include percpu_ref_is_dying; > cgroup_bpf is now reference counted and we don't hold cgroup_mutex > anymore in cgroup_bpf_release > > v2: > * replace

Re: [PATCH bpf-next v3 3/4] bpf: cgroup: properly use bpf_prog_array api

2019-05-28 Thread Roman Gushchin
On Tue, May 28, 2019 at 01:16:46PM -0700, Stanislav Fomichev wrote: > On 05/28, Roman Gushchin wrote: > > On Tue, May 28, 2019 at 11:29:45AM -0700, Stanislav Fomichev wrote: > > > Now that we don't have __rcu markers on the bpf_prog_array helpers, > > > let's

Re: [PATCH bpf-next v4 3/4] bpf: cgroup: properly use bpf_prog_array api

2019-05-28 Thread Roman Gushchin
_dereference to include percpu_ref_is_dying; > cgroup_bpf is now reference counted and we don't hold cgroup_mutex > anymore in cgroup_bpf_release > > v2: > * replace xchg with rcu_swap_protected > > Cc: Roman Gushchin > Signed-off-by: Stanislav Fomichev Yeah, the looks even better. Acked-by: Roman Gushchin Thanks!

Re: [PATCH v4 bpf-next 0/2] bpf: Add a new API

2019-06-07 Thread Roman Gushchin
On 06/07/2019 06:37 PM, Hechao Li wrote: > Getting number of possible CPUs is commonly used for per-CPU BPF maps > and perf_event_maps. Add a new API libbpf_num_possible_cpus() that > helps user with per-CPU related operations and remove duplicate > implementations in bpftool and selftests. > > v4

Re: [PATCH] mm: net: memcg accounting for TCP rx zerocopy

2021-01-12 Thread Roman Gushchin
On Tue, Jan 12, 2021 at 01:41:05PM -0800, Shakeel Butt wrote: > From: Arjun Roy > > TCP zerocopy receive is used by high performance network applications to > further scale. For RX zerocopy, the memory containing the network data > filled by network driver is directly mapped into the address spac

Re: [PATCH] mm: net: memcg accounting for TCP rx zerocopy

2021-01-12 Thread Roman Gushchin
On Tue, Jan 12, 2021 at 03:36:18PM -0800, Arjun Roy wrote: > On Tue, Jan 12, 2021 at 3:31 PM Roman Gushchin wrote: > > > > On Tue, Jan 12, 2021 at 01:41:05PM -0800, Shakeel Butt wrote: > > > From: Arjun Roy > > > > > > TCP zerocopy receive is used b

Re: [PATCH] mm: net: memcg accounting for TCP rx zerocopy

2021-01-13 Thread Roman Gushchin
On Tue, Jan 12, 2021 at 04:18:44PM -0800, Shakeel Butt wrote: > On Tue, Jan 12, 2021 at 4:12 PM Arjun Roy wrote: > > > > On Tue, Jan 12, 2021 at 3:48 PM Roman Gushchin wrote: > > > > [snip] > > > Historically we have a corresponding vmstat counter to ea

Re: [PATCH] mm: net: memcg accounting for TCP rx zerocopy

2021-01-13 Thread Roman Gushchin
On Tue, Jan 12, 2021 at 04:12:08PM -0800, Arjun Roy wrote: > On Tue, Jan 12, 2021 at 3:48 PM Roman Gushchin wrote: > > > > On Tue, Jan 12, 2021 at 03:36:18PM -0800, Arjun Roy wrote: > > > On Tue, Jan 12, 2021 at 3:31 PM Roman Gushchin wrote: > > > > > &

Re: [PATCH] mm: net: memcg accounting for TCP rx zerocopy

2021-01-19 Thread Roman Gushchin
gt; > > > On Wed, Jan 13, 2021 at 10:43 AM Roman Gushchin wrote: > > > > > > > > > > On Tue, Jan 12, 2021 at 04:18:44PM -0800, Shakeel Butt wrote: > > > > > > On Tue, Jan 12, 2021 at 4:12 PM Arjun Roy > >

Re: linux-next: manual merge of the akpm-current tree with the bpf-next tree

2020-12-14 Thread Roman Gushchin
On Tue, Dec 15, 2020 at 07:21:56AM +1100, Stephen Rothwell wrote: > Hi all, > > On Fri, 4 Dec 2020 20:20:05 +1100 Stephen Rothwell > wrote: > > > > Today's linux-next merge of the akpm-current tree got conflicts in: > > > > include/linux/memcontrol.h > > mm/memcontrol.c > > > > between com

[PATCH bpf-next v9 28/34] bpf: eliminate rlimit-based memory accounting for sockmap and sockhash maps

2020-12-01 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 Acked-by: Song Liu --- net/core/sock_map.c | 33 ++--- 1 file changed, 6 insertions(+), 27 deletions

[PATCH bpf-next v9 05/34] bpf: memcg-based memory accounting for bpf progs

2020-12-01 Thread Roman Gushchin
Include memory used by bpf programs into the memcg-based accounting. This includes the memory used by programs itself, auxiliary data, statistics and bpf line info. A memory cgroup containing the process which loads the program is getting charged. Signed-off-by: Roman Gushchin Acked-by: Song Liu

[PATCH bpf-next v9 04/34] mm: convert page kmemcg type to a page memcg flag

2020-12-01 Thread Roman Gushchin
//lkml.kernel.org/r/20201027001657.3398190-5-g...@fb.com Signed-off-by: Roman Gushchin Acked-by: Johannes Weiner Reviewed-by: Shakeel Butt Acked-by: Michal Hocko Signed-off-by: Andrew Morton --- include/linux/memcontrol.h | 37 + include/linux/page-flags.h | 11 ++---

[PATCH bpf-next v9 20/34] bpf: eliminate rlimit-based memory accounting for cpumap maps

2020-12-01 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 Acked-by: Song Liu --- kernel/bpf/cpumap.c | 16 +--- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/kernel/bpf

[PATCH bpf-next v9 33/34] bpf: eliminate rlimit-based memory accounting for bpf progs

2020-12-01 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 Acked-by: Song Liu --- include/linux/bpf.h | 11 --- kernel/bpf/core.c| 12 ++-- kernel/bpf/syscall.c | 69

[PATCH bpf-next v9 26/34] bpf: eliminate rlimit-based memory accounting for reuseport_array maps

2020-12-01 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 Acked-by: Song Liu --- kernel/bpf/reuseport_array.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a

[PATCH bpf-next v9 23/34] bpf: eliminate rlimit-based memory accounting for hashtab maps

2020-12-01 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 Acked-by: Song Liu --- kernel/bpf/hashtab.c | 19 +-- 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/kernel/bpf

[PATCH bpf-next v9 17/34] bpf: refine memcg-based memory accounting for xskmap maps

2020-12-01 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 66231ba6c348..9fff1e6dc9cd 100644 --- a

[PATCH bpf-next v9 06/34] bpf: prepare for memcg-based memory accounting for bpf maps

2020-12-01 Thread Roman Gushchin
l active memory cgroup. These helpers are supposed to use everywhere except the map creation path. During the map creation when the map structure is allocated by itself, it cannot be passed to those helpers. In those cases default memory allocation function will be used with the __GFP_ACCOU

[PATCH bpf-next v9 11/34] bpf: refine memcg-based memory accounting for devmap maps

2020-12-01 Thread Roman Gushchin
Include map metadata and the node size (struct bpf_dtab_netdev) into the accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/devmap.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c index 2b5ca93c17de..b43ab247302d 100644

[PATCH bpf-next v9 09/34] bpf: refine memcg-based memory accounting for cpumap maps

2020-12-01 Thread Roman Gushchin
Include metadata and percpu data into the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/cpumap.c | 21 - 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c index c61a23b564aa..90b94905

[PATCH bpf-next v9 25/34] bpf: eliminate rlimit-based memory accounting for queue_stack_maps maps

2020-12-01 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 Acked-by: Song Liu --- kernel/bpf/queue_stack_maps.c | 16 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a

[PATCH bpf-next v9 12/34] bpf: refine memcg-based memory accounting for hashtab maps

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

[PATCH bpf-next v9 32/34] bpf: eliminate rlimit-based memory accounting infra for bpf maps

2020-12-01 Thread Roman Gushchin
nd key and value sizes. Signed-off-by: Roman Gushchin Acked-by: Song Liu --- include/linux/bpf.h | 12 --- kernel/bpf/syscall.c | 96 --- .../selftests/bpf/progs/bpf_iter_bpf_map.c| 2 +- .../selftests/bpf/progs/map_

[PATCH bpf-next v9 13/34] bpf: memcg-based memory accounting for lpm_trie maps

2020-12-01 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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c index 00e32f2ec3e6..1a6981203d7f

[PATCH bpf-next v9 19/34] bpf: eliminate rlimit-based memory accounting for bpf_struct_ops maps

2020-12-01 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 Acked-by: Song Liu --- kernel/bpf/bpf_struct_ops.c | 19 +++ 1 file changed, 3 insertions(+), 16 deletions(-) diff

[PATCH bpf-next v9 30/34] bpf: eliminate rlimit-based memory accounting for xskmap maps

2020-12-01 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 Acked-by: Song Liu --- net/xdp/xskmap.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/net/xdp/xskmap.c b/net

[PATCH bpf-next v9 07/34] bpf: memcg-based memory accounting for bpf maps

2020-12-01 Thread Roman Gushchin
memory cgroup to the map's memory cgroup. Following patches in the series will refine the accounting for some of the map types. Signed-off-by: Roman Gushchin --- kernel/bpf/syscall.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/bpf/syscall.c b/kernel/bpf/sysc

[PATCH bpf-next v9 03/34] mm: introduce page memcg flags

2020-12-01 Thread Roman Gushchin
might be added later. Link: https://lkml.kernel.org/r/20201027001657.3398190-4-g...@fb.com Signed-off-by: Roman Gushchin Reviewed-by: Shakeel Butt Acked-by: Johannes Weiner Acked-by: Michal Hocko Signed-off-by: Andrew Morton --- include/linux/memcontrol.h | 32

[PATCH bpf-next v9 22/34] bpf: eliminate rlimit-based memory accounting for devmap maps

2020-12-01 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 Acked-by: Song Liu --- kernel/bpf/devmap.c | 18 ++ 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/kernel/bpf

[PATCH bpf-next v9 21/34] bpf: eliminate rlimit-based memory accounting for cgroup storage maps

2020-12-01 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 Acked-by: Song Liu --- kernel/bpf/local_storage.c | 21 + 1 file changed, 1 insertion(+), 20 deletions(-) diff

[PATCH bpf-next v9 29/34] bpf: eliminate rlimit-based memory accounting for stackmap maps

2020-12-01 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 Acked-by: Song Liu --- kernel/bpf/stackmap.c | 16 +++- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/kernel/bpf

[PATCH bpf-next v9 15/34] bpf: memcg-based memory accounting for bpf local storage maps

2020-12-01 Thread Roman Gushchin
Account memory used by bpf local storage maps: per-socket, per-inode and per-task storages. Signed-off-by: Roman Gushchin --- kernel/bpf/bpf_local_storage.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/kernel/bpf/bpf_local_storage.c b/kernel/bpf

[PATCH bpf-next v9 16/34] bpf: refine memcg-based memory accounting for sockmap and sockhash maps

2020-12-01 Thread Roman Gushchin
Include 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 | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/net/core/sock_map.c b/net/core

[PATCH bpf-next v9 18/34] bpf: eliminate rlimit-based memory accounting for arraymap maps

2020-12-01 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 Acked-by: Song Liu --- kernel/bpf/arraymap.c | 24 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a

[PATCH bpf-next v9 08/34] bpf: refine memcg-based memory accounting for arraymap maps

2020-12-01 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 c6c81eceb68f..d837e0603c89

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

2020-12-01 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 Acked-by: Song Liu --- samples/bpf/map_perf_test_user.c| 6 -- samples/bpf/offwaketime_user.c | 6 -- samples/bpf

[PATCH bpf-next v9 14/34] bpf: memcg-based memory accounting for bpf ringbuffer

2020-12-01 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 | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/kernel/bpf/ringbuf.c b/kernel/bpf/ringbuf.c index 31cb04a4dd2d..8983a46f6580

[PATCH bpf-next v9 10/34] bpf: memcg-based memory accounting for cgroup storage maps

2020-12-01 Thread Roman Gushchin
Account memory used by cgroup storage maps including metadata structures. Account the percpu memory for the percpu flavor of cgroup storage. Signed-off-by: Roman Gushchin --- kernel/bpf/local_storage.c | 23 +++ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git

[PATCH bpf-next v9 27/34] bpf: eliminate rlimit-based memory accounting for bpf ringbuffer

2020-12-01 Thread Roman Gushchin
rop 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 Acked-by: Song Liu Acked-by: Andrii Nakryiko --- kernel/bpf/ringbuf.c | 24 1 file changed, 4 insertions(+

[PATCH bpf-next v9 24/34] bpf: eliminate rlimit-based memory accounting for lpm_trie maps

2020-12-01 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 Acked-by: Song Liu --- kernel/bpf/lpm_trie.c | 13 - 1 file changed, 13 deletions(-) diff --git a/kernel/bpf/lpm_trie.c b/kernel

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

2020-12-01 Thread Roman Gushchin
rlimit-based accounting for sockhash maps Roman Gushchin (34): mm: memcontrol: use helpers to read page's memcg data mm: memcontrol/slab: use helpers to access slab page's memcg_data mm: introduce page memcg flags mm: convert page kmemcg type to a page memcg flag bpf:

[PATCH bpf-next v9 01/34] mm: memcontrol: use helpers to read page's memcg data

2020-12-01 Thread Roman Gushchin
age not being a slab page. To make sure nobody uses a direct access, struct page's mem_cgroup/obj_cgroups is converted to unsigned long memcg_data. Link: https://lkml.kernel.org/r/20201027001657.3398190-1-g...@fb.com Link: https://lkml.kernel.org/r/20201027001657.3398190-2-g...@fb.com Signed-off-

[PATCH bpf-next v9 31/34] bpf: eliminate rlimit-based memory accounting for bpf local storage maps

2020-12-01 Thread Roman Gushchin
Do not use rlimit-based memory accounting for bpf local storage maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin Acked-by: Song Liu --- kernel/bpf/bpf_local_storage.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/kernel/bpf

[PATCH bpf-next v9 02/34] mm: memcontrol/slab: use helpers to access slab page's memcg_data

2020-12-01 Thread Roman Gushchin
truct page *page, struct obj_cgroup **objcgs); They are similar to the corresponding API for generic pages, except that the setter can return false, indicating that the value has been already set from a different thread. Link: https://lkml.kernel.org/r/20201027001657.3398190-3-g...@fb.com Signed-off

Re: [PATCH bpf-next v9 00/34] bpf: switch to memcg-based memory accounting

2020-12-02 Thread Roman Gushchin
On Wed, Dec 02, 2020 at 06:54:46PM -0800, Alexei Starovoitov wrote: > On Tue, Dec 1, 2020 at 1:59 PM Roman Gushchin wrote: > > > > 5) Cryptic -EPERM is returned on exceeding the limit. Libbpf even had > >a function to "explain" this case for users. > ...

Re: [PATCH bpf-next] bpf: avoid overflows involving hash elem_size

2020-12-07 Thread Roman Gushchin
d93fbc19c0 R15: 00000119bf2c > > Fixes: 755e5d55367a ("bpf: Eliminate rlimit-based memory accounting for > hashtab maps") > Signed-off-by: Eric Dumazet > Reported-by: syzbot > Cc: Roman Gushchin > --- Good catch, thank you! Acked-by: Roman Gushchin It looks like there are a couple more places like this, I'll check them and send a separate patch. Thanks!

Re: [PATCH bpf-next v6 06/34] bpf: prepare for memcg-based memory accounting for bpf maps

2020-11-18 Thread Roman Gushchin
On Wed, Nov 18, 2020 at 11:22:55AM +0100, Daniel Borkmann wrote: > On 11/18/20 2:28 AM, Roman Gushchin wrote: > > On Tue, Nov 17, 2020 at 05:11:00PM -0800, Alexei Starovoitov wrote: > > > On Tue, Nov 17, 2020 at 5:07 PM Roman Gushchin wrote: > > > > On Tue, Nov 17, 2

[PATCH bpf-next v7 14/34] bpf: memcg-based memory accounting for bpf ringbuffer

2020-11-19 Thread Roman Gushchin
Enable the memcg-based memory accounting for the memory used by the bpf ringbuffer. Signed-off-by: Roman Gushchin Acked-by: Song Liu --- 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

[PATCH bpf-next v7 24/34] bpf: eliminate rlimit-based memory accounting for lpm_trie maps

2020-11-19 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 Acked-by: Song Liu --- kernel/bpf/lpm_trie.c | 13 - 1 file changed, 13 deletions(-) diff --git a/kernel/bpf/lpm_trie.c b/kernel

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

2020-11-19 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 Acked-by: Song Liu --- samples/bpf/map_perf_test_user.c| 6 -- samples/bpf/offwaketime_user.c | 6 -- samples/bpf

[PATCH bpf-next v7 27/34] bpf: eliminate rlimit-based memory accounting for bpf ringbuffer

2020-11-19 Thread Roman Gushchin
rop 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 Acked-by: Song Liu Acked-by: Andrii Nakryiko --- kernel/bpf/ringbuf.c | 24 1 file changed, 4 insertions(+

[PATCH bpf-next v7 10/34] bpf: memcg-based memory accounting for cgroup storage maps

2020-11-19 Thread Roman Gushchin
Account memory used by cgroup storage maps including metadata structures. Account the percpu memory for the percpu flavor of cgroup storage. Signed-off-by: Roman Gushchin --- kernel/bpf/local_storage.c | 22 ++ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a

[PATCH bpf-next v7 28/34] bpf: eliminate rlimit-based memory accounting for sockmap and sockhash maps

2020-11-19 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 Acked-by: Song Liu --- net/core/sock_map.c | 33 ++--- 1 file changed, 6 insertions(+), 27 deletions

[PATCH bpf-next v7 17/34] bpf: refine memcg-based memory accounting for xskmap maps

2020-11-19 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/xdp/xskmap.c b/net/xdp/xskmap.c index 49da2b8ace8b..eceea51182d9 100644 --- a

[PATCH bpf-next v7 26/34] bpf: eliminate rlimit-based memory accounting for reuseport_array maps

2020-11-19 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 Acked-by: Song Liu --- kernel/bpf/reuseport_array.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a

[PATCH bpf-next v7 23/34] bpf: eliminate rlimit-based memory accounting for hashtab maps

2020-11-19 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 Acked-by: Song Liu --- kernel/bpf/hashtab.c | 19 +-- 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/kernel/bpf

[PATCH bpf-next v7 33/34] bpf: eliminate rlimit-based memory accounting for bpf progs

2020-11-19 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 Acked-by: Song Liu --- include/linux/bpf.h | 11 -- kernel/bpf/core.c| 12 ++- kernel/bpf/syscall.c | 86

[PATCH bpf-next v7 31/34] bpf: eliminate rlimit-based memory accounting for bpf local storage maps

2020-11-19 Thread Roman Gushchin
Do not use rlimit-based memory accounting for bpf local storage maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin Acked-by: Song Liu --- kernel/bpf/bpf_local_storage.c | 11 --- 1 file changed, 11 deletions(-) diff --git a/kernel/bpf

[PATCH bpf-next v7 29/34] bpf: eliminate rlimit-based memory accounting for stackmap maps

2020-11-19 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 Acked-by: Song Liu --- kernel/bpf/stackmap.c | 16 +++- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/kernel/bpf

[PATCH bpf-next v7 25/34] bpf: eliminate rlimit-based memory accounting for queue_stack_maps maps

2020-11-19 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 Acked-by: Song Liu --- kernel/bpf/queue_stack_maps.c | 16 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a

[PATCH bpf-next v7 16/34] bpf: refine memcg-based memory accounting for sockmap and sockhash maps

2020-11-19 Thread Roman Gushchin
Include 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 | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/net/core/sock_map.c b/net/core

[PATCH bpf-next v7 19/34] bpf: eliminate rlimit-based memory accounting for bpf_struct_ops maps

2020-11-19 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 Acked-by: Song Liu --- kernel/bpf/bpf_struct_ops.c | 19 +++ 1 file changed, 3 insertions(+), 16 deletions(-) diff

[PATCH bpf-next v7 22/34] bpf: eliminate rlimit-based memory accounting for devmap maps

2020-11-19 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 Acked-by: Song Liu --- kernel/bpf/devmap.c | 18 ++ 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/kernel/bpf

[PATCH bpf-next v7 21/34] bpf: eliminate rlimit-based memory accounting for cgroup storage maps

2020-11-19 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 Acked-by: Song Liu --- kernel/bpf/local_storage.c | 21 + 1 file changed, 1 insertion(+), 20 deletions(-) diff

[PATCH bpf-next v7 15/34] bpf: memcg-based memory accounting for bpf local storage maps

2020-11-19 Thread Roman Gushchin
Account memory used by bpf local storage maps: per-socket, per-inode and per-task storages. Signed-off-by: Roman Gushchin --- kernel/bpf/bpf_local_storage.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/kernel/bpf/bpf_local_storage.c b/kernel/bpf

[PATCH bpf-next v7 20/34] bpf: eliminate rlimit-based memory accounting for cpumap maps

2020-11-19 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 Acked-by: Song Liu --- kernel/bpf/cpumap.c | 16 +--- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/kernel/bpf

[PATCH bpf-next v7 09/34] bpf: refine memcg-based memory accounting for cpumap maps

2020-11-19 Thread Roman Gushchin
Include metadata and percpu data into the memcg-based memory accounting. Switch allocations made from an update path to new bpf_map_* allocation helpers to make the accounting work properly from an interrupt context. Signed-off-by: Roman Gushchin --- kernel/bpf/cpumap.c | 23

[PATCH bpf-next v7 12/34] bpf: refine memcg-based memory accounting for hashtab maps

2020-11-19 Thread Roman Gushchin
Include percpu objects and the size of map metadata into the accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/hashtab.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c index ec46266aaf1c..2b8bbdbec872 100644

[PATCH bpf-next v7 11/34] bpf: refine memcg-based memory accounting for devmap maps

2020-11-19 Thread Roman Gushchin
Include map metadata and the node size (struct bpf_dtab_netdev) into the accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/devmap.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c index 2b5ca93c17de..a4dfe544946f 100644

[PATCH bpf-next v7 30/34] bpf: eliminate rlimit-based memory accounting for xskmap maps

2020-11-19 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 Acked-by: Song Liu --- net/xdp/xskmap.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/net/xdp/xskmap.c b/net

[PATCH bpf-next v7 18/34] bpf: eliminate rlimit-based memory accounting for arraymap maps

2020-11-19 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 Acked-by: Song Liu --- kernel/bpf/arraymap.c | 24 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a

[PATCH bpf-next v7 07/34] bpf: memcg-based memory accounting for bpf maps

2020-11-19 Thread Roman Gushchin
This patch enables memcg-based memory accounting for memory allocated by __bpf_map_area_alloc(), which is used by many types of bpf maps for large memory allocations. Following patches in the series will refine the accounting for some of the map types. Signed-off-by: Roman Gushchin Acked-by

[PATCH bpf-next v7 02/34] mm: memcontrol/slab: use helpers to access slab page's memcg_data

2020-11-19 Thread Roman Gushchin
truct page *page, struct obj_cgroup **objcgs); They are similar to the corresponding API for generic pages, except that the setter can return false, indicating that the value has been already set from a different thread. Link: https://lkml.kernel.org/r/20201027001657.3398190-3-g...@fb.com Signed-off

[PATCH bpf-next v7 13/34] bpf: memcg-based memory accounting for lpm_trie maps

2020-11-19 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 | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c index 00e32f2ec3e6..a7d1e5cb80da

[PATCH bpf-next v7 05/34] bpf: memcg-based memory accounting for bpf progs

2020-11-19 Thread Roman Gushchin
Include memory used by bpf programs into the memcg-based accounting. This includes the memory used by programs itself, auxiliary data, statistics and bpf line info. A memory cgroup containing the process which loads the program is getting charged. Signed-off-by: Roman Gushchin Acked-by: Song Liu

[PATCH bpf-next v7 04/34] mm: convert page kmemcg type to a page memcg flag

2020-11-19 Thread Roman Gushchin
//lkml.kernel.org/r/20201027001657.3398190-5-g...@fb.com Signed-off-by: Roman Gushchin Acked-by: Johannes Weiner Reviewed-by: Shakeel Butt Acked-by: Michal Hocko Signed-off-by: Andrew Morton --- include/linux/memcontrol.h | 37 + include/linux/page-flags.h | 11 ++---

[PATCH bpf-next v7 32/34] bpf: eliminate rlimit-based memory accounting infra for bpf maps

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

[PATCH bpf-next v7 03/34] mm: introduce page memcg flags

2020-11-19 Thread Roman Gushchin
might be added later. Link: https://lkml.kernel.org/r/20201027001657.3398190-4-g...@fb.com Signed-off-by: Roman Gushchin Reviewed-by: Shakeel Butt Acked-by: Johannes Weiner Acked-by: Michal Hocko Signed-off-by: Andrew Morton --- include/linux/memcontrol.h | 32

[PATCH bpf-next v7 01/34] mm: memcontrol: use helpers to read page's memcg data

2020-11-19 Thread Roman Gushchin
age not being a slab page. To make sure nobody uses a direct access, struct page's mem_cgroup/obj_cgroups is converted to unsigned long memcg_data. Link: https://lkml.kernel.org/r/20201027001657.3398190-1-g...@fb.com Link: https://lkml.kernel.org/r/20201027001657.3398190-2-g...@fb.com Signed-off-

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

2020-11-19 Thread Roman Gushchin
ocations made from an interrupt context, by Daniel - added some clarifications to the cover letter v3: - droped the userspace part for further discussions/refinements, by Andrii and Song v2: - fixed build issue, caused by the remaining rlimit-based accounting for sockhash maps Roman

[PATCH bpf-next v7 08/34] bpf: refine memcg-based memory accounting for arraymap maps

2020-11-19 Thread Roman Gushchin
Include percpu arrays and auxiliary data into the memcg-based memory accounting. Signed-off-by: Roman Gushchin Acked-by: Song Liu --- 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 c6c81eceb68f

[PATCH bpf-next v7 06/34] bpf: prepare for memcg-based memory accounting for bpf maps

2020-11-19 Thread Roman Gushchin
the interrupt context they're using the saved memory cgroup, otherwise the current cgroup is getting charged. Signed-off-by: Roman Gushchin --- include/linux/bpf.h | 26 +++ kernel/bpf/syscall.c | 76 2 files changed, 102 insertions(+)

Re: [PATCH bpf-next v7 32/34] bpf: eliminate rlimit-based memory accounting infra for bpf maps

2020-11-20 Thread Roman Gushchin
On Fri, Nov 20, 2020 at 06:52:27PM -0800, Alexei Starovoitov wrote: > On Thu, Nov 19, 2020 at 09:37:52AM -0800, Roman Gushchin wrote: > > static void bpf_map_put_uref(struct bpf_map *map) > > @@ -619,7 +562,7 @@ static void bpf_map_show_fdinfo(struct seq_file *m, > &

Re: [PATCH bpf-next v7 00/34] bpf: switch to memcg-based memory accounting

2020-11-23 Thread Roman Gushchin
On Mon, Nov 23, 2020 at 02:30:09PM +0100, Daniel Borkmann wrote: > On 11/19/20 6:37 PM, Roman Gushchin wrote: > > Currently bpf is using the memlock rlimit for the memory accounting. > > This approach has its downsides and over time has created a significant > > amount of prob

[PATCH bpf-next v8 04/34] mm: convert page kmemcg type to a page memcg flag

2020-11-24 Thread Roman Gushchin
//lkml.kernel.org/r/20201027001657.3398190-5-g...@fb.com Signed-off-by: Roman Gushchin Acked-by: Johannes Weiner Reviewed-by: Shakeel Butt Acked-by: Michal Hocko Signed-off-by: Andrew Morton --- include/linux/memcontrol.h | 37 + include/linux/page-flags.h | 11 ++---

[PATCH bpf-next v8 21/34] bpf: eliminate rlimit-based memory accounting for cgroup storage maps

2020-11-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 Acked-by: Song Liu --- kernel/bpf/local_storage.c | 21 + 1 file changed, 1 insertion(+), 20 deletions(-) diff

[PATCH bpf-next v8 15/34] bpf: memcg-based memory accounting for bpf local storage maps

2020-11-24 Thread Roman Gushchin
Account memory used by bpf local storage maps: per-socket, per-inode and per-task storages. Signed-off-by: Roman Gushchin --- kernel/bpf/bpf_local_storage.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/kernel/bpf/bpf_local_storage.c b/kernel/bpf

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

2020-11-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 Acked-by: Song Liu --- samples/bpf/map_perf_test_user.c| 6 -- samples/bpf/offwaketime_user.c | 6 -- samples/bpf

[PATCH bpf-next v8 29/34] bpf: eliminate rlimit-based memory accounting for stackmap maps

2020-11-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 Acked-by: Song Liu --- kernel/bpf/stackmap.c | 16 +++- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/kernel/bpf

[PATCH bpf-next v8 16/34] bpf: refine memcg-based memory accounting for sockmap and sockhash maps

2020-11-24 Thread Roman Gushchin
Include 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 | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/net/core/sock_map.c b/net/core

[PATCH bpf-next v8 25/34] bpf: eliminate rlimit-based memory accounting for queue_stack_maps maps

2020-11-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 Acked-by: Song Liu --- kernel/bpf/queue_stack_maps.c | 16 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a

[PATCH bpf-next v8 33/34] bpf: eliminate rlimit-based memory accounting for bpf progs

2020-11-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 Acked-by: Song Liu --- include/linux/bpf.h | 11 --- kernel/bpf/core.c| 12 ++-- kernel/bpf/syscall.c | 69

[PATCH bpf-next v8 02/34] mm: memcontrol/slab: use helpers to access slab page's memcg_data

2020-11-24 Thread Roman Gushchin
truct page *page, struct obj_cgroup **objcgs); They are similar to the corresponding API for generic pages, except that the setter can return false, indicating that the value has been already set from a different thread. Link: https://lkml.kernel.org/r/20201027001657.3398190-3-g...@fb.com Signed-off

[PATCH bpf-next v8 18/34] bpf: eliminate rlimit-based memory accounting for arraymap maps

2020-11-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 Acked-by: Song Liu --- kernel/bpf/arraymap.c | 24 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a

[PATCH bpf-next v8 27/34] bpf: eliminate rlimit-based memory accounting for bpf ringbuffer

2020-11-24 Thread Roman Gushchin
rop 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 Acked-by: Song Liu Acked-by: Andrii Nakryiko --- kernel/bpf/ringbuf.c | 24 1 file changed, 4 insertions(+

[PATCH bpf-next v8 09/34] bpf: refine memcg-based memory accounting for cpumap maps

2020-11-24 Thread Roman Gushchin
Include metadata and percpu data into the memcg-based memory accounting. Switch allocations made from an update path to new bpf_map_* allocation helpers to make the accounting work properly from an interrupt context. Signed-off-by: Roman Gushchin --- kernel/bpf/cpumap.c | 23

[PATCH bpf-next v8 14/34] bpf: memcg-based memory accounting for bpf ringbuffer

2020-11-24 Thread Roman Gushchin
Enable the memcg-based memory accounting for the memory used by the bpf ringbuffer. Signed-off-by: Roman Gushchin Acked-by: Song Liu --- 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

  1   2   3   4   5   >