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

2020-11-16 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 v6 31/34] bpf: eliminate rlimit-based memory accounting for bpf local storage maps

2020-11-16 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 v6 22/34] bpf: eliminate rlimit-based memory accounting for devmap maps

2020-11-16 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 v6 26/34] bpf: eliminate rlimit-based memory accounting for reuseport_array maps

2020-11-16 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

[PATCH v6 34/34] bpf: samples: do not touch RLIMIT_MEMLOCK

2020-11-16 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 v6 32/34] bpf: eliminate rlimit-based memory accounting infra for bpf maps

2020-11-16 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 v6 24/34] bpf: eliminate rlimit-based memory accounting for lpm_trie maps

2020-11-16 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 v6 18/34] bpf: eliminate rlimit-based memory accounting for arraymap maps

2020-11-16 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

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

2020-11-16 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 v6 11/34] bpf: refine memcg-based memory accounting for devmap maps

2020-11-16 Thread Roman Gushchin
Include map metadata and the node size (struct bpf_dtab_netdev) into the accounting. Signed-off-by: Roman Gushchin Acked-by: Song Liu --- 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 2b5ca93c17de

Re: [PATCH] mm: memcg: remove obsolete memcg_has_children()

2020-11-16 Thread Roman Gushchin
e then, make CC=clang W=1 warns: > > mm/memcontrol.c:3421:20: > warning: unused function 'memcg_has_children' [-Wunused-function] > > Simply remove this obsolete unused function. > > Signed-off-by: Lukas Bulwahn > --- > applies cleanly on next-20201113, not on cur

Re: [RFC PATCH 3/6] mm: page_owner: add support for splitting to any order in split page_owner.

2020-11-13 Thread Roman Gushchin
On Fri, Nov 13, 2020 at 08:08:58PM -0500, Zi Yan wrote: > On 13 Nov 2020, at 19:15, Roman Gushchin wrote: > > > On Wed, Nov 11, 2020 at 03:40:05PM -0500, Zi Yan wrote: > > > From: Zi Yan > > > > > > It adds a new_order parameter to set new page

Re: [RFC PATCH 4/6] mm: thp: add support for split huge page to any lower order pages.

2020-11-13 Thread Roman Gushchin
On Wed, Nov 11, 2020 at 03:40:06PM -0500, Zi Yan wrote: > From: Zi Yan > > To split a THP to any lower order pages, we need to reform THPs on > subpages at given order and add page refcount based on the new page > order. Also we need to reinitialize page_deferred_list after removing > the page

Re: [RFC PATCH 2/6] mm: memcg: make memcg huge page split support any order split.

2020-11-13 Thread Roman Gushchin
ings. > */ > -void mem_cgroup_split_huge_fixup(struct page *head) > +void mem_cgroup_split_huge_fixup(struct page *head, unsigned int new_nr) I'd go with unsigned int new_order, then it's obvious that we can split the original page without any leftovers. Other than tha

Re: [RFC PATCH 3/6] mm: page_owner: add support for splitting to any order in split page_owner.

2020-11-13 Thread Roman Gushchin
On Wed, Nov 11, 2020 at 03:40:05PM -0500, Zi Yan wrote: > From: Zi Yan > > It adds a new_order parameter to set new page order in page owner. > It prepares for upcoming changes to support split huge page to any lower > order. > > Signed-off-by: Zi Yan > --- > include/linux/page_owner.h | 7

Re: [PATCH v8 6/9] secretmem: add memcg accounting

2020-11-13 Thread Roman Gushchin
вт, 10 нояб. 2020 г. в 07:16, Mike Rapoport : > > From: Mike Rapoport > > Account memory consumed by secretmem to memcg. The accounting is updated > when the memory is actually allocated and freed. > > Signed-off-by: Mike Rapoport > --- > mm/filemap.c | 2 +- > mm/secretmem.c | 42

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

