On Tue, Mar 09, 2021 at 10:36:06AM -0800, Yonghong Song wrote:
>
>
> On 3/9/21 10:21 AM, Roman Gushchin wrote:
> > On Mon, Mar 08, 2021 at 09:44:08PM -0800, Yonghong Song wrote:
> > >
> > >
> > > On 3/5/21 1:10 PM, Yonghong Song wrote:
> >
On Mon, Mar 08, 2021 at 09:44:08PM -0800, Yonghong Song wrote:
>
>
> On 3/5/21 1:10 PM, Yonghong Song wrote:
> >
> >
> > On 3/5/21 12:38 PM, Roman Gushchin wrote:
> > > On Thu, Mar 04, 2021 at 08:03:33PM +0100, Jiri Olsa wrote:
> > > > hi,
> &
On Thu, Mar 04, 2021 at 08:03:33PM +0100, Jiri Olsa wrote:
> hi,
> I'm getting attached BUG/crash when running in parralel selftests, like:
>
> while :; do ./test_progs -t spinlock; done
> while :; do ./test_progs ; done
>
> it's the latest bpf-next/master, I can send the .config if needed,
>
On Mon, Mar 01, 2021 at 07:43:27PM -0800, Shakeel Butt wrote:
> On Mon, Mar 1, 2021 at 5:16 PM Roman Gushchin wrote:
> >
> > On Mon, Mar 01, 2021 at 02:22:26PM +0800, Muchun Song wrote:
> > > The remote memcg charing APIs is a mechanism to charge kernel memory
> >
On Mon, Mar 01, 2021 at 02:22:26PM +0800, Muchun Song wrote:
> The remote memcg charing APIs is a mechanism to charge kernel memory
> to a given memcg. So we can move the infrastructure to the scope of
> the CONFIG_MEMCG_KMEM.
This is not a good idea, because there is nothing kmem-specific
in the
Hi Muchun!
On Mon, Mar 01, 2021 at 02:22:22PM +0800, Muchun Song wrote:
> Since Roman series "The new cgroup slab memory controller" applied. All
> slab objects are changed via the new APIs of obj_cgroup. This new APIs
> introduce a struct obj_cgroup instead of using struct mem_cgroup directly
> t
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
> >
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:
> > > >
> &
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
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
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
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
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!
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.
> ...
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:
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
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
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
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
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
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
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
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
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
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
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
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
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
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-
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
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
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
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(+
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
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
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
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
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
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
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
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_
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
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
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
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
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
//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 ++---
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
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
On Thu, Nov 26, 2020 at 10:56:12AM +0100, Toke Høiland-Jørgensen wrote:
> Roman Gushchin writes:
>
> > On Thu, Nov 26, 2020 at 01:21:41AM +0100, Daniel Borkmann wrote:
> >> On 11/25/20 4:00 AM, Roman Gushchin wrote:
> >> > In the absolute majority of case
On Thu, Nov 26, 2020 at 01:21:41AM +0100, Daniel Borkmann wrote:
> On 11/25/20 4:00 AM, Roman Gushchin wrote:
> > In the absolute majority of cases if a process is making a kernel
> > allocation, it's memory cgroup is getting charged.
> >
> > Bpf maps can be updat
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
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
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-
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
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
sions/refinements,
by Andrii and Song
v2:
- fixed build issue, caused by the remaining 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: in
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
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
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
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
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
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
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
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
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
nd key and value sizes.
Signed-off-by: Roman Gushchin
Acked-by: Song Liu
---
include/linux/bpf.h | 12 ---
kernel/bpf/syscall.c | 94 +++
.../selftests/bpf/progs/bpf_iter_bpf_map.c| 2 +-
.../selftests/bpf/progs/map_
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
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
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
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(+)
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
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
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
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(+
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
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
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
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
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
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
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
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
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
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
//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 ++---
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
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,
> &
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(+)
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
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-
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
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
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
//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 ++---
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
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
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
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
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
1 - 100 of 467 matches
Mail list logo