Re: [PATCH] mm: idle-page: fix oops because end_pfn is larger than max_pfn

2019-06-18 Thread Vladimir Davydov
gt; cc Vladimir. This seems rather obvious - I'm wondering if the code was > that way for some subtle reason? No subtle reason at all - just a bug. The patch looks good to me, Acked-by: Vladimir Davydov

Re: [PATCH v7 10/10] mm: reparent memcg kmem_caches on cgroup removal

2019-06-16 Thread Vladimir Davydov
IMABLE and NR_SLAB_UNRECLAIMABLE) > aren't used anywhere except count_shadow_nodes(). But even there it > won't break anything: after reparenting "nodes" will be 0 on child > level (because we're already reparenting shrinker lists), and on > parent level page stats always were 0, and this patch won't change > anything. > > Signed-off-by: Roman Gushchin Acked-by: Vladimir Davydov

Re: [PATCH v7 07/10] mm: synchronize access to kmem_cache dying flag using a spinlock

2019-06-16 Thread Vladimir Davydov
the irq context, > which will be required in order to implement asynchronous release > of kmem_caches. > > So let's switch over to the irq-save flavor of the spinlock-based > synchronization. > > Signed-off-by: Roman Gushchin Acked-by: Vladimir Davydov

Re: [PATCH v7 06/10] mm: don't check the dying flag on kmem_cache creation

2019-06-16 Thread Vladimir Davydov
n be scheduled after the flag is set. And if it was > scheduled before, flush_memcg_workqueue() will wait for it anyway. > > So let's drop this check to simplify the code. > > Signed-off-by: Roman Gushchin Acked-by: Vladimir Davydov

Re: [PATCH v6 10/10] mm: reparent slab memory on cgroup removal

2019-06-09 Thread Vladimir Davydov
On Tue, Jun 04, 2019 at 07:44:54PM -0700, Roman Gushchin wrote: > Let's reparent memcg slab memory on memcg offlining. This allows us > to release the memory cgroup without waiting for the last outstanding > kernel object (e.g. dentry used by another application). > > So instead of reparenting all

Re: [PATCH v6 09/10] mm: stop setting page->mem_cgroup pointer for slab pages

2019-06-09 Thread Vladimir Davydov
roup from going away. Instead rely on kmem_cache > as an intermediate object. > > Make sure that vmstats and shrinker lists are working as previously, > as well as /proc/kpagecgroup interface. > > Signed-off-by: Roman Gushchin Acked-by: Vladimir Davydov

Re: [PATCH v6 08/10] mm: rework non-root kmem_cache lifecycle management

2019-06-09 Thread Vladimir Davydov
user 0m0.216suser0m0.181s > sys 0m0.824ssys 0m0.864s > > real 0m1.350sreal0m1.295s > user 0m0.200suser0m0.190s > sys 0m0.842ssys 0m0.811s > > So it looks like the difference is not noticeable in this test. > > Signed-off-by: Roman Gushchin Acked-by: Vladimir Davydov

Re: [PATCH v6 07/10] mm: synchronize access to kmem_cache dying flag using a spinlock

2019-06-09 Thread Vladimir Davydov
On Tue, Jun 04, 2019 at 07:44:51PM -0700, Roman Gushchin wrote: > Currently the memcg_params.dying flag and the corresponding > workqueue used for the asynchronous deactivation of kmem_caches > is synchronized using the slab_mutex. > > It makes impossible to check this flag from the irq context, >

Re: [PATCH v6 05/10] mm: introduce __memcg_kmem_uncharge_memcg()

2019-06-09 Thread Vladimir Davydov
de later using a new > memcg_kmem_uncharge_memcg() wrapper, which calls > __memcg_kmem_uncharge_memcg() if memcg_kmem_enabled() > check is passed. > > Signed-off-by: Roman Gushchin > Reviewed-by: Shakeel Butt Acked-by: Vladimir Davydov

Re: [PATCH v6 04/10] mm: generalize postponed non-root kmem_cache deactivation

2019-06-09 Thread Vladimir Davydov
act_after_rcu() SLUB-only > > For consistency, all allocator-specific functions start with "__". > > Signed-off-by: Roman Gushchin Much easier to review after extracting renaming, thanks. Acked-by: Vladimir Davydov

Re: [PATCH v6 03/10] mm: rename slab delayed deactivation functions and fields

2019-06-09 Thread Vladimir Davydov
_head > deact_work -> work > > And RCU/delayed work callbacks in slab common code: > kmemcg_deactivate_rcufn -> kmemcg_rcufn > kmemcg_deactivate_workfn -> kmemcg_workfn > > This patch contains no functional changes, only renamings. > > Signed-off-by: Roman Gushchin Acked-by: Vladimir Davydov

Re: [PATCH v6 01/10] mm: add missing smp read barrier on getting memcg kmem_cache pointer

2019-06-09 Thread Vladimir Davydov
On Tue, Jun 04, 2019 at 07:44:45PM -0700, Roman Gushchin wrote: > Johannes noticed that reading the memcg kmem_cache pointer in > cache_from_memcg_idx() is performed using READ_ONCE() macro, > which doesn't implement a SMP barrier, which is required > by the logic. > > Add a proper smp_rmb() to be

Re: [PATCH v5 6/7] mm: reparent slab memory on cgroup removal

2019-05-28 Thread Vladimir Davydov
On Tue, May 28, 2019 at 07:58:17PM +, Roman Gushchin wrote: > It looks like outstanding questions are: > 1) synchronization around the dying flag > 2) removing CONFIG_SLOB in 2/7 > 3) early sysfs_slab_remove() > 4) mem_cgroup_from_kmem in 7/7 > > Please, let me know if I missed anything. Also