2020-11-13 Thread Roman Gushchin
On Fri, Nov 13, 2020 at 09:46:49AM -0800, Song Liu wrote: > > > > On Nov 12, 2020, at 2:15 PM, Roman Gushchin wrote: > > [...] > > > > > +#ifdef CONFIG_MEMCG_KMEM > > +static __always_inline int __bpf_map_update_e

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

2020-11-13 Thread Roman Gushchin
On Fri, Nov 13, 2020 at 10:14:48AM -0800, Song Liu wrote: > > > > On Nov 12, 2020, at 2:15 PM, Roman Gushchin wrote: > > > > Do not use rlimit-based memory accounting for bpf local storage maps. > > It has been replaced with the memcg-based memory accounting.

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

2020-11-13 Thread Roman Gushchin
On Fri, Nov 13, 2020 at 06:25:53AM -0800, Shakeel Butt wrote: > On Thu, Nov 12, 2020 at 8:02 PM Roman Gushchin wrote: > > > > On Thu, Nov 12, 2020 at 07:25:48PM -0800, Alexei Starovoitov wrote: > > > On Thu, Nov 12, 2020 at 7:18 PM Andrew Morton > > > wrote: &g

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

2020-11-12 Thread Roman Gushchin
On Thu, Nov 12, 2020 at 07:25:48PM -0800, Alexei Starovoitov wrote: > On Thu, Nov 12, 2020 at 7:18 PM Andrew Morton > wrote: > > > > On Thu, 12 Nov 2020 19:04:56 -0800 Alexei Starovoitov > > wrote: > > > > > On Thu, Nov 12, 2020 at

Re: [PATCH 2/2] mm: memcg/slab: pre-allocate obj_cgroups for slab caches with SLAB_ACCOUNT

2020-11-12 Thread Roman Gushchin
On Thu, Nov 12, 2020 at 05:12:39PM -0800, Andrew Morton wrote: > On Thu, 12 Nov 2020 16:19:26 -0800 Roman Gushchin wrote: > > > >From 8b28d91475d54c552e503e66f169e1e00475c856 Mon Sep 17 00:00:00 2001 > > From: Roman Gushchin > > Date: Wed, 16 Sep 2020 15:43:48 -0700

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

2020-11-12 Thread Roman Gushchin
On Fri, Nov 13, 2020 at 09:56:32AM +1100, Stephen Rothwell wrote: > Hi Roman, > > On Thu, 12 Nov 2020 14:15:10 -0800 Roman Gushchin wrote: > > > > Patch series "mm: allow mapping accounted kernel pages to userspace", v6. > > > > Currently a

Re: [PATCH 2/2] mm: memcg/slab: pre-allocate obj_cgroups for slab caches with SLAB_ACCOUNT

2020-11-12 Thread Roman Gushchin
On Thu, Nov 12, 2020 at 11:23:03AM -0500, Johannes Weiner wrote: > On Tue, Nov 10, 2020 at 11:57:53AM -0800, Roman Gushchin wrote: > > In general it's unknown in advance if a slab page will contain > > accounted objects or not. In order to avoid memory waste, an > > obj_cgrou

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

2020-11-12 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 v5 18/34] bpf: eliminate rlimit-based memory accounting for arraymap maps

2020-11-12 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

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

2020-11-12 Thread Roman Gushchin
Include lpm trie and lpm trie node objects into the memcg-based memory accounting. Signed-off-by: Roman Gushchin Acked-by: Song Liu --- 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 00e32f2ec3e6

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

2020-11-12 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 v5 14/34] bpf: memcg-based memory accounting for bpf ringbuffer

2020-11-12 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 v5 24/34] bpf: eliminate rlimit-based memory accounting for lpm_trie maps

2020-11-12 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 v5 23/34] bpf: eliminate rlimit-based memory accounting for hashtab maps

2020-11-12 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 v5 12/34] bpf: refine memcg-based memory accounting for hashtab maps

2020-11-12 Thread Roman Gushchin
Include percpu objects and the size of map metadata into the accounting. Signed-off-by: Roman Gushchin Acked-by: Song Liu Reviewed-by: Shakeel Butt --- kernel/bpf/hashtab.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kernel/bpf/hashtab.c b/kernel/bpf

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

