Re: [PATCH v6 09/19] mm: memcg/slab: charge individual slab objects instead of pages

2020-06-19 Thread Shakeel Butt
On Mon, Jun 8, 2020 at 4:07 PM Roman Gushchin wrote: > > Switch to per-object accounting of non-root slab objects. > > Charging is performed using obj_cgroup API in the pre_alloc hook. > Obj_cgroup is charged with the size of the object and the size > of metadata: as now it's the size of an

Re: [PATCH v6 11/19] mm: memcg/slab: move memcg_kmem_bypass() to memcontrol.h

2020-06-19 Thread Shakeel Butt
from the slab code. > > Signed-off-by: Roman Gushchin > Reviewed-by: Vlastimil Babka Reviewed-by: Shakeel Butt

Re: [PATCH v6 00/19] The new cgroup slab memory controller

2020-06-16 Thread Shakeel Butt
On Mon, Jun 8, 2020 at 4:07 PM Roman Gushchin wrote: > > This is v6 of the slab cgroup controller rework. > > The patchset moves the accounting from the page level to the object > level. It allows to share slab pages between memory cgroups. > This leads to a significant win in the slab

Re: [PATCH v6 01/19] mm: memcg: factor out memcg- and lruvec-level changes out of __mod_lruvec_state()

2020-06-16 Thread Shakeel Butt
On Mon, Jun 8, 2020 at 4:07 PM Roman Gushchin wrote: > > To convert memcg and lruvec slab counters to bytes there must be > a way to change these counters without touching node counters. > Factor out __mod_memcg_lruvec_state() out of __mod_lruvec_state(). > > Signed-off-by: Roman Gushchin >

Re: [PATCH v6 02/19] mm: memcg: prepare for byte-sized vmstat items

2020-06-16 Thread Shakeel Butt
On Mon, Jun 8, 2020 at 4:07 PM Roman Gushchin wrote: > > To implement per-object slab memory accounting, we need to > convert slab vmstat counters to bytes. Actually, out of > 4 levels of counters: global, per-node, per-memcg and per-lruvec > only two last levels will require byte-sized counters.

Re: [PATCH v6 01/19] mm: memcg: factor out memcg- and lruvec-level changes out of __mod_lruvec_state()

2020-06-16 Thread Shakeel Butt
On Tue, Jun 16, 2020 at 7:50 PM Roman Gushchin wrote: > > On Tue, Jun 16, 2020 at 06:52:09PM -0700, Shakeel Butt wrote: > > On Mon, Jun 8, 2020 at 4:07 PM Roman Gushchin wrote: > > > > > > To convert memcg and lruvec slab counters to bytes there must be > &

Re: [PATCH v6 03/19] mm: memcg: convert vmstat slab counters to bytes

2020-06-16 Thread Shakeel Butt
ad. > > The size of slab memory shouldn't exceed 4Gb on 32-bit machines, > so it will fit into atomic_long_t we use for vmstats. > > Signed-off-by: Roman Gushchin > Acked-by: Johannes Weiner > Acked-by: Vlastimil Babka Reviewed-by: Shakeel Butt

Re: [PATCH v6 00/19] The new cgroup slab memory controller

2020-06-16 Thread Shakeel Butt
On Tue, Jun 16, 2020 at 7:41 PM Roman Gushchin wrote: > > On Tue, Jun 16, 2020 at 06:46:56PM -0700, Shakeel Butt wrote: > > On Mon, Jun 8, 2020 at 4:07 PM Roman Gushchin wrote: > > > [...] > > > > Have you performed any [perf] testing on SLAB with this

Re: [PATCH v6 04/19] mm: slub: implement SLUB version of obj_to_index()

2020-06-16 Thread Shakeel Butt
o_index() > will be a simple wrapper taking a page pointer and passing > page_address(page) into __obj_to_index(). > > Signed-off-by: Roman Gushchin > Reviewed-by: Vlastimil Babka > Acked-by: Johannes Weiner Reviewed-by: Shakeel Butt

Re: [PATCH v6 02/19] mm: memcg: prepare for byte-sized vmstat items

2020-06-17 Thread Shakeel Butt
n attempt to read > byte value, because at the moment no one actually needs bytes. > > Thanks to Johannes Weiner for the idea of having the byte-sized API > on top of the page-sized internal storage. > > Signed-off-by: Roman Gushchin > Acked-by: Johannes Weiner > Reviewed-by: Vlastimil Babka Reviewed-by: Shakeel Butt

Re: [PATCH v7 09/19] mm: memcg/slab: charge individual slab objects instead of pages

2020-06-22 Thread Shakeel Butt
(s))) { > + memcg_kmem_put_cache(cachep); I think you forgot to put obj_cgroup_put(*objcgp) here again. > + cachep = NULL; > + } > + > + return cachep; > +} > + After the above fix: Reviewed-by: Shakeel Butt

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

2020-06-22 Thread Shakeel Butt
Suggested-by: Johannes Weiner > Signed-off-by: Roman Gushchin > Reviewed-by: Vlastimil Babka Reviewed-by: Shakeel Butt

[PATCH] mm: fix race between kmem_cache destroy, create and deactivate

2018-05-21 Thread Shakeel Butt
. This patch make alias count explicit and adds reference counting to the root kmem_caches. The reference of a root kmem cache is elevated on merge and while its memcg kmem_cache is in the process of creation or deactivation. Signed-off-by: Shakeel Butt --- include/linux/slab.h | 2 + include

Re: [PATCH] mm: fix race between kmem_cache destroy, create and deactivate

2018-05-21 Thread Shakeel Butt
On Mon, May 21, 2018 at 11:42 AM Andrew Morton wrote: > On Mon, 21 May 2018 10:41:16 -0700 Shakeel Butt wrote: > > The memcg kmem cache creation and deactivation (SLUB only) is > > asynchronous. If a root kmem cache is destroyed whose memcg cache is in > > th