Re: [PATCH v5 6/7] mm: reparent slab memory on cgroup removal

2019-05-28 Thread Vladimir Davydov
On Tue, May 21, 2019 at 01:07:34PM -0700, Roman Gushchin wrote: > Let's reparent memcg slab memory on memcg offlining. This allows us > to release the memory cgroup without waiting for the last outstanding > kernel object (e.g. dentry used by another application). > > So instead of reparenting all

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

2019-05-28 Thread Vladimir Davydov
On Tue, May 28, 2019 at 08:08:28PM +0300, Vladimir Davydov wrote: > Hello Roman, > > On Tue, May 21, 2019 at 01:07:33PM -0700, Roman Gushchin wrote: > > This commit makes several important changes in the lifecycle > > of a non-root kmem_cache, which also affect the life

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

2019-05-28 Thread Vladimir Davydov
On Tue, May 28, 2019 at 01:37:50PM -0400, Waiman Long wrote: > On 5/28/19 1:08 PM, Vladimir Davydov wrote: > >> static void flush_memcg_workqueue(struct kmem_cache *s) > >> { > >> + /* > >> + * memcg_params.dying is synchronized using slab_mutex AND

Re: [PATCH v5 7/7] mm: fix /proc/kpagecgroup interface for slab pages

2019-05-28 Thread Vladimir Davydov
On Tue, May 21, 2019 at 01:07:35PM -0700, Roman Gushchin wrote: > Switching to an indirect scheme of getting mem_cgroup pointer for > !root slab pages broke /proc/kpagecgroup interface for them. > > Let's fix it by learning page_cgroup_ino() how to get memcg > pointer for slab pages. > > Reported

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

2019-05-28 Thread Vladimir Davydov
> > For non-root kmem_caches memcg_link_cache() is always called > before the kmem_cache becomes visible to a user, so it's safe. > > Signed-off-by: Roman Gushchin > Reviewed-by: Shakeel Butt This one is a no-brainer. Acked-by: Vladimir Davydov Provided it's necessary for the rest of the series.

Re: [PATCH v5 4/7] mm: unify SLAB and SLUB page accounting

2019-05-28 Thread Vladimir Davydov
(global and memcg-aware) and memcg charging. > So they are replacing direct memcg_(un)charge_slab() calls. > > Signed-off-by: Roman Gushchin > Reviewed-by: Shakeel Butt > Acked-by: Christoph Lameter Makes sense even without the rest of the series, Acked-by: Vladimir Davydov

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

2019-05-28 Thread Vladimir Davydov
On Tue, May 21, 2019 at 01:07:30PM -0700, Roman Gushchin wrote: > diff --git a/mm/slab_common.c b/mm/slab_common.c > index 6e00bdf8618d..4e5b4292a763 100644 > --- a/mm/slab_common.c > +++ b/mm/slab_common.c > @@ -866,11 +859,12 @@ static void flush_memcg_workqueue(struct kmem_cache *s) > mute

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

2019-05-28 Thread Vladimir Davydov
Hello Roman, On Tue, May 21, 2019 at 01:07:33PM -0700, 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 th

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

2019-05-17 Thread Vladimir Davydov
On Fri, May 17, 2019 at 06:48:37AM +0200, Jiri Slaby wrote: > On 16. 05. 19, 15:59, Michal Hocko wrote: > >> However, I tend to agree with Michal that (ab)using node[0].memcg_lrus > >> to check if a list_lru is memcg aware looks confusing. I guess we could > >> simply add a bool flag to list_lru in

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

2019-05-09 Thread Vladimir Davydov
; > The root cause are list_lru_memcg_aware checks in the list_lru code. > The test in list_lru_memcg_aware is broken: it assumes node 0 is always > present, but it is not true on some systems as can be seen above. > > So fix this by checking the first online node instead of node 0

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

2019-04-18 Thread Vladimir Davydov
Hello Roman, On Wed, Apr 17, 2019 at 02:54:29PM -0700, Roman Gushchin wrote: > There is however a significant problem with reparenting of slab memory: > there is no list of charged pages. Some of them are in shrinker lists, > but not all. Introducing of a new list is really not an option. True, i

Re: [PATCH] mm: slowly shrink slabs with a relatively small number of objects

2018-09-04 Thread Vladimir Davydov
On Tue, Sep 04, 2018 at 10:52:46AM -0700, Roman Gushchin wrote: > Reparenting of all pages is definitely an option to consider, Reparenting pages would be great indeed, but I'm not sure we could do that, because we'd have to walk over page lists of semi-active kmem caches and do it consistently wh

Re: [PATCH] memcg: Remove memcg_cgroup::id from IDR on mem_cgroup_css_alloc() failure

2018-08-01 Thread Vladimir Davydov
On Wed, Aug 01, 2018 at 11:55:52AM -0400, Johannes Weiner wrote: > On Tue, Jul 31, 2018 at 04:39:08PM -0700, Andrew Morton wrote: > > On Mon, 30 Jul 2018 11:31:13 -0400 Johannes Weiner > > wrote: > > > > > Subject: [PATCH] mm: memcontrol: simplify memcg idr allocation and error > > > unwinding

Re: [PATCH] memcg: Remove memcg_cgroup::id from IDR on mem_cgroup_css_alloc() failure

2018-08-01 Thread Vladimir Davydov
On Mon, Jul 30, 2018 at 11:31:13AM -0400, Johannes Weiner wrote: > On Sun, Jul 29, 2018 at 10:26:21PM +0300, Vladimir Davydov wrote: > > On Fri, Jul 27, 2018 at 03:31:34PM -0400, Johannes Weiner wrote: > > > That said, the lifetime of the root reference on the ID is the online &

Re: [PATCH] memcg: Remove memcg_cgroup::id from IDR on mem_cgroup_css_alloc() failure

2018-07-29 Thread Vladimir Davydov
On Fri, Jul 27, 2018 at 03:31:34PM -0400, Johannes Weiner wrote: > That said, the lifetime of the root reference on the ID is the online > state, we put that in css_offline. Is there a reason we need to have > the ID ready and the memcg in the IDR before onlining it? I fail to see any reason for t

Re: [PATCH v8 05/17] mm: Assign memcg-aware shrinkers bitmap to memcg

2018-07-06 Thread Vladimir Davydov
On Thu, Jul 05, 2018 at 03:10:30PM -0700, Andrew Morton wrote: > On Wed, 4 Jul 2018 18:51:12 +0300 Kirill Tkhai wrote: > > > > - why aren't we decreasing shrinker_nr_max in > > > unregister_memcg_shrinker()? That's easy to do, avoids pointless > > > work in shrink_slab_memcg() and avoids mem

Re: [PATCH v8 05/17] mm: Assign memcg-aware shrinkers bitmap to memcg

2018-07-06 Thread Vladimir Davydov
On Tue, Jul 03, 2018 at 01:50:00PM -0700, Andrew Morton wrote: > On Tue, 03 Jul 2018 18:09:26 +0300 Kirill Tkhai wrote: > > > Imagine a big node with many cpus, memory cgroups and containers. > > Let we have 200 containers, every container has 10 mounts, > > and 10 cgroups. All container tasks do

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

2018-06-12 Thread Vladimir Davydov
k the cache as > dying and flush the workqueue used for memcg kmem cache creation and > deactivation. SLUB's memcg kmem cache deactivation also includes RCU > callback and thus make sure all previous registered RCU callbacks > have completed as well. > > Signed-off-by: Shakeel Butt Acked-by: Vladimir Davydov Thanks.

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

2018-06-09 Thread Vladimir Davydov
On Tue, May 29, 2018 at 05:12:04PM -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 > the process of creation or deactivation, the kernel may crash. > > Example of one such crash: >

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

2018-05-26 Thread Vladimir Davydov
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 > the process of creation or deactivation, the kernel may crash. > > Example of one such crash: >

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

2018-05-26 Thread Vladimir Davydov
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 > counters. Do the same for memcg->kmem counter too. In cgroup-v1, this > bug can cause a __GF

Re: [PATCH v7 00/17] Improve shrink_slab() scalability (old complexity was O(n^2), new is O(n))

2018-05-26 Thread Vladimir Davydov
Hello Kirill, The whole patch set looks good to me now. Acked-by: Vladimir Davydov Thanks, Vladimir On Tue, May 22, 2018 at 01:07:10PM +0300, Kirill Tkhai wrote: > Hi, > > this patches solves the problem with slow shrink_slab() occuring > on the machines having many shrinker

Re: [PATCH v6 05/17] mm: Assign memcg-aware shrinkers bitmap to memcg

2018-05-21 Thread Vladimir Davydov
On Mon, May 21, 2018 at 01:16:40PM +0300, Kirill Tkhai wrote: > >> +static int memcg_expand_one_shrinker_map(struct mem_cgroup *memcg, > >> + int size, int old_size) > > > > Nit: No point in passing old_size here. You can instead use > > memcg_shrinker_map_size di

Re: [PATCH v6 12/17] mm: Set bit in memcg shrinker bitmap on first list_lru item apearance

2018-05-21 Thread Vladimir Davydov
On Mon, May 21, 2018 at 12:31:34PM +0300, Kirill Tkhai wrote: > On 20.05.2018 10:55, Vladimir Davydov wrote: > > On Fri, May 18, 2018 at 11:43:42AM +0300, Kirill Tkhai wrote: > >> Introduce set_shrinker_bit() function to set shrinker-related > >> bit in memcg shrinker bi

Re: [PATCH v6 14/17] mm: Iterate only over charged shrinkers during memcg shrink_slab()

2018-05-21 Thread Vladimir Davydov
On Mon, May 21, 2018 at 12:17:07PM +0300, Kirill Tkhai wrote: > >> +static unsigned long shrink_slab_memcg(gfp_t gfp_mask, int nid, > >> + struct mem_cgroup *memcg, int priority) > >> +{ > >> + struct memcg_shrinker_map *map; > >> + unsigned long freed = 0; > >> + int ret, i; >

Re: [PATCH v6 15/17] mm: Generalize shrink_slab() calls in shrink_node()

2018-05-20 Thread Vladimir Davydov
On Fri, May 18, 2018 at 11:44:11AM +0300, Kirill Tkhai wrote: > From: Vladimir Davydov > > The patch makes shrink_slab() be called for root_mem_cgroup > in the same way as it's called for the rest of cgroups. > This simplifies the logic and improves the readability. > &g

Re: [PATCH v6 14/17] mm: Iterate only over charged shrinkers during memcg shrink_slab()

2018-05-20 Thread Vladimir Davydov
On Fri, May 18, 2018 at 11:44:01AM +0300, Kirill Tkhai wrote: > Using the preparations made in previous patches, in case of memcg > shrink, we may avoid shrinkers, which are not set in memcg's shrinkers > bitmap. To do that, we separate iterations over memcg-aware and > !memcg-aware shrinkers, and

Re: [PATCH v6 13/17] mm: Export mem_cgroup_is_root()

2018-05-20 Thread Vladimir Davydov
On Fri, May 18, 2018 at 11:43:53AM +0300, Kirill Tkhai wrote: > This will be used in next patch. > > Signed-off-by: Kirill Tkhai > --- > include/linux/memcontrol.h | 10 ++ > mm/memcontrol.c|5 - > 2 files changed, 10 insertions(+), 5 deletions(-) > > diff --git a/

Re: [PATCH v6 12/17] mm: Set bit in memcg shrinker bitmap on first list_lru item apearance

2018-05-20 Thread Vladimir Davydov
On Fri, May 18, 2018 at 11:43:42AM +0300, Kirill Tkhai wrote: > Introduce set_shrinker_bit() function to set shrinker-related > bit in memcg shrinker bitmap, and set the bit after the first > item is added and in case of reparenting destroyed memcg's items. > > This will allow next patch to make s

Re: [PATCH v6 05/17] mm: Assign memcg-aware shrinkers bitmap to memcg

2018-05-20 Thread Vladimir Davydov
On Fri, May 18, 2018 at 11:42:37AM +0300, Kirill Tkhai wrote: > Imagine a big node with many cpus, memory cgroups and containers. > Let we have 200 containers, every container has 10 mounts, > and 10 cgroups. All container tasks don't touch foreign > containers mounts. If there is intensive pages w

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

2018-05-20 Thread Vladimir Davydov
Hello Kirill, Generally, all patches in the series look OK to me, but I'm going to do some nitpicking before I ack them. See below. On Fri, May 18, 2018 at 11:42:08AM +0300, Kirill Tkhai wrote: > The patch introduces shrinker::id number, which is used to enumerate > memcg-aware shrinkers. The num

Re: [PATCH v5 11/13] mm: Iterate only over charged shrinkers during memcg shrink_slab()

2018-05-17 Thread Vladimir Davydov
On Thu, May 17, 2018 at 02:49:26PM +0300, Kirill Tkhai wrote: > On 17.05.2018 07:16, Vladimir Davydov wrote: > > On Tue, May 15, 2018 at 05:49:59PM +0300, Kirill Tkhai wrote: > >>>> @@ -589,13 +647,7 @@ static unsigned long shrink_slab(gfp_t g

Re: [PATCH v5 13/13] mm: Clear shrinker bit if there are no objects related to memcg

2018-05-16 Thread Vladimir Davydov
On Tue, May 15, 2018 at 11:55:04AM +0300, Kirill Tkhai wrote: > >> @@ -586,8 +586,23 @@ static unsigned long shrink_slab_memcg(gfp_t > >> gfp_mask, int nid, > >>continue; > >> > >>ret = do_shrink_slab(&sc, shrinker, priority); > >> - if (ret == SHRINK_EMP

Re: [PATCH v5 11/13] mm: Iterate only over charged shrinkers during memcg shrink_slab()

2018-05-16 Thread Vladimir Davydov
On Tue, May 15, 2018 at 01:12:20PM +0300, Kirill Tkhai wrote: > >> +#define root_mem_cgroup NULL > > > > Let's instead export mem_cgroup_is_root(). In case if MEMCG is disabled > > it will always return false. > > export == move to header file That and adding a stub function in case !MEMCG. > >

Re: [PATCH v5 11/13] mm: Iterate only over charged shrinkers during memcg shrink_slab()

2018-05-16 Thread Vladimir Davydov
On Tue, May 15, 2018 at 05:49:59PM +0300, Kirill Tkhai wrote: > >> @@ -589,13 +647,7 @@ static unsigned long shrink_slab(gfp_t gfp_mask, int > >> nid, > >>.memcg = memcg, > >>}; > >> > >> - /* > >> - * If kernel memory accounting is disabled, we

Re: [PATCH v5 13/13] mm: Clear shrinker bit if there are no objects related to memcg

2018-05-14 Thread Vladimir Davydov
On Thu, May 10, 2018 at 12:54:15PM +0300, Kirill Tkhai wrote: > To avoid further unneed calls of do_shrink_slab() > for shrinkers, which already do not have any charged > objects in a memcg, their bits have to be cleared. > > This patch introduces a lockless mechanism to do that > without races wi

Re: [PATCH v5 11/13] mm: Iterate only over charged shrinkers during memcg shrink_slab()

2018-05-14 Thread Vladimir Davydov
On Thu, May 10, 2018 at 12:53:55PM +0300, Kirill Tkhai wrote: > Using the preparations made in previous patches, in case of memcg > shrink, we may avoid shrinkers, which are not set in memcg's shrinkers > bitmap. To do that, we separate iterations over memcg-aware and > !memcg-aware shrinkers, and

Re: [PATCH v5 10/13] mm: Set bit in memcg shrinker bitmap on first list_lru item apearance

2018-05-14 Thread Vladimir Davydov
On Thu, May 10, 2018 at 12:53:45PM +0300, Kirill Tkhai wrote: > Introduce set_shrinker_bit() function to set shrinker-related > bit in memcg shrinker bitmap, and set the bit after the first > item is added and in case of reparenting destroyed memcg's items. > > This will allow next patch to make s

Re: [PATCH v5 03/13] mm: Assign memcg-aware shrinkers bitmap to memcg

2018-05-14 Thread Vladimir Davydov
On Mon, May 14, 2018 at 12:34:45PM +0300, Kirill Tkhai wrote: > >> +static void memcg_free_shrinker_maps(struct mem_cgroup *memcg) > >> +{ > >> + struct mem_cgroup_per_node *pn; > >> + struct memcg_shrinker_map *map; > >> + int nid; > >> + > >> + if (memcg == root_mem_cgroup) > >> + re

Re: [PATCH v5 01/13] mm: Assign id to every memcg-aware shrinker

2018-05-14 Thread Vladimir Davydov
On Mon, May 14, 2018 at 12:03:38PM +0300, Kirill Tkhai wrote: > On 13.05.2018 08:15, Vladimir Davydov wrote: > > On Thu, May 10, 2018 at 12:52:18PM +0300, Kirill Tkhai wrote: > >> The patch introduces shrinker::id number, which is used to enumerate > >> memcg-aware shrin

Re: [PATCH v5 06/13] fs: Propagate shrinker::id to list_lru

2018-05-13 Thread Vladimir Davydov
On Thu, May 10, 2018 at 12:53:06PM +0300, Kirill Tkhai wrote: > The patch adds list_lru::shrinker_id field, and populates > it by registered shrinker id. > > This will be used to set correct bit in memcg shrinkers > map by lru code in next patches, after there appeared > the first related to memcg

Re: [PATCH v5 03/13] mm: Assign memcg-aware shrinkers bitmap to memcg

2018-05-13 Thread Vladimir Davydov
On Thu, May 10, 2018 at 12:52:36PM +0300, Kirill Tkhai wrote: > Imagine a big node with many cpus, memory cgroups and containers. > Let we have 200 containers, every container has 10 mounts, > and 10 cgroups. All container tasks don't touch foreign > containers mounts. If there is intensive pages w

Re: [PATCH v5 01/13] mm: Assign id to every memcg-aware shrinker

2018-05-12 Thread Vladimir Davydov
On Thu, May 10, 2018 at 12:52:18PM +0300, Kirill Tkhai wrote: > The patch introduces shrinker::id number, which is used to enumerate > memcg-aware shrinkers. The number start from 0, and the code tries > to maintain it as small as possible. > > This will be used as to represent a memcg-aware shrin

Re: [PATCH v2 04/12] mm: Assign memcg-aware shrinkers bitmap to memcg

2018-04-28 Thread Vladimir Davydov
On Tue, Apr 24, 2018 at 03:24:53PM +0300, Kirill Tkhai wrote: > >> +int expand_shrinker_maps(int old_nr, int nr) > >> +{ > >> + int id, size, old_size, node, ret; > >> + struct mem_cgroup *memcg; > >> + > >> + old_size = old_nr / BITS_PER_BYTE; > >> +

Re: [PATCH v2] mm: introduce memory.min

2018-04-25 Thread Vladimir Davydov
On Tue, Apr 24, 2018 at 02:54:15PM +0100, Roman Gushchin wrote: > > On Mon, Apr 23, 2018 at 01:36:10PM +0100, Roman Gushchin wrote: > > > + memory.min > > > + A read-write single value file which exists on non-root > > > + cgroups. The default is "0". > > > + > > > + Hard memory protection. If t

Re: [PATCH v2] mm: introduce memory.min

2018-04-24 Thread Vladimir Davydov
Hi Roman, On Mon, Apr 23, 2018 at 01:36:10PM +0100, Roman Gushchin wrote: > + memory.min > + A read-write single value file which exists on non-root > + cgroups. The default is "0". > + > + Hard memory protection. If the memory usage of a cgroup > + is within its effective min b

Re: [PATCH v2 04/12] mm: Assign memcg-aware shrinkers bitmap to memcg

2018-04-24 Thread Vladimir Davydov
On Tue, Apr 24, 2018 at 02:38:51PM +0300, Kirill Tkhai wrote: > On 24.04.2018 14:28, Vladimir Davydov wrote: > > On Mon, Apr 23, 2018 at 01:54:50PM +0300, Kirill Tkhai wrote: > >>>> @@ -1200,6 +1206,8 @@ extern int memcg_nr_cache_ids; > >>>> void

Re: [PATCH v2 04/12] mm: Assign memcg-aware shrinkers bitmap to memcg

2018-04-24 Thread Vladimir Davydov
On Mon, Apr 23, 2018 at 01:54:50PM +0300, Kirill Tkhai wrote: > >> @@ -1200,6 +1206,8 @@ extern int memcg_nr_cache_ids; > >> void memcg_get_cache_ids(void); > >> void memcg_put_cache_ids(void); > >> > >> +extern int shrinkers_max_nr; > >> + > > > > memcg_shrinker_id_max? > > memcg_shrinker_id

Re: [PATCH v2 04/12] mm: Assign memcg-aware shrinkers bitmap to memcg

2018-04-24 Thread Vladimir Davydov
On Mon, Apr 23, 2018 at 02:06:31PM +0300, Kirill Tkhai wrote: > >> diff --git a/mm/vmscan.c b/mm/vmscan.c > >> index 4f02fe83537e..f63eb5596c35 100644 > >> --- a/mm/vmscan.c > >> +++ b/mm/vmscan.c > >> @@ -172,6 +172,22 @@ static DECLARE_RWSEM(shrinker_rwsem); > >> #if defined(CONFIG_MEMCG) && !de

Re: [PATCH v2 12/12] mm: Clear shrinker bit if there are no objects related to memcg

2018-04-24 Thread Vladimir Davydov
On Mon, Apr 23, 2018 at 01:01:08PM +0300, Kirill Tkhai wrote: > On 22.04.2018 21:21, Vladimir Davydov wrote: > > On Tue, Apr 17, 2018 at 09:54:51PM +0300, Kirill Tkhai wrote: > >> To avoid further unneed calls of do_shrink_slab() > >> for shrinkers, which alre

Re: [PATCH v2 12/12] mm: Clear shrinker bit if there are no objects related to memcg

2018-04-22 Thread Vladimir Davydov
On Tue, Apr 17, 2018 at 09:54:51PM +0300, Kirill Tkhai wrote: > To avoid further unneed calls of do_shrink_slab() > for shrinkers, which already do not have any charged > objects in a memcg, their bits have to be cleared. > > This patch introduces a lockless mechanism to do that > without races wi

Re: [PATCH v2 10/12] mm: Iterate only over charged shrinkers during memcg shrink_slab()

2018-04-22 Thread Vladimir Davydov
On Tue, Apr 17, 2018 at 09:54:34PM +0300, Kirill Tkhai wrote: > Using the preparations made in previous patches, in case of memcg > shrink, we may avoid shrinkers, which are not set in memcg's shrinkers > bitmap. To do that, we separate iterations over memcg-aware and > !memcg-aware shrinkers, and

Re: [PATCH v2 05/12] fs: Propagate shrinker::id to list_lru

2018-04-22 Thread Vladimir Davydov
On Tue, Apr 17, 2018 at 09:53:47PM +0300, Kirill Tkhai wrote: > The patch adds list_lru::shrinker_id field, and populates > it by registered shrinker id. > > This will be used to set correct bit in memcg shrinkers > map by lru code in next patches, after there appeared > the first related to memcg

Re: [PATCH v2 04/12] mm: Assign memcg-aware shrinkers bitmap to memcg

2018-04-22 Thread Vladimir Davydov
On Tue, Apr 17, 2018 at 09:53:31PM +0300, Kirill Tkhai wrote: > Imagine a big node with many cpus, memory cgroups and containers. > Let we have 200 containers, every container has 10 mounts, > and 10 cgroups. All container tasks don't touch foreign > containers mounts. If there is intensive pages w

Re: [PATCH v2 01/12] mm: Assign id to every memcg-aware shrinker

2018-04-22 Thread Vladimir Davydov
On Tue, Apr 17, 2018 at 09:53:02PM +0300, Kirill Tkhai wrote: > The patch introduces shrinker::id number, which is used to enumerate > memcg-aware shrinkers. The number start from 0, and the code tries > to maintain it as small as possible. > > This will be used as to represent a memcg-aware shrin

Re: [PATCH 01/10] mm: Assign id to every memcg-aware shrinker

2018-03-28 Thread Vladimir Davydov
On Wed, Mar 28, 2018 at 01:30:20PM +0300, Kirill Tkhai wrote: > On 27.03.2018 18:48, Vladimir Davydov wrote: > > On Tue, Mar 27, 2018 at 06:09:20PM +0300, Kirill Tkhai wrote: > >>>>>> diff --git a/mm/vmscan.c b/mm/vmscan.c > >>>>>> index 8fcd9f8d7

Re: [PATCH 01/10] mm: Assign id to every memcg-aware shrinker

2018-03-27 Thread Vladimir Davydov
On Tue, Mar 27, 2018 at 06:09:20PM +0300, Kirill Tkhai wrote: > diff --git a/mm/vmscan.c b/mm/vmscan.c > index 8fcd9f8d7390..91b5120b924f 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -159,6 +159,56 @@ unsigned long vm_total_pages; > static LIST_HEAD(shrinker_li

Re: [PATCH 03/10] mm: Assign memcg-aware shrinkers bitmap to memcg

2018-03-27 Thread Vladimir Davydov
On Mon, Mar 26, 2018 at 06:29:05PM +0300, Kirill Tkhai wrote: > >> @@ -182,6 +187,9 @@ struct mem_cgroup { > >>unsigned long low; > >>unsigned long high; > >> > >> + /* Bitmap of shrinker ids suitable to call for this memcg */ > >> + struct shrinkers_map __rcu *shrinkers_map; > >> + > >

Re: [PATCH 02/10] mm: Maintain memcg-aware shrinkers in mcg_shrinkers array

2018-03-27 Thread Vladimir Davydov
On Mon, Mar 26, 2018 at 06:20:55PM +0300, Kirill Tkhai wrote: > On 24.03.2018 21:45, Vladimir Davydov wrote: > > On Wed, Mar 21, 2018 at 04:21:29PM +0300, Kirill Tkhai wrote: > >> The patch introduces mcg_shrinkers array to keep memcg-aware > >> shrinkers in

Re: [PATCH 01/10] mm: Assign id to every memcg-aware shrinker

2018-03-27 Thread Vladimir Davydov
On Mon, Mar 26, 2018 at 06:09:35PM +0300, Kirill Tkhai wrote: > Hi, Vladimir, > > thanks for your review! > > On 24.03.2018 21:40, Vladimir Davydov wrote: > > Hello Kirill, > > > > I don't have any objections to the idea behind this patch set. > &g

Re: [PATCH] mm/list_lru: replace spinlock with RCU in __list_lru_count_one

2018-03-27 Thread Vladimir Davydov
[Cc Kirill] AFAIU this has already been fixed in exactly the same fashion by Kirill (mmotm commit 8e7d1201ec71 "mm: make counting of list_lru_one::nr_items lockless"). Kirill is working on further optimizations right now, see https://lkml.kernel.org/r/152163840790.21546.980703278415599202.stgi

Re: [PATCH 10/10] mm: Clear shrinker bit if there are no objects related to memcg

2018-03-24 Thread Vladimir Davydov
On Wed, Mar 21, 2018 at 04:23:01PM +0300, Kirill Tkhai wrote: > To avoid further unneed calls of do_shrink_slab() > for shrinkers, which already do not have any charged > objects in a memcg, their bits have to be cleared. > > This patch introduces new return value SHRINK_EMPTY, > which will be use

Re: [PATCH 09/10] mm: Iterate only over charged shrinkers during memcg shrink_slab()

2018-03-24 Thread Vladimir Davydov
On Wed, Mar 21, 2018 at 04:22:51PM +0300, Kirill Tkhai wrote: > Using the preparations made in previous patches, in case of memcg > shrink, we may avoid shrinkers, which are not set in memcg's shrinkers > bitmap. To do that, we separate iterations over memcg-aware and > !memcg-aware shrinkers, and

Re: [PATCH 08/10] mm: Set bit in memcg shrinker bitmap on first list_lru item apearance

2018-03-24 Thread Vladimir Davydov
On Wed, Mar 21, 2018 at 04:22:40PM +0300, Kirill Tkhai wrote: > Introduce set_shrinker_bit() function to set shrinker-related > bit in memcg shrinker bitmap, and set the bit after the first > item is added and in case of reparenting destroyed memcg's items. > > This will allow next patch to make s

Re: [PATCH 06/10] list_lru: Pass dst_memcg argument to memcg_drain_list_lru_node()

2018-03-24 Thread Vladimir Davydov
On Wed, Mar 21, 2018 at 04:22:10PM +0300, Kirill Tkhai wrote: > This is just refactoring to allow next patches to have > dst_memcg pointer in memcg_drain_list_lru_node(). > > Signed-off-by: Kirill Tkhai > --- > include/linux/list_lru.h |2 +- > mm/list_lru.c| 11 ++- >

Re: [PATCH 03/10] mm: Assign memcg-aware shrinkers bitmap to memcg

2018-03-24 Thread Vladimir Davydov
On Wed, Mar 21, 2018 at 04:21:40PM +0300, Kirill Tkhai wrote: > Imagine a big node with many cpus, memory cgroups and containers. > Let we have 200 containers, every container has 10 mounts, > and 10 cgroups. All container tasks don't touch foreign > containers mounts. If there is intensive pages w

Re: [PATCH 04/10] fs: Propagate shrinker::id to list_lru

2018-03-24 Thread Vladimir Davydov
On Wed, Mar 21, 2018 at 04:21:51PM +0300, Kirill Tkhai wrote: > The patch adds list_lru::shrk_id field, and populates > it by registered shrinker id. > > This will be used to set correct bit in memcg shrinkers > map by lru code in next patches, after there appeared > the first related to memcg ele

Re: [PATCH 02/10] mm: Maintain memcg-aware shrinkers in mcg_shrinkers array

2018-03-24 Thread Vladimir Davydov
On Wed, Mar 21, 2018 at 04:21:29PM +0300, Kirill Tkhai wrote: > The patch introduces mcg_shrinkers array to keep memcg-aware > shrinkers in order of their shrinker::id. > > This allows to access the shrinkers dirrectly by the id, > without iteration over shrinker_list list. Why don't you simply u

Re: [PATCH 01/10] mm: Assign id to every memcg-aware shrinker

2018-03-24 Thread Vladimir Davydov
Hello Kirill, I don't have any objections to the idea behind this patch set. Well, at least I don't know how to better tackle the problem you describe in the cover letter. Please, see below for my comments regarding implementation details. On Wed, Mar 21, 2018 at 04:21:17PM +0300, Kirill Tkhai wr

Re: [PATCH] mm, slab: eagerly delete inactive offlined SLABs

2018-03-24 Thread Vladimir Davydov
Hello Shakeel, The patch makes sense to me, but I have a concern about synchronization of cache destruction vs concurrent kmem_cache_free. Please, see my comments inline. On Wed, Mar 21, 2018 at 03:43:01PM -0700, Shakeel Butt wrote: > With kmem cgroup support, high memcgs churn can leave behind a

Re: [PATCH] slab, slub: remove size disparity on debug kernel

2018-03-14 Thread Vladimir Davydov
On Tue, Mar 13, 2018 at 10:36:52AM -0700, Shakeel Butt wrote: > On Tue, Mar 13, 2018 at 10:19 AM, Christopher Lameter wrote: > > On Tue, 13 Mar 2018, Shakeel Butt wrote: > > > >> However for SLUB in debug kernel, the sizes were same. On further > >> inspection it is found that SLUB always use kmem

Re: [PATCH 3/3] mm: memcontrol: fix excessive complexity in memory.stat reporting

2017-11-07 Thread Vladimir Davydov
++--- > mm/memcontrol.c| 101 > +++-- > 2 files changed, 113 insertions(+), 84 deletions(-) Acked-by: Vladimir Davydov

Re: [PATCH 2/3] mm: memcontrol: implement lruvec stat functions on top of each other

2017-11-07 Thread Vladimir Davydov
t; --- > include/linux/memcontrol.h | 44 ++-- > 1 file changed, 22 insertions(+), 22 deletions(-) Acked-by: Vladimir Davydov

Re: [PATCH 1/3] mm: memcontrol: eliminate raw access to stat and event counters

2017-11-07 Thread Vladimir Davydov
d, 45 insertions(+), 45 deletions(-) Acked-by: Vladimir Davydov

Re: [BUG] fs/super: a possible sleep-in-atomic bug in put_super

2017-10-09 Thread Vladimir Davydov
On Sun, Oct 08, 2017 at 10:13:57PM +0100, Al Viro wrote: > On Sun, Oct 08, 2017 at 06:47:46PM +0300, Vladimir Davydov wrote: > > On Sun, Oct 08, 2017 at 03:03:32AM +0100, Al Viro wrote: > > > On Sun, Oct 08, 2017 at 01:56:08AM +0100, Al Viro wrote: > > > > > >

Re: [BUG] fs/super: a possible sleep-in-atomic bug in put_super

2017-10-08 Thread Vladimir Davydov
On Sun, Oct 08, 2017 at 03:03:32AM +0100, Al Viro wrote: > On Sun, Oct 08, 2017 at 01:56:08AM +0100, Al Viro wrote: > > > What's more, we need to be careful about resize vs. drain. Right now it's > > on list_lrus_mutex, but if we drop that around actual resize of an > > individual > > list_lru,

Re: [BUG] fs/super: a possible sleep-in-atomic bug in put_super

2017-10-07 Thread Vladimir Davydov
Hello, On Fri, Oct 06, 2017 at 11:06:04AM +0200, Michal Hocko wrote: > On Fri 06-10-17 16:59:18, Jia-Ju Bai wrote: > > According to fs/super.c, the kernel may sleep under a spinlock. > > The function call path is: > > put_super (acquire the spinlock) > > __put_super > > destroy_super > >

Re: [PATCH] mm: memcontrol: use vmalloc fallback for large kmem memcg arrays

2017-09-19 Thread Vladimir Davydov
ating them physically contiguous. > > Signed-off-by: Johannes Weiner Thanks to kvmalloc/kvfree helpers this looks really neat. Should've been done like that long ago. Acked-by: Vladimir Davydov Thanks, Vladimir

Re: [PATCH 3/3] mm: Count list_lru_one::nr_items lockless

2017-08-26 Thread Vladimir Davydov
On Wed, Aug 23, 2017 at 03:26:12PM +0300, Kirill Tkhai wrote: > On 23.08.2017 11:27, Vladimir Davydov wrote: > > On Wed, Aug 23, 2017 at 11:00:56AM +0300, Kirill Tkhai wrote: > >> On 22.08.2017 22:47, Vladimir Davydov wrote: > >>> On Tue, Aug 22, 2017 at 03:29:

Re: [PATCH 3/3] mm: Count list_lru_one::nr_items lockless

2017-08-23 Thread Vladimir Davydov
On Wed, Aug 23, 2017 at 11:00:56AM +0300, Kirill Tkhai wrote: > On 22.08.2017 22:47, Vladimir Davydov wrote: > > On Tue, Aug 22, 2017 at 03:29:35PM +0300, Kirill Tkhai wrote: > >> During the reclaiming slab of a memcg, shrink_slab iterates > >> over all registered s

Re: [PATCH 3/3] mm: Count list_lru_one::nr_items lockless

2017-08-22 Thread Vladimir Davydov
On Tue, Aug 22, 2017 at 03:29:35PM +0300, Kirill Tkhai wrote: > During the reclaiming slab of a memcg, shrink_slab iterates > over all registered shrinkers in the system, and tries to count > and consume objects related to the cgroup. In case of memory > pressure, this behaves bad: I observe high s

Re: [PATCH 2/3] mm: Make list_lru_node::memcg_lrus RCU protected

2017-08-22 Thread Vladimir Davydov
Hello Kirill, On Tue, Aug 22, 2017 at 03:29:26PM +0300, Kirill Tkhai wrote: > The array list_lru_node::memcg_lrus::list_lru_one[] only grows, > and it never shrinks. The growths happens in memcg_update_list_lru_node(), > and old array's members remain the same after it. > > So, the access to the

[PATCH] slub: fix per memcg cache leak on css offline

2017-08-12 Thread Vladimir Davydov
ff Fix the leak by adding the missing call to kobject_put() to sysfs_slab_remove_workfn(). Signed-off-by: Vladimir Davydov Reported-and-tested-by: Andrei Vagin Acked-by: Tejun Heo Cc: Michal Hocko Cc: Johannes Weiner Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rien

Re: [PATCH] mm, memcg: reset low limit during memcg offlining

2017-07-26 Thread Vladimir Davydov
On Tue, Jul 25, 2017 at 01:31:13PM +0100, Roman Gushchin wrote: > On Tue, Jul 25, 2017 at 03:05:37PM +0300, Vladimir Davydov wrote: > > On Tue, Jul 25, 2017 at 12:40:47PM +0100, Roman Gushchin wrote: > > > A removed memory cgroup with a defined low limit and some belonging > &

Re: [PATCH] mm, memcg: reset low limit during memcg offlining

2017-07-25 Thread Vladimir Davydov
will reside > in the memory for an undefined amount of time, wasting > system resources. > > Fix this issue by zeroing memcg->low during memcg offlining. > > Signed-off-by: Roman Gushchin > Cc: Tejun Heo > Cc: Johannes Weiner > Cc: Michal Hocko &g

Re: [PATCH] mm/memory-hotplug: Switch locking to a percpu rwsem

2017-07-03 Thread Vladimir Davydov
, and the code simplification does look compelling. FWIW, Acked-by: Vladimir Davydov > > Two steps to fix this: > > 1) Convert the memory hotplug locking to a per cpu rwsem so the potential >issues get reported proper by lockdep. > > 2) Lock the online cp

Re: [PATCH v4 2/2] fs/dcache.c: fix spin lockup issue on nlru->lock

2017-07-01 Thread Vladimir Davydov
x10 > > Fix this lockup by reducing the number of entries to be shrinked > from the lru list to 1024 at once. Also, add cond_resched() before > processing the lru list again. > > Link: http://marc.info/?t=149722864900001&r=1&w=2 > Fix-suggested-by: Jan kara > Fix-suggested-by: Vladimir Davydov > Signed-off-by: Sahitya Tummala Acked-by: Vladimir Davydov

  1   2   3   4   5   6   7   8   9   10   >