2020-11-12 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 v5 28/34] bpf: eliminate rlimit-based memory accounting for sockmap and sockhash maps

2020-11-12 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 v5 16/34] bpf: refine memcg-based memory accounting for sockmap and sockhash maps

2020-11-12 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 Acked-by: Song Liu --- net/core/sock_map.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/core/sock_map.c b

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

2020-11-12 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 v5 17/34] bpf: refine memcg-based memory accounting for xskmap maps

2020-11-12 Thread Roman Gushchin
Extend xskmap memory accounting to include the memory taken by the xsk_map_node structure. Signed-off-by: Roman Gushchin Acked-by: Song Liu --- 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 49da2b8ace8b

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

2020-11-12 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 Signed-off-by: Roman Gushchin --- net/xdp/xskmap.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff

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

2020-11-12 Thread Roman Gushchin
Include map metadata and the node size (struct bpf_dtab_netdev) into the accounting. Signed-off-by: Roman Gushchin Acked-by: Song Liu --- 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 2b5ca93c17de

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

2020-11-12 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 v5 21/34] bpf: eliminate rlimit-based memory accounting for cgroup storage maps

2020-11-12 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 v5 25/34] bpf: eliminate rlimit-based memory accounting for queue_stack_maps maps

2020-11-12 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

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

2020-11-12 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

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

2020-11-12 Thread Roman Gushchin
Account memory used by bpf local storage maps: per-socket and per-inode storages. Signed-off-by: Roman Gushchin --- kernel/bpf/bpf_local_storage.c | 7 --- net/core/bpf_sk_storage.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/kernel/bpf/bpf_local_storage.c b

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

2020-11-12 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 v5 08/34] bpf: refine memcg-based memory accounting for arraymap maps

2020-11-12 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 v5 09/34] bpf: refine memcg-based memory accounting for cpumap maps

2020-11-12 Thread Roman Gushchin
Include metadata and percpu data into the memcg-based memory accounting. Signed-off-by: Roman Gushchin Acked-by: Song Liu --- 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 c61a23b564aa..563f96cc8a9d

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

2020-11-12 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 Acked-by: Song Liu --- kernel/bpf/local_storage.c | 17 - 1 file changed, 8 insertions(+), 9 deletions

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

2020-11-12 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 --- kernel

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

2020-11-12 Thread Roman Gushchin
ved, and this cgroup is getting charged for all allocations made from an interrupt context. Allocations made from a process context will be accounted in a usual way. Signed-off-by: Roman Gushchin --- include/linux/bpf.h | 4 kernel/bpf/helpers.c | 37 +

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

2020-11-12 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 --- kernel/bpf

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

2020-11-12 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 --- kernel/bpf/bpf_local_storage.c | 11 --- 1 file changed, 11 deletions(-) diff --git a/kernel/bpf/bpf_local_storage.c b

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

2020-11-12 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/bpf_iter_bpf_map.c| 2

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

2020-11-12 Thread Roman Gushchin
- 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 Gushchin (34): mm: memcontrol: use helpers to r

[PATCH v1 3/3] cgroup: remove obsoleted broken_hierarchy and warned_broken_hierarchy

2020-11-10 Thread Roman Gushchin
With the deprecation of the non-hierarchical mode of the memory controller there are no more examples of broken hierarchies left. Let's remove the cgroup core code which was supposed to print warnings about creating of broken hierarchies. Signed-off-by: Roman Gushchin Reviewed-by: Shakeel Butt

[PATCH v1 0/3] mm: memcg: deprecate cgroup v1 non-hierarchical mode

2020-11-10 Thread Roman Gushchin
wly. The only report we have seen so far was a LTP test suite which doesn't really reflect any real life usecase. v1: - added a note from Michal - added acks and reviews rfc: - https://lwn.net/Articles/835983/ Roman Gushchin (3): mm: memcg: deprecate the non-hierarchical mode docs: cgroup

[PATCH v1 2/3] docs: cgroup-v1: reflect the deprecation of the non-hierarchical mode