[PATCH v2] mm: fix race between kmem_cache destroy, create and deactivate

2018-05-22 Thread Shakeel Butt
kmem_cache is not destroyed in the middle. As the reference of kmem_cache is elevated on sharing, the 'shared_count' does not need any locking protection as at worst it can be out-dated for a small window which is tolerable. Signed-off-by: Shakeel Butt --- Changelog since v1: - Added more

Re: [PATCH 2/2] mm: Consider subtrees in memory.events

2019-01-28 Thread Shakeel Butt
Hi Tejun, On Fri, Jan 25, 2019 at 10:28 AM Tejun Heo wrote: > > Hello, Michal. > > On Fri, Jan 25, 2019 at 06:37:13PM +0100, Michal Hocko wrote: > > > What if a user wants to monitor any ooms in the subtree tho, which is > > > a valid use case? > > > > How is that information useful without know

Re: [PATCH 2/2] mm: Consider subtrees in memory.events

2019-01-28 Thread Shakeel Butt
Hi Tejun, On Mon, Jan 28, 2019 at 8:05 AM Tejun Heo wrote: > > Hello, Shakeel. > > On Mon, Jan 28, 2019 at 07:59:33AM -0800, Shakeel Butt wrote: > > Why not make this configurable at the delegation boundary? As you > > mentioned, there are jobs who want centralized workl

Re: [PATCH v3] memcg: schedule high reclaim for remote memcgs on high_work

2019-01-14 Thread Shakeel Butt
On Sun, Jan 13, 2019 at 10:34 AM Michal Hocko wrote: > > On Fri 11-01-19 14:54:32, Shakeel Butt wrote: > > Hi Johannes, > > > > On Fri, Jan 11, 2019 at 12:59 PM Johannes Weiner wrote: > > > > > > Hi Shakeel, > > > > > >

Re: [PATCH v3] memcg: schedule high reclaim for remote memcgs on high_work

2019-01-15 Thread Shakeel Butt
On Mon, Jan 14, 2019 at 11:25 PM Michal Hocko wrote: > > On Mon 14-01-19 12:18:07, Shakeel Butt wrote: > > On Sun, Jan 13, 2019 at 10:34 AM Michal Hocko wrote: > > > > > > On Fri 11-01-19 14:54:32, Shakeel Butt wrote: > > > > Hi Johannes, > > >

Re: [PATCH 2/2] mm: Consider subtrees in memory.events

2019-01-30 Thread Shakeel Butt
Hi Tejun, On Wed, Jan 30, 2019 at 9:07 AM Tejun Heo wrote: > > Hello, Michal. > > On Wed, Jan 30, 2019 at 05:50:58PM +0100, Michal Hocko wrote: > > > Yeah, cgroup.events and .stat files as some of the local stats would > > > be useful too, so if we don't flip memory.events we'll end up with sth

Re: [PATCH 2/2] mm: Consider subtrees in memory.events

2019-01-30 Thread Shakeel Butt
On Wed, Jan 30, 2019 at 11:30 AM Johannes Weiner wrote: > > On Wed, Jan 30, 2019 at 02:27:12PM -0500, Johannes Weiner wrote: > > On Wed, Jan 30, 2019 at 11:11:44AM -0800, Shakeel Butt wrote: > > > Hi Tejun, > > > > > > On Wed, Jan 30, 2019 at 9:07 AM

Re: [PATCH] slub: fix __kmem_cache_empty for !CONFIG_SLUB_DEBUG

2018-06-20 Thread Shakeel Butt
On Wed, Jun 20, 2018 at 5:08 AM Andrey Ryabinin wrote: > > > > On 06/20/2018 12:33 AM, Shakeel Butt wrote: > > For !CONFIG_SLUB_DEBUG, SLUB does not maintain the number of slabs > > allocated per node for a kmem_cache. Thus, slabs_node() in > > __kmem_cache_em

[PATCH] slub: track number of slabs irrespective of CONFIG_SLUB_DEBUG

2018-06-20 Thread Shakeel Butt
ail.gmail.com Fixes: f9e13c0a5a33 ("slab, slub: skip unnecessary kasan_cache_shutdown()") Signed-off-by: Shakeel Butt Suggested-by: David Rientjes Reported-by: Jason A . Donenfeld Cc: Christoph Lameter Cc: Pekka Enberg Cc: Joonsoo Kim Cc: Andrew Morton Cc: Andrey Ryabinin Cc: Cc: Cc: ---

Re: [PATCH] slub: track number of slabs irrespective of CONFIG_SLUB_DEBUG

2018-06-21 Thread Shakeel Butt
On Wed, Jun 20, 2018 at 6:15 PM Christopher Lameter wrote: > > On Wed, 20 Jun 2018, Shakeel Butt wrote: > > > For !CONFIG_SLUB_DEBUG, SLUB does not maintain the number of slabs > > allocated per node for a kmem_cache. Thus, slabs_node() in > > __kmem_cache_e

Re: [PATCH] slub: track number of slabs irrespective of CONFIG_SLUB_DEBUG

2018-06-22 Thread Shakeel Butt
On Thu, Jun 21, 2018 at 8:01 AM Michal Hocko wrote: > > On Thu 21-06-18 01:15:30, Cristopher Lameter wrote: > > On Wed, 20 Jun 2018, Shakeel Butt wrote: > > > > > For !CONFIG_SLUB_DEBUG, SLUB does not maintain the number of slabs > > > allocated per nod

Re: [PATCH] kasan: depend on CONFIG_SLUB_DEBUG