2020-11-10 Thread Roman Gushchin
Update cgroup v1 docs after the deprecation of the non-hierarchical mode of the memory controller. Signed-off-by: Roman Gushchin Reviewed-by: Shakeel Butt Acked-by: Michal Hocko Acked-by: David Rientjes --- .../admin-guide/cgroup-v1/memcg_test.rst | 8 ++-- .../admin-guide/cgroup-v1

[PATCH v1 1/3] mm: memcg: deprecate the non-hierarchical mode

2020-11-10 Thread Roman Gushchin
uot; passes silently, writing of any other value fails with -EINVAL and a warning to dmesg (on the first occasion). Signed-off-by: Roman Gushchin Acked-by: Michal Hocko Reviewed-by: Shakeel Butt Acked-by: David Rientjes --- include/linux/memcontrol.h | 7 --- kernel/cgroup/cgroup.c | 5

Re: [PATCH 2/2] mm: memcg/slab: pre-allocate obj_cgroups for slab caches with SLAB_ACCOUNT

2020-11-10 Thread Roman Gushchin
On Tue, Nov 10, 2020 at 12:50:08PM -0800, Andrew Morton wrote: > On Tue, 10 Nov 2020 11:57:53 -0800 Roman Gushchin wrote: > > > In general it's unknown in advance if a slab page will contain > > accounted objects or not. In order to avoid memory waste, an > > obj_cg

[PATCH 2/2] mm: memcg/slab: pre-allocate obj_cgroups for slab caches with SLAB_ACCOUNT

2020-11-10 Thread Roman Gushchin
vm_area_struct, anon_vma, task_struct, etc. In such cases we can pre-allocate the objcgs vector and simple assign it to the page without any atomic operations, because at this early stage the page is not visible to anyone else. Signed-off-by: Roman Gushchin --- include/linux/memcontrol.h | 14

[PATCH 1/2] mm: slub: call account_slab_page() after slab page initialization

2020-11-10 Thread Roman Gushchin
ng any functional change, but is required for further optimizations. Signed-off-by: Roman Gushchin --- mm/slub.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 8c9fa24ebbf3..ccdbb62e025d 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1622,9 +1622,6 @@

Re: [RFC PATCH] mm: memcg/slab: Stop reparented obj_cgroups from charging root

2020-11-10 Thread Roman Gushchin
On Tue, Nov 10, 2020 at 07:11:28AM -0800, Shakeel Butt wrote: > On Mon, Nov 9, 2020 at 5:28 PM Roman Gushchin wrote: > > > > On Fri, Oct 23, 2020 at 12:30:53PM -0400, Johannes Weiner wrote: > > > On Wed, Oct 21, 2020 at 12:33:22PM -0700, Roman Gushchin wrote: > > >

[PATCH] mm: memcg: fix obsolete code comments

2020-11-10 Thread Roman Gushchin
g_id is not used as a gate for kmem accounting since commit 0b8f73e10428 ("mm: memcontrol: clean up alloc, online, offline, free functions") Signed-off-by: Roman Gushchin --- include/linux/memcontrol.h | 6 ++ mm/memcontrol.c| 6 -- 2 files changed, 2 insertions

Re: [PATCH] mm: memcg/slab: enable slab memory accounting atomically

2020-11-10 Thread Roman Gushchin
On Tue, Nov 10, 2020 at 10:21:43AM -0500, Johannes Weiner wrote: > On Mon, Nov 09, 2020 at 05:06:15PM -0800, Roman Gushchin wrote: > > Many kernel memory accounting paths are guarded by the > > memcg_kmem_enabled_key static key. It changes it's state during > > the onlining

Re: [External] Re: [PATCH 4/5] mm: memcg/slab: Fix root memcg vmstats

2020-11-09 Thread Roman Gushchin
On Thu, Oct 29, 2020 at 02:15:43PM +0800, Muchun Song wrote: > On Thu, Oct 29, 2020 at 8:14 AM Roman Gushchin wrote: > > > > On Wed, Oct 28, 2020 at 10:56:20AM +0800, Muchun Song wrote: > > > On Wed, Oct 28, 2020 at 2:48 AM Roman Gushchin wrote: > > > > > &

Re: [RFC PATCH] mm: memcg/slab: Stop reparented obj_cgroups from charging root

2020-11-09 Thread Roman Gushchin
On Fri, Oct 23, 2020 at 12:30:53PM -0400, Johannes Weiner wrote: > On Wed, Oct 21, 2020 at 12:33:22PM -0700, Roman Gushchin wrote: > > On Tue, Oct 20, 2020 at 02:18:22PM -0400, Johannes Weiner wrote: > > > On Tue, Oct 20, 2020 at 10:07:17AM -0700, Roman Gushchin wrote:

[PATCH] mm: memcg/slab: enable slab memory accounting atomically

2020-11-09 Thread Roman Gushchin
ble the slab memory accounting atomically. The patch also removes obsolete comments related to already deleted members of kmem_cache->memcg_params. Signed-off-by: Roman Gushchin Fixes: 10befea91b61 ("mm: memcg/slab: use a single set of kmem_caches for all allocations") --- include/li

Re: [PATCH v2] mm/memcontrol:rewrite mem_cgroup_page_lruvec()

2020-11-09 Thread Roman Gushchin
cgroup_page_lruvec() with mem_cgroup_lruvec(). > > v1->v2: > use page_memcg() instead of 'page->mem_cgroup'. > > Acked-by: Michal Hocko > Acked-by: Johannes Weiner > Reviewed-by: Shakeel Butt > Signed-off-by: Hui Su Acked-by: Roman Gushchin Thanks!

Re: [PATCH] mm, kvm: account kvm_vcpu_mmap to kmemcg

2020-11-06 Thread Roman Gushchin
small number of VMs having large number of VCPUs, this unaccounted > memory can be very significant. So, charge this memory to the memcg of > the VMM. Please note that lifetime of these allocations corresponds to > the lifetime of the VMM. > > Signed-off-by: Shakeel Butt > --- Ack

Re: [PATCH] mm/memcg: update page struct member in comments

2020-11-06 Thread Roman Gushchin
imilar cases, I think it's more obvious than "page_memcg(page) being stable". Maybe it helps to address Ira's comment. Anyway, please feel free to add: Acked-by: Roman Gushchin Thanks!

Re: [PATCH rfc 1/3] mm: memcg: deprecate the non-hierarchical mode

2020-11-04 Thread Roman Gushchin
On Wed, Nov 04, 2020 at 09:37:46AM +0100, Michal Hocko wrote: > On Tue 03-11-20 13:27:23, Roman Gushchin wrote: > > The non-hierarchical cgroup v1 mode is a legacy of early days > > of the memory controller and doesn't bring any value today. > > This is a bold statement

Re: [PATCH] mm/memcontrol: replace '== root_mem_cgroup' with mem_cgroup_is_root

2020-11-04 Thread Roman Gushchin
On Wed, Nov 04, 2020 at 11:14:57PM +0800, Hui Su wrote: > We have supplied the inline func: mem_cgroup_is_root(). > So we may use mem_cgroup_is_root() instead of using > 'memcg == root_mem_cgroup' or 'memcg != root_mem_cgroup' > directly, which is more readable. Most of these comparisons will go

Re: [PATCH] mm/memcontrol:rewrite mem_cgroup_page_lruvec()

2020-11-04 Thread Roman Gushchin
On Wed, Nov 04, 2020 at 10:25:16PM +0800, Hui Su wrote: > mem_cgroup_page_lruvec() in memcontrol.c and > mem_cgroup_lruvec() in memcontrol.h is very similar > except for the param(page and memcg) which also can be > convert to each other. > > So rewrite mem_cgroup_page_lruvec() with

Re: [RFC PATCH] mm: memcg/slab: Stop reparented obj_cgroups from charging root

2020-11-03 Thread Roman Gushchin
On Tue, Nov 03, 2020 at 02:22:21PM +0100, Michal Hocko wrote: > Hi, > I am sorry but I was quite busy at the time this has been discussed. > Now that I got to this thread finally I am wondering whether this > resp. other root cgroup exceptions have any follow up. I'll address a feedback I've got

[PATCH rfc 2/3] docs: cgroup-v1: reflect the deprecation of the non-hierarchical mode

2020-11-03 Thread Roman Gushchin
Update cgroup v1 docs after the deprecation of the non-hierarchical mode of the memory controller. Signed-off-by: Roman Gushchin --- .../admin-guide/cgroup-v1/memcg_test.rst | 8 ++-- .../admin-guide/cgroup-v1/memory.rst | 40 ++- 2 files changed, 16 insertions

[PATCH rfc 1/3] mm: memcg: deprecate the non-hierarchical mode

2020-11-03 Thread Roman Gushchin
uot; passes silently, writing of any other value fails with -EINVAL and a warning to dmesg (on the first occasion). Signed-off-by: Roman Gushchin --- include/linux/memcontrol.h | 7 --- kernel/cgroup/cgroup.c | 5 --- mm/memcontrol.c| 90 ++

[PATCH rfc 0/3] mm: memcg: deprecate cgroup v1 non-hierarchical mode

2020-11-03 Thread Roman Gushchin
the internal logic, adjusts the user interface and updates the documentation. The alt patch removes some bits of the cgroup core code, which become obsolete. Roman Gushchin (3): mm: memcg: deprecate the non-hierarchical mode docs: cgroup-v1: reflect the deprecation of the non-hierarchical mode cgroup

[PATCH rfc 3/3] cgroup: remove obsoleted broken_hierarchy and warned_broken_hierarchy

2020-11-03 Thread Roman Gushchin
With the deprecation of the non-hierarchical mode of the memory controller there are no more examples of broken hierarchies left. Let's remove the cgroup core code which was supposed to print warnings about creating of broken hierarchies. Signed-off-by: Roman Gushchin --- include/linux/cgroup

Re: [PATCH v2] mm: memcg/slab: Fix return child memcg objcg for root memcg

2020-10-29 Thread Roman Gushchin
On Thu, Oct 29, 2020 at 01:34:57PM -0700, Shakeel Butt wrote: > On Thu, Oct 29, 2020 at 10:10 AM Roman Gushchin wrote: > > > > On Thu, Oct 29, 2020 at 08:48:45AM -0700, Shakeel Butt wrote: > > > On Tue, Oct 27, 2020 at 8:50 PM Muchun Song > > > wrote: >

Re: [PATCH v2] mm: memcg/slab: Fix return child memcg objcg for root memcg

2020-10-29 Thread Roman Gushchin
On Thu, Oct 29, 2020 at 08:48:45AM -0700, Shakeel Butt wrote: > On Tue, Oct 27, 2020 at 8:50 PM Muchun Song wrote: > > > > Consider the following memcg hierarchy. > > > > root > >/\ > > A B > > > > If we get the objcg of memcg A

Re: [PATCH v2] mm: memcg: link page counters to root if use_hierarchy is false

2020-10-29 Thread Roman Gushchin
On Thu, Oct 29, 2020 at 04:39:21PM +0100, Michal Koutny wrote: > Hi. > > On Mon, Oct 26, 2020 at 04:13:26PM -0700, Roman Gushchin wrote: > > Please note, that in the non-hierarchical mode all objcgs are always > > reparented to the root memory cgroup, even if the hierarch

Re: [PATCH v2] mm: memcg/slab: Fix return child memcg objcg for root memcg

2020-10-28 Thread Roman Gushchin
n return the wrong objcg for the root memcg. > > Fixes: bf4f059954dc ("mm: memcg/slab: obj_cgroup API") > Signed-off-by: Muchun Song Acked-by: Roman Gushchin Thanks!

Re: [External] Re: [PATCH 4/5] mm: memcg/slab: Fix root memcg vmstats