2018-06-22 Thread Shakeel Butt
p://lkml.kernel.org/r/CAHmME9rtoPwxUSnktxzKso14iuVCWT7BE_-_8PAC=pgw1ij...@mail.gmail.com > > Fixes: f9e13c0a5a33 ("slab, slub: skip unnecessary kasan_cache_shutdown()") > Cc: Shakeel Butt > Cc: David Rientjes > Cc: Christoph Lameter > Cc: Pekka Enberg > Cc: Joonsoo K

Re: [PATCH 3/3] fs, mm: account buffer_head to kmemcg

2018-06-22 Thread Shakeel Butt
On Tue, Jun 19, 2018 at 12:55 PM Roman Gushchin wrote: > > On Tue, Jun 19, 2018 at 12:51:15PM -0700, Shakeel Butt wrote: > > On Tue, Jun 19, 2018 at 10:41 AM Roman Gushchin wrote: > > > > > > On Tue, Jun 19, 2018 at 12:27:41PM -0400, Johannes Weiner wrote: > &g

Re: [PATCH 2/2] mm: introduce mem_cgroup_put() helper

2018-06-22 Thread Shakeel Butt
On Fri, Jun 22, 2018 at 5:06 PM Roman Gushchin wrote: > > Introduce the mem_cgroup_put() helper, which helps to eliminate > guarding memcg css release with "#ifdef CONFIG_MEMCG" in multiple > places. > > Signed-off-by: Roman Gushchin Reviewed-by: Shakeel But

[PATCH v7 0/2] Directed kmem charging

2018-06-25 Thread Shakeel Butt
be used for charging and for buffer_head, the memcg of the page can be charged. For directed charging, the caller can use the scope API memalloc_[un]use_memcg() to specify the memcg to charge for all the __GFP_ACCOUNT allocations within the scope. Shakeel Butt (2): fs: fsnotify: account fsnotify

[PATCH 1/2] fs: fsnotify: account fsnotify metadata to kmemcg

2018-06-25 Thread Shakeel Butt
to the listener's memcg. Thus we save the memcg reference in the fsnotify_group structure of the listener. This patch has also moved the members of fsnotify_group to keep the size same, at least for 64 bit build, even with additional member by filling the holes. Signed-off-by: Shakeel Butt Cc: Michal

[PATCH 2/2] fs, mm: account buffer_head to kmemcg

2018-06-25 Thread Shakeel Butt
on the system. So, the right way to charge buffer_head is to extract the memcg from the page for which buffer_heads are being allocated and then use targeted memcg charging API. Signed-off-by: Shakeel Butt --- Changelog since v1: - simple code cleanups fs/buffer.c| 15

Re: [PATCH 1/2] fs: fsnotify: account fsnotify metadata to kmemcg

2018-06-26 Thread Shakeel Butt
On Mon, Jun 25, 2018 at 10:49 PM Amir Goldstein wrote: > ... > > The verb 'unuse' takes an argument memcg and 'uses' it - too weird. > You can use 'override'/'revert' verbs like override_creds or just call > memalloc_use_memcg(old_memcg) since there is no reference taken > anyway in use_memcg and

Re: [PATCH 1/2] fs: fsnotify: account fsnotify metadata to kmemcg

2018-06-26 Thread Shakeel Butt
On Tue, Jun 26, 2018 at 11:55 AM Johannes Weiner wrote: > > On Tue, Jun 26, 2018 at 11:00:53AM -0700, Shakeel Butt wrote: > > On Mon, Jun 25, 2018 at 10:49 PM Amir Goldstein wrote: > > > > > ... > > > > > > The verb 'unuse' takes an argument memcg

Re: [PATCH 1/2] fs: fsnotify: account fsnotify metadata to kmemcg