2020-10-28 Thread Roman Gushchin
On Wed, Oct 28, 2020 at 10:56:20AM +0800, Muchun Song wrote: > On Wed, Oct 28, 2020 at 2:48 AM Roman Gushchin wrote: > > > > On Tue, Oct 27, 2020 at 04:02:55PM +0800, Muchun Song wrote: > > > If we reparent the slab objects to the root memcg, when we free > > > t

Re: Higher slub memory consumption on 64K page-size systems?

2020-10-28 Thread Roman Gushchin
On Wed, Oct 28, 2020 at 11:20:30AM +0530, Bharata B Rao wrote: > Hi, > > On POWER systems, where 64K PAGE_SIZE is default, I see that slub > consumes higher amount of memory compared to any 4K page-size system. > While slub is obviously going to consume more memory on 64K page-size > systems

Re: [PATCH v1 1/2] mm: cma: introduce cma_release_nowait()

2020-10-27 Thread Roman Gushchin
On Sat, Oct 24, 2020 at 08:59:59AM +0100, Christoph Hellwig wrote: > Btw, I think we also need to use this nonblocking version from > dma_free_contiguous. dma_free* is defined to not block. In practice > callers mostly care if they also did GFP_ATOMIC allocations, which > don't dip into CMA, but

Re: [PATCH 1/5] mm: memcg/slab: Fix return child memcg objcg for root memcg

2020-10-27 Thread Roman Gushchin
On Tue, Oct 27, 2020 at 10:42:36AM -0700, Roman Gushchin wrote: > On Tue, Oct 27, 2020 at 04:02:52PM +0800, Muchun Song wrote: > > Consider the following memcg hierarchy. > > > > root > >/\ > > A

Re: [PATCH 4/5] mm: memcg/slab: Fix root memcg vmstats

2020-10-27 Thread Roman Gushchin
On Tue, Oct 27, 2020 at 04:02:55PM +0800, Muchun Song wrote: > If we reparent the slab objects to the root memcg, when we free > the slab object, we need to update the per-memcg vmstats to keep > it correct for the root memcg. Now this at least affects the vmstat > of NR_KERNEL_STACK_KB for

Re: [PATCH 3/5] mm: memcg/slab: Rename *_lruvec_slab_state to *_lruvec_kmem_state

2020-10-27 Thread Roman Gushchin
gt; kmem. I agree, I think we've even discussed such a renaming in the past. Please, drop the addition of VM_BUG_ON() (it's not related to the renaming, right?). Other than that: Acked-by: Roman Gushchin Thanks! > > Signed-off-by: Muchun Song > --- > include

Re: [PATCH 2/5] mm: memcg/slab: Fix use after free in obj_cgroup_charge

2020-10-27 Thread Roman Gushchin
= obj_cgroup_memcg(objcg); > - css_get(>css); > + if (!css_tryget(>css)) if (unlikely(!css_tryget(>css))) maybe? > + goto retry; Otherwise the fix looks good to me. Please, feel free to add Acked-by: Roman Gushchin after extending the commit description. Thanks!

Re: [PATCH 1/5] mm: memcg/slab: Fix return child memcg objcg for root memcg

2020-10-27 Thread Roman Gushchin
On Tue, Oct 27, 2020 at 04:02:52PM +0800, Muchun Song wrote: > Consider the following memcg hierarchy. > > root >/\ > A B > > If we get the objcg of memcg A failed, the get_obj_cgroup_from_current > can return the wrong objcg for

[PATCH v6 4/4] mm: convert page kmemcg type to a page memcg flag

2020-10-26 Thread Roman Gushchin
MemcgKmem() and an open-coded OR operation setting the memcg pointer with the MEMCG_DATA_KMEM bit. __ClearPageKmemcg() can be simple deleted, as the whole memcg_data is zeroed at once. As a bonus, on !CONFIG_MEMCG build the PageMemcgKmem() check will be compiled out. Signed-off-by: Roman Gushchin Acked-by:

[PATCH v6 2/4] mm: memcontrol/slab: use helpers to access slab page's memcg_data

2020-10-26 Thread Roman Gushchin
, 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. Signed-off-by: Roman Gushchin Acked-by: Johannes Weiner Reviewed-by: Shakeel Butt