2018-06-26 Thread Shakeel Butt
On Tue, Jun 26, 2018 at 12:03 PM Johannes Weiner wrote: > > On Mon, Jun 25, 2018 at 04:06:58PM -0700, Shakeel Butt wrote: > > @@ -140,8 +141,9 @@ struct fanotify_event_info *fanotify_alloc_event(struct > > fsnotify_group *group, > >

[PATCH] kvm, mm: account shadow page tables to kmemcg

2018-06-27 Thread Shakeel Butt
The size of kvm's shadow page tables corresponds to the size of the guest virtual machines on the system. Large VMs can spend a significant amount of memory as shadow page tables which can not be left as system memory overhead. So, account shadow page tables to the kmemcg. Signed-off-by: Shakeel

[PATCH v8 0/2] Directed kmem charging

2018-06-27 Thread Shakeel Butt
be used for charging and for buffer_head, the memcg of the page can be charged. For directed charging, the caller can use the scope API memalloc_[un]use_memcg() to specify the memcg to charge for all the __GFP_ACCOUNT allocations within the scope. Shakeel Butt (2): fs: fsnotify: account fsnotify

[PATCH 2/2] fs, mm: account buffer_head to kmemcg

2018-06-27 Thread Shakeel Butt
on the system. So, the right way to charge buffer_head is to extract the memcg from the page for which buffer_heads are being allocated and then use targeted memcg charging API. Signed-off-by: Shakeel Butt Cc: Michal Hocko Cc: Jan Kara Cc: Amir Goldstein Cc: Greg Thelen Cc: Johannes Weiner Cc

[PATCH 1/2] fs: fsnotify: account fsnotify metadata to kmemcg

2018-06-27 Thread Shakeel Butt
to the listener's memcg. Thus we save the memcg reference in the fsnotify_group structure of the listener. This patch has also moved the members of fsnotify_group to keep the size same, at least for 64 bit build, even with additional member by filling the holes. Signed-off-by: Shakeel Butt Cc: Michal Hocko

Re: [RFC PATCH] net, mm: account sock objects to kmemcg

2018-06-27 Thread Shakeel Butt
On Wed, Jun 27, 2018 at 2:51 PM Eric Dumazet wrote: > > > > On 06/27/2018 01:41 PM, Shakeel Butt wrote: > > Currently the kernel accounts the memory for network traffic through > > mem_cgroup_[un]charge_skmem() interface. However the memory accounted > > only in

Re: [PATCH 1/2] fs: fsnotify: account fsnotify metadata to kmemcg

2018-06-28 Thread Shakeel Butt
On Thu, Jun 28, 2018 at 12:03 PM Jan Kara wrote: > > On Wed 27-06-18 12:12:49, Shakeel Butt wrote: > > A lot of memory can be consumed by the events generated for the huge or > > unlimited queues if there is either no or slow listener. This can cause > > system level memo

Re: [PATCH] doc: document scope NOFS, NOIO APIs

2018-05-24 Thread Shakeel Butt
On Thu, May 24, 2018 at 4:43 AM, Michal Hocko wrote: > From: Michal Hocko > > Although the api is documented in the source code Ted has pointed out > that there is no mention in the core-api Documentation and there are > people looking there to find answers how to use a specific API. > > Cc:

[PATCH] memcg: force charge kmem counter too

2018-05-25 Thread Shakeel Butt
m counter is set and reached. Signed-off-by: Shakeel Butt --- mm/memcontrol.c | 21 +++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index ab5673dbfc4e..0a88f824c550 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1893,6

Re: Possible regression in "slab, slub: skip unnecessary kasan_cache_shutdown()"

2018-06-18 Thread Shakeel Butt
On Mon, Jun 18, 2018 at 7:51 PM Jason A. Donenfeld wrote: > > Hello Shakeel, > > It may be the case that f9e13c0a5a33d1eaec374d6d4dab53a4f72756a0 has > introduced a regression. I've bisected a failing test to this commit, > and after staring at the my code for a long time, I'm unable to find a >

Re: Possible regression in "slab, slub: skip unnecessary kasan_cache_shutdown()"

2018-06-18 Thread Shakeel Butt
On Mon, Jun 18, 2018 at 9:08 PM Jason A. Donenfeld wrote: > > On Tue, Jun 19, 2018 at 5:59 AM Shakeel Butt wrote: > > Hi Jason, yes please do send me the test suite with the kernel config. > > $ git clone https://git.zx2c4.com/WireGuard > $ cd WireGuard/src > $ [[ $(gcc

[PATCH 3/3] fs, mm: account buffer_head to kmemcg

2018-06-18 Thread Shakeel Butt
on the system. So, the right way to charge buffer_head is to extract the memcg from the page for which buffer_heads are being allocated and then use targeted memcg charging API. Signed-off-by: Shakeel Butt Cc: Jan Kara Cc: Greg Thelen Cc: Michal Hocko Cc: Johannes Weiner Cc: Vladimir Davydov Cc

[PATCH 1/3] mm: memcg: remote memcg charging for kmem allocations

2018-06-18 Thread Shakeel Butt
interrupts. For now due to lack of actual use-case, targeted memcg charging for such allocations is not added. Though this might change in future. Signed-off-by: Shakeel Butt Cc: Michal Hocko Cc: Jan Kara Cc: Amir Goldstein Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Cc

[PATCH v6 0/3] Directed kmem charging

2018-06-18 Thread Shakeel Butt
for targeted memcg charging. So, all the __GFP_ACCOUNT alloctions within the specified scope will be charged to the given target memcg. Shakeel Butt (3): mm: memcg: remote memcg charging for kmem allocations fs: fsnotify: account fsnotify metadata to kmemcg fs, mm: account buffer_head to kmemcg

[PATCH 2/3] fs: fsnotify: account fsnotify metadata to kmemcg

2018-06-18 Thread Shakeel Butt
the allocations to the listener's memcg. Thus we save the memcg reference in the fsnotify_group structure of the listener. This patch has also moved the members of fsnotify_group to keep the size same, at least for 64 bit build, even with additional member by filling the holes. Signed-off-by: Shakeel

Re: [PATCH 2/3] fs: fsnotify: account fsnotify metadata to kmemcg

2018-06-19 Thread Shakeel Butt
On Tue, Jun 19, 2018 at 12:20 AM Amir Goldstein wrote: > > On Tue, Jun 19, 2018 at 8:13 AM, Shakeel Butt wrote: > > A lot of memory can be consumed by the events generated for the huge or > > unlimited queues if there is either no or slow listener. This can cause >

Re: Possible regression in "slab, slub: skip unnecessary kasan_cache_shutdown()"

2018-06-19 Thread Shakeel Butt
On Tue, Jun 19, 2018 at 6:05 AM Jason A. Donenfeld wrote: > > HI Dimitry, > > On Tue, Jun 19, 2018 at 6:55 AM Dmitry Vyukov wrote: > > Your code frees all entries before freeing the cache, right? If you > > add total_entries check before freeing the cache, it does not fire, > > right? > > Yes,

Re: Possible regression in "slab, slub: skip unnecessary kasan_cache_shutdown()"

2018-06-19 Thread Shakeel Butt
On Tue, Jun 19, 2018 at 8:19 AM Jason A. Donenfeld wrote: > > On Tue, Jun 19, 2018 at 5:08 PM Shakeel Butt wrote: > > > > Are you using SLAB or SLUB? We stress kernel pretty heavily, but with > > > > SLAB, and I suspect Shakeel may also be using SLAB. So

Re: [PATCH 3/3] fs, mm: account buffer_head to kmemcg

2018-06-19 Thread Shakeel Butt
On Tue, Jun 19, 2018 at 10:41 AM Roman Gushchin wrote: > > On Tue, Jun 19, 2018 at 12:27:41PM -0400, Johannes Weiner wrote: > > On Mon, Jun 18, 2018 at 10:13:27PM -0700, Shakeel Butt wrote: > > > The buffer_head can consume a significant amount of system memory and >

[PATCH] slub: fix __kmem_cache_empty for !CONFIG_SLUB_DEBUG

2018-06-19 Thread Shakeel Butt
that __kmem_cache_shutdown() and __kmem_cache_shrink() are not affected by !CONFIG_SLUB_DEBUG as they call flush_all() to clear per-cpu slabs. Fixes: f9e13c0a5a33 ("slab, slub: skip unnecessary kasan_cache_shutdown()") Signed-off-by: Shakeel Butt Reported-by: Jason A . Donenfeld Cc: Christoph L

Re: [PATCH] slub: fix __kmem_cache_empty for !CONFIG_SLUB_DEBUG

2018-06-19 Thread Shakeel Butt
On Tue, Jun 19, 2018 at 2:33 PM Shakeel Butt wrote: > > For !CONFIG_SLUB_DEBUG, SLUB does not maintain the number of slabs > allocated per node for a kmem_cache. Thus, slabs_node() in > __kmem_cache_empty() will always return 0. So, in such situation, it is > required to chec

Re: [PATCH v6 0/3] Directed kmem charging

2018-06-19 Thread Shakeel Butt
ils. Please fold patch 1 and introduce API along with the > users. > Thanks a lot for the review. Ack, I will do as you suggested in next version. > On Mon, Jun 18, 2018 at 10:13:24PM -0700, Shakeel Butt wrote: > > This patchset introduces memcg variant memory allocation functio

Re: [PATCH 1/3] mm: memcg: remote memcg charging for kmem allocations

2018-06-19 Thread Shakeel Butt
On Tue, Jun 19, 2018 at 9:22 AM Johannes Weiner wrote: > > On Mon, Jun 18, 2018 at 10:13:25PM -0700, Shakeel Butt wrote: > > @@ -248,6 +248,30 @@ static inline void memalloc_noreclaim_restore(unsigned > > int flags) > > current->flags = (current->

Re: [PATCH] slub: fix __kmem_cache_empty for !CONFIG_SLUB_DEBUG

2018-06-19 Thread Shakeel Butt
On Tue, Jun 19, 2018 at 5:49 PM David Rientjes wrote: > > On Tue, 19 Jun 2018, Shakeel Butt wrote: > > > diff --git a/mm/slub.c b/mm/slub.c > > index a3b8467c14af..731c02b371ae 100644 > > --- a/mm/slub.c > > +++ b/mm/slub.c > > @@ -3673,9 +3673,23 @@ static

[PATCH v2] kvm, mm: account shadow page tables to kmemcg

2018-06-29 Thread Shakeel Butt
The size of kvm's shadow page tables corresponds to the size of the guest virtual machines on the system. Large VMs can spend a significant amount of memory as shadow page tables which can not be left as system memory overhead. So, account shadow page tables to the kmemcg. Signed-off-by: Shakeel

Re: [PATCH v2] kvm, mm: account shadow page tables to kmemcg

2018-06-29 Thread Shakeel Butt
On Fri, Jun 29, 2018 at 7:55 AM Michal Hocko wrote: > > On Fri 29-06-18 16:40:23, Paolo Bonzini wrote: > > On 29/06/2018 16:30, Michal Hocko wrote: > > > I am not familiar wtih kvm to judge but if we are going to account this > > > memory we will probably want to let oom_badness know how much

[PATCH] fs-fsnotify-account-fsnotify-metadata-to-kmemcg.patch.cleanup

2018-07-02 Thread Shakeel Butt
Hi Andres, this is a small cleanup to the patch "fs: fsnotify: account fsnotify metadata to kmemcg". Please squash. Signed-off-by: Shakeel Butt --- fs/notify/fanotify/fanotify.c| 2 +- fs/notify/inotify/inotify_fsnotify.c | 2 +- 2 files changed, 2 insertions(+), 2 deletion

Re: [PATCH] fs-fsnotify-account-fsnotify-metadata-to-kmemcg.patch.cleanup

2018-07-02 Thread Shakeel Butt
On Mon, Jul 2, 2018 at 2:54 PM Shakeel Butt wrote: > > Hi Andres, this is a small cleanup to the patch "fs: fsnotify: account *Andrew* > fsnotify metadata to kmemcg". Please squash. > > Signed-off-by: Shakeel Butt > --- > fs/notify/fanotify/fanotify.c

[PATCH] fs-mm-account-buffer_head-to-kmemcg.patch.fix

2018-07-02 Thread Shakeel Butt
The patch "fs, mm: account buffer_head to kmemcg" missed to add __GFP_ACCOUNT flag into the gfp mask for directed memcg charging. So, adding it. Andrew, please squash this into the original patch. Signed-off-by: Shakeel Butt --- fs/buffer.c | 2 +- 1 file changed, 1 insertion(+),

Re: [PATCH v8 03/17] mm: Assign id to every memcg-aware shrinker

2018-07-03 Thread Shakeel Butt
On Tue, Jul 3, 2018 at 8:27 AM Matthew Wilcox wrote: > > On Tue, Jul 03, 2018 at 06:09:05PM +0300, Kirill Tkhai wrote: > > +++ b/mm/vmscan.c > > @@ -169,6 +169,49 @@ unsigned long vm_total_pages; > > static LIST_HEAD(shrinker_list); > > static DECLARE_RWSEM(shrinker_rwsem); > > > > +#ifdef

Re: [PATCH v8 03/17] mm: Assign id to every memcg-aware shrinker

2018-07-03 Thread Shakeel Butt
On Tue, Jul 3, 2018 at 9:17 AM Kirill Tkhai wrote: > > Hi, Shakeel, > > On 03.07.2018 18:46, Shakeel Butt wrote: > > On Tue, Jul 3, 2018 at 8:27 AM Matthew Wilcox wrote: > >> > >> On Tue, Jul 03, 2018 at 06:09:05PM +0300, Kirill Tkhai wrote: > >&g

Re: [PATCH 1/3] mm: introduce mem_cgroup_put() helper

2018-07-31 Thread Shakeel Butt
, I asked Roman to separate this change out and thus can be merged independently. Shakeel > > Link: http://lkml.kernel.org/r/20180623000600.5818-2-g...@fb.com > > Signed-off-by: Roman Gushchin > > Reviewed-by: Shakeel Butt > > Reviewed-by: Andrew Morton > > Cc: Sh

Re: [PATCH] memcg: force charge kmem counter too

2018-05-26 Thread Shakeel Butt
On Sat, May 26, 2018 at 11:51 AM, Vladimir Davydov wrote: > On Fri, May 25, 2018 at 11:55:01AM -0700, Shakeel Butt wrote: >> Based on several conditions the kernel can decide to force charge an >> allocation for a memcg i.e. overcharge memcg->memory and memcg->memsw >

Re: [PATCH v2] mm: fix race between kmem_cache destroy, create and deactivate

2018-05-26 Thread Shakeel Butt
On Sat, May 26, 2018 at 11:58 AM, Vladimir Davydov wrote: > On Tue, May 22, 2018 at 01:13:36PM -0700, Shakeel Butt wrote: >> The memcg kmem cache creation and deactivation (SLUB only) is >> asynchronous. If a root kmem cache is destroyed whose memcg cache is in >> th

Re: [PATCH] memcg: force charge kmem counter too

2018-05-28 Thread Shakeel Butt
On Mon, May 28, 2018 at 2:11 AM, Michal Hocko wrote: > On Sat 26-05-18 15:37:05, Shakeel Butt wrote: >> On Sat, May 26, 2018 at 11:51 AM, Vladimir Davydov >> wrote: >> > On Fri, May 25, 2018 at 11:55:01AM -0700, Shakeel Butt wrote: >> >> Based on several condi

Re: [PATCH v5 1/2] mm: memcg: remote memcg charging for kmem allocations

2018-06-05 Thread Shakeel Butt
On Mon, Apr 16, 2018 at 1:51 PM, Shakeel Butt wrote: > Introduce the memcg variant for kmalloc[_node] and > kmem_cache_alloc[_node]. For kmem_cache_alloc, the kernel switches the > root kmem cache with the memcg specific kmem cache for __GFP_ACCOUNT > allocations to charge those

Re: Showing /sys/fs/cgroup/memory/memory.stat very slow on some machines

2018-07-18 Thread Shakeel Butt
On Wed, Jul 18, 2018 at 7:29 AM Bruce Merry wrote: > > On 18 July 2018 at 12:42, Michal Hocko wrote: > > [CC some more people] > > > > On Tue 17-07-18 21:23:07, Andrew Morton wrote: > >> (cc linux-mm) > >> > >> On Tue, 3 Jul 2018 08:43:23 +0200 Bruce Merry wrote: > >> > >> > Hi > >> > > >> >

Re: Showing /sys/fs/cgroup/memory/memory.stat very slow on some machines

2018-07-18 Thread Shakeel Butt
On Wed, Jul 18, 2018 at 8:27 AM Bruce Merry wrote: > > On 18 July 2018 at 16:47, Michal Hocko wrote: > >> Thanks for looking into this. I'm not familiar with ftrace. Can you > >> give me a specific command line to run? Based on "perf record cat > >> /sys/fs/cgroup/memory/memory.stat"/"perf

Re: Showing /sys/fs/cgroup/memory/memory.stat very slow on some machines

2018-07-18 Thread Shakeel Butt
On Wed, Jul 18, 2018 at 8:37 AM Bruce Merry wrote: > > On 18 July 2018 at 17:26, Shakeel Butt wrote: > > On Wed, Jul 18, 2018 at 7:29 AM Bruce Merry wrote: > > It seems like you are using cgroup-v1. How many nodes are there in > > your memcg tree and also how many c

Re: Showing /sys/fs/cgroup/memory/memory.stat very slow on some machines

2018-07-18 Thread Shakeel Butt
On Wed, Jul 18, 2018 at 10:40 AM Bruce Merry wrote: > > On 18 July 2018 at 17:49, Shakeel Butt wrote: > > On Wed, Jul 18, 2018 at 8:37 AM Bruce Merry wrote: > >> That sounds promising. Is there any way to tell how many zombies there > >> are, and is there any way

Re: Showing /sys/fs/cgroup/memory/memory.stat very slow on some machines

2018-07-18 Thread Shakeel Butt
On Wed, Jul 18, 2018 at 10:58 AM Bruce Merry wrote: > > On 18 July 2018 at 19:48, Shakeel Butt wrote: > > On Wed, Jul 18, 2018 at 10:40 AM Bruce Merry wrote: > >> > Yes, very easy to produce zombies, though I don't think kernel > >> > provides an

Re: [PATCH v2] mm, memcg: fix reclaim deadlock with writeback

2018-12-12 Thread Shakeel Butt
On Wed, Dec 12, 2018 at 7:51 AM Michal Hocko wrote: > > From: Michal Hocko > > Liu Bo has experienced a deadlock between memcg (legacy) reclaim and the > ext4 writeback > task1: > [] wait_on_page_bit+0x82/0xa0 > [] shrink_page_list+0x907/0x960 > [] shrink_inactive_list+0x2c7/0x680 > []

Re: [PATCH] mm: handle no memcg case in memcg_kmem_charge() properly

2018-10-29 Thread Shakeel Butt
On Mon, Oct 29, 2018 at 2:52 PM Roman Gushchin wrote: > > Mike Galbraith reported a regression caused by the commit 9b6f7e163cd0 > ("mm: rework memcg kernel stack accounting") on a system with > "cgroup_disable=memory" boot option: the system panics with the > following stack trace: > >

Re: [PATCH] mm: handle no memcg case in memcg_kmem_charge() properly

2018-10-29 Thread Shakeel Butt
On Mon, Oct 29, 2018 at 6:01 PM Rik van Riel wrote: > > On Mon, 2018-10-29 at 17:50 -0700, Shakeel Butt wrote: > > On Mon, Oct 29, 2018 at 2:52 PM Roman Gushchin wrote: > > > > > > Mike Galbraith reported a regression caused by the commit > > > 9b6f7e163cd

Re: [PATCH] mm: handle no memcg case in memcg_kmem_charge() properly

2018-10-30 Thread Shakeel Butt
On Tue, Oct 30, 2018 at 8:56 AM Roman Gushchin wrote: > > On Tue, Oct 30, 2018 at 07:12:49AM +0100, Michal Hocko wrote: > > On Mon 29-10-18 21:51:55, Roman Gushchin wrote: > > > Mike Galbraith reported a regression caused by the commit 9b6f7e163cd0 > > > ("mm: rework memcg kernel stack

Re: [PATCH v2 1/3] mm: rework memcg kernel stack accounting

2018-08-21 Thread Shakeel Butt
of_tasks), which can't be released even by significant > memory pressure. > > As a cgroup structure can take a significant amount of memory > (first of all, per-cpu data like memcg statistics), it leads > to a noticeable waste of memory. > > Signed-off-by: Roman Gushchin Reviewed

Re: [RFC PATCH 2/2] mm: drain memcg stocks on css offlining

2018-08-14 Thread Shakeel Butt
heap. > > Signed-off-by: Roman Gushchin Seems reasonable. Reviewed-by: Shakeel Butt > Cc: Johannes Weiner > Cc: Michal Hocko > Cc: Konstantin Khlebnikov > Cc: Tejun Heo > --- > mm/memcontrol.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/mm/me

Re: [RFC PATCH 1/2] mm: rework memcg kernel stack accounting

2018-08-14 Thread Shakeel Butt
also looking into this issue. I was thinking of having a per-memcg per-cpu stack cache. However this solution seems much simpler. Can you also add the performance number for a similar simple benchmark done in ac496bf48d97 ("fork: Optimize task creation by caching two thread stacks per CPU if

Re: [RFC PATCH 1/2] mm: rework memcg kernel stack accounting

2018-08-15 Thread Shakeel Butt
On Wed, Aug 15, 2018 at 10:26 AM Roman Gushchin wrote: > > On Wed, Aug 15, 2018 at 10:12:42AM -0700, Andy Lutomirski wrote: > > > > > > > On Aug 15, 2018, at 9:55 AM, Roman Gushchin wrote: > > > > > >> On Wed, Aug 15, 2018 at 12:39:23PM -0400, Johannes Weiner wrote: > > >>> On Tue, Aug 14, 2018

Re: [PATCH v2 1/3] mm: introduce mem_cgroup_put() helper

2018-08-01 Thread Shakeel Butt
G" in multiple places. > > > > Link: http://lkml.kernel.org/r/20180623000600.5818-2-g...@fb.com > > Signed-off-by: Roman Gushchin > > Reviewed-by: Shakeel Butt > > Reviewed-by: Andrew Morton > > Acked-by: Johannes Weiner > > Acked-by: Michal Hocko

Re: [PATCH] mm: Move check for SHRINKER_NUMA_AWARE to do_shrink_slab()

2018-08-02 Thread Shakeel Butt
On Thu, Aug 2, 2018 at 9:47 AM Yang Shi wrote: > > On Thu, Aug 2, 2018 at 4:00 AM, Kirill Tkhai wrote: > > In case of shrink_slab_memcg() we do not zero nid, when shrinker > > is not numa-aware. This is not a real problem, since currently > > all memcg-aware shrinkers are numa-aware too (we have

Re: [PATCH v2 1/3] mm: rework memcg kernel stack accounting

2018-08-29 Thread Shakeel Butt
On Wed, Aug 29, 2018 at 2:24 PM Roman Gushchin wrote: > > On Tue, Aug 21, 2018 at 03:10:52PM -0700, Shakeel Butt wrote: > > On Tue, Aug 21, 2018 at 2:36 PM Roman Gushchin wrote: > > > > > > If CONFIG_VMAP_STACK is set, kernel stacks are allocated &g

Re: [PATCH RFC 00/10] Introduce lockless shrink_slab()

2018-08-07 Thread Shakeel Butt
quot; > > series, which is already in mm tree), all the evil in perf > > trace has moved from shrink_slab() to down_read_trylock(). > > As reported by Shakeel Butt: > > > > > I created 255 memcgs, 255 ext4 mounts and made each memcg create a >

Re: [PATCH RFC 01/10] rcu: Make CONFIG_SRCU unconditionally enabled

2018-08-08 Thread Shakeel Butt
On Wed, Aug 8, 2018 at 11:02 AM Josh Triplett wrote: > > On Wed, Aug 08, 2018 at 07:30:13PM +0300, Kirill Tkhai wrote: > > On 08.08.2018 19:23, Kirill Tkhai wrote: > > > On 08.08.2018 19:13, Josh Triplett wrote: > > >> On Wed, Aug 08, 2018 at 01:17:44PM +0300, Kirill Tkhai wrote: > > >>> On

Re: [PATCH] mm: fix inactive list balancing between NUMA nodes and cgroups

2019-04-15 Thread Shakeel Butt
sion in cache > workingset transition") > Signed-off-by: Johannes Weiner Reviewed-by: Shakeel Butt > --- > mm/vmscan.c | 29 + > 1 file changed, 9 insertions(+), 20 deletions(-) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index 347c

Re: [PATCH 4/5] mm: rework non-root kmem_cache lifecycle management

2019-04-17 Thread Shakeel Butt
On Wed, Apr 17, 2019 at 2:55 PM Roman Gushchin wrote: > > This commit makes several important changes in the lifecycle > of a non-root kmem_cache, which also affect the lifecycle > of a memory cgroup. > > Currently each charged slab page has a page->mem_cgroup pointer > to the memory cgroup and

Re: [PATCH 4/5] mm: rework non-root kmem_cache lifecycle management

2019-04-17 Thread Shakeel Butt
On Wed, Apr 17, 2019 at 5:39 PM Roman Gushchin wrote: > > On Wed, Apr 17, 2019 at 04:41:01PM -0700, Shakeel Butt wrote: > > On Wed, Apr 17, 2019 at 2:55 PM Roman Gushchin wrote: > > > > > > This commit makes several important changes in the lifecycle > > &g

Re: [PATCH 4/5] mm: rework non-root kmem_cache lifecycle management

2019-04-18 Thread Shakeel Butt
On Wed, Apr 17, 2019 at 8:07 PM Roman Gushchin wrote: > > On Wed, Apr 17, 2019 at 06:55:12PM -0700, Shakeel Butt wrote: > > On Wed, Apr 17, 2019 at 5:39 PM Roman Gushchin wrote: > > > > > > On Wed, Apr 17, 2019 at 04:41:01PM -0700, Shakeel Butt wrote: > >

[PATCH] memcg: refill_stock for kmem uncharging too

2019-04-18 Thread Shakeel Butt
not cause zombie apocalypse. Signed-off-by: Shakeel Butt --- mm/memcontrol.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 2535e54e7989..7b8de091f572 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -178,6 +178,7

Re: [PATCH v2 4/6] mm: unify SLAB and SLUB page accounting

2019-04-24 Thread Shakeel Butt
Hi Roman, On Tue, Apr 23, 2019 at 9:30 PM Roman Gushchin wrote: > > Currently the page accounting code is duplicated in SLAB and SLUB > internals. Let's move it into new (un)charge_slab_page helpers > in the slab_common.c file. These helpers will be responsible > for statistics (global and

Re: [PATCH v2 4/6] mm: unify SLAB and SLUB page accounting

2019-04-24 Thread Shakeel Butt
On Wed, Apr 24, 2019 at 12:17 PM Roman Gushchin wrote: > > On Wed, Apr 24, 2019 at 10:23:45AM -0700, Shakeel Butt wrote: > > Hi Roman, > > > > On Tue, Apr 23, 2019 at 9:30 PM Roman Gushchin wrote: > > > > > > Currently the page accounting code is d

Re: [PATCH] memcg: make it work on sparse non-0-node systems

2019-05-09 Thread Shakeel Butt
gt; > static inline struct list_lru_one * > > Yep, I didn't expect node 0 could ever be unavailable, my bad. > The patch looks fine to me: > > Acked-by: Vladimir Davydov > > However, I tend to agree with Michal that (ab)using node[0].memcg_lrus > to check if a list_lru is me

Re: [PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-09 Thread Shakeel Butt
er > Cc: Michal Hocko > Cc: Mel Gorman > Cc: "Kirill A . Shutemov" > Cc: Hugh Dickins > Signed-off-by: Yang Shi Nice find. Reviewed-by: Shakeel Butt > --- > I'm not quite sure if it was the intended behavior or just omission. I tried > to dig into the review

Re: [PATCH v3 1/7] mm: postpone kmem_cache memcg pointer initialization to memcg_link_cache()

2019-05-10 Thread Shakeel Butt
From: Roman Gushchin Date: Wed, May 8, 2019 at 1:30 PM To: Andrew Morton, Shakeel Butt Cc: , , , Johannes Weiner, Michal Hocko, Rik van Riel, Christoph Lameter, Vladimir Davydov, , Roman Gushchin > Initialize kmem_cache->memcg_params.memcg pointer in > memcg_link_cache() ra

Re: [PATCH v3 0/7] mm: reparent slab memory on cgroup removal

2019-05-10 Thread Shakeel Butt
From: Roman Gushchin Date: Wed, May 8, 2019 at 1:30 PM To: Andrew Morton, Shakeel Butt Cc: , , , Johannes Weiner, Michal Hocko, Rik van Riel, Christoph Lameter, Vladimir Davydov, , Roman Gushchin > # Why do we need this? > > We've noticed that the number of dying cgroups is steadil

Re: [PATCH v3 2/7] mm: generalize postponed non-root kmem_cache deactivation

2019-05-10 Thread Shakeel Butt
From: Roman Gushchin Date: Wed, May 8, 2019 at 1:30 PM To: Andrew Morton, Shakeel Butt Cc: , , , Johannes Weiner, Michal Hocko, Rik van Riel, Christoph Lameter, Vladimir Davydov, , Roman Gushchin > Currently SLUB uses a work scheduled after an RCU grace period > to deactivate a no

Re: [PATCH v3 3/7] mm: introduce __memcg_kmem_uncharge_memcg()

2019-05-10 Thread Shakeel Butt
From: Roman Gushchin Date: Wed, May 8, 2019 at 1:30 PM To: Andrew Morton, Shakeel Butt Cc: , , , Johannes Weiner, Michal Hocko, Rik van Riel, Christoph Lameter, Vladimir Davydov, , Roman Gushchin > Let's separate the page counter modification code out of > __memcg_kmem_uncharge() in

<    4   5   6   7   8   9   10   11   12   >