[PATCH v6 1/4] mm: memcontrol: use helpers to read page's memcg data

2020-10-26 Thread Roman Gushchin
ULL. page_memcg() contains a VM_BUG_ON_PAGE() check for the page 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. Signed-off-by: Roman Gushchin Acked-by: Johannes Weiner Reviewed-by: Shakeel Butt Acked-by: Mic

[PATCH v6 3/4] mm: introduce page memcg flags

2020-10-26 Thread Roman Gushchin
ght be added later. Signed-off-by: Roman Gushchin Reviewed-by: Shakeel Butt Acked-by: Johannes Weiner Acked-by: Michal Hocko --- include/linux/memcontrol.h | 32 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/include/linux/memcontrol.h b/include/li

[PATCH v6 0/4] mm: allow mapping accounted kernel pages to userspace

2020-10-26 Thread Roman Gushchin
- dropped the memcg flags mutual exclusion requirement, by Shakeel v1: - added and fixed comments, by Shakeel - added some VM_BUG_ON() checks - fixed the debug output format of page->memcg_data Roman Gushchin (4): mm: memcontrol: use helpers to read page's memcg data mm: memco

[PATCH v2] mm: memcg: link page counters to root if use_hierarchy is false

2020-10-26 Thread Roman Gushchin
orting, debugging and providing an alternative version of the fix! Reported-by: l...@lists.linux.it Debugged-by: Richard Palethorpe Fixes: bf4f059954dc ("mm: memcg/slab: obj_cgroup API") Signed-off-by: Roman Gushchin Reviewed-by: Shakeel Butt Acked-by: Johannes Weiner Cc: sta...@vger.ke

Re: [PATCH v4] mm: memcg/slab: Stop reparented obj_cgroups from charging root

2020-10-26 Thread Roman Gushchin
On Mon, Oct 26, 2020 at 07:32:39AM +, Richard Palethorpe wrote: > Hello Roman, > > Roman Gushchin writes: > > > On Thu, Oct 22, 2020 at 04:59:56PM -0700, Shakeel Butt wrote: > >> On Thu, Oct 22, 2020 at 10:25 AM Roman Gushchin wrote: > >> > > >

Re: [PATCH v1 0/2] mm: cma: introduce a non-blocking version of cma_release()

2020-10-23 Thread Roman Gushchin
On Thu, Oct 22, 2020 at 08:58:10PM -0400, Zi Yan wrote: > On 22 Oct 2020, at 20:47, Roman Gushchin wrote: > > > On Thu, Oct 22, 2020 at 07:42:45PM -0400, Zi Yan wrote: > >> On 22 Oct 2020, at 18:53, Roman Gushchin wrote: > >> > >>> This small

Re: [PATCH v1 0/2] mm: cma: introduce a non-blocking version of cma_release()

2020-10-22 Thread Roman Gushchin
On Thu, Oct 22, 2020 at 07:42:45PM -0400, Zi Yan wrote: > On 22 Oct 2020, at 18:53, Roman Gushchin wrote: > > > This small patchset introduces a non-blocking version of cma_release() > > and simplifies the code in hugetlbfs, where previously we had to > > temporarily

Re: [PATCH v4] mm: memcg/slab: Stop reparented obj_cgroups from charging root

2020-10-22 Thread Roman Gushchin
On Thu, Oct 22, 2020 at 04:59:56PM -0700, Shakeel Butt wrote: > On Thu, Oct 22, 2020 at 10:25 AM Roman Gushchin wrote: > > > [snip] > > > > > > Since bf4f059954dc ("mm: memcg/slab: obj_cgroup API") is in 5.9, I > > > think we can take thi

[PATCH v1 2/2] mm: hugetlb: don't drop hugetlb_lock around cma_release() call

2020-10-22 Thread Roman Gushchin
Replace blocking cma_release() with a non-blocking cma_release_nowait() call, so there is no more need to temporarily drop hugetlb_lock. Signed-off-by: Roman Gushchin --- mm/hugetlb.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c

<    1   2   3   4   5   6   7   8   9   10   >