[PATCH -mm 4/6] memcg: free memcg_caches slot on css offline

2015-01-16 Thread Vladimir Davydov
off-by: Vladimir Davydov --- include/linux/slab.h | 10 +- mm/memcontrol.c | 38 -- mm/slab_common.c | 39 --- mm/vmscan.c |2 +- 4 files changed, 66 insertions(+), 23 deletions(-) diff --

[PATCH -mm 3/6] slab: use css id for naming per memcg caches

2015-01-16 Thread Vladimir Davydov
it for so long, wasting valuable entries of memcg_cache_params->memcg_caches arrays. Therefore, to preserve cache name uniqueness, let us switch to css->id. Signed-off-by: Vladimir Davydov --- mm/slab_common.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/sla

[PATCH -mm 6/6] memcg: reparent list_lrus and free kmemcg_id on css offline

2015-01-16 Thread Vladimir Davydov
arenting will fix it. After list_lru reparenting is done we are free to release kmemcg_id saving a valuable slot in a per-memcg array for new cgroups. Signed-off-by: Vladimir Davydov --- include/linux/list_lru.h |3 ++- mm/list_lru.c| 46 +++

[PATCH -mm 5/6] list_lru: add helpers to isolate items

2015-01-16 Thread Vladimir Davydov
entry from the list, but also fix the nr_items counter, making sure nr_items always reflects the actual number of elements on the list if checked under the appropriate lock. Signed-off-by: Vladimir Davydov --- fs/dcache.c | 21 +++-- fs/gfs2/quota.c |

[PATCH -mm 1/6] slab: embed memcg_cache_params to kmem_cache

2015-01-16 Thread Vladimir Davydov
make them linked in the following patch. That said, let us embed it. Signed-off-by: Vladimir Davydov --- include/linux/slab.h | 17 +++ include/linux/slab_def.h |2 +- include/linux/slub_def.h |2 +- mm/memcontrol.c | 11 ++-- mm/slab.h| 48

Re: [PATCH -mm 0/6] memcg: release kmemcg_id on css offline

2015-01-19 Thread Vladimir Davydov
Drop this patch please. It needs a rebase. Will resend soon. Thanks, Vladimir -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at

[PATCH -mm v2 0/7] memcg: release kmemcg_id on css offline

2015-01-19 Thread Vladimir Davydov
ree to avoid kmem cache name clashes v1: https://lkml.org/lkml/2015/1/16/285 [1] https://lkml.org/lkml/2015/1/13/107 Thanks, Vladimir Davydov (7): slab: embed memcg_cache_params to kmem_cache slab: link memcg caches of the same kind into a list cgroup: release css->id after css_free s

[PATCH -mm v2 7/7] memcg: reparent list_lrus and free kmemcg_id on css offline

2015-01-19 Thread Vladimir Davydov
arenting will fix it. After list_lru reparenting is done we are free to release kmemcg_id saving a valuable slot in a per-memcg array for new cgroups. Signed-off-by: Vladimir Davydov --- include/linux/list_lru.h |3 ++- mm/list_lru.c| 46 +++

[PATCH -mm v2 6/7] list_lru: add helpers to isolate items

2015-01-19 Thread Vladimir Davydov
entry from the list, but also fix the nr_items counter, making sure nr_items always reflects the actual number of elements on the list if checked under the appropriate lock. Signed-off-by: Vladimir Davydov --- fs/dcache.c | 21 +++-- fs/gfs2/quota.c |

[PATCH -mm v2 2/7] slab: link memcg caches of the same kind into a list

2015-01-19 Thread Vladimir Davydov
cgroups, in this array, because it will be growing beyond any bounds then. I'm going to wipe away dead caches from it to save space. To still be able to perform iterations over all memcg caches of the same kind, let us link them into a list. Signed-off-by: Vladimir Davydov --- include/linux/

[PATCH -mm v2 3/7] cgroup: release css->id after css_free

2015-01-19 Thread Vladimir Davydov
h NULL. Signed-off-by: Vladimir Davydov --- kernel/cgroup.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 6ffd3ae52bf8..7bd3e0f0f341 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -4373,16 +4373,20 @@ static void c

[PATCH -mm v2 1/7] slab: embed memcg_cache_params to kmem_cache

2015-01-19 Thread Vladimir Davydov
make them linked in the following patch. That said, let us embed it. Signed-off-by: Vladimir Davydov --- include/linux/slab.h | 17 +++ include/linux/slab_def.h |2 +- include/linux/slub_def.h |2 +- mm/memcontrol.c | 11 ++-- mm/slab.h| 48

[PATCH -mm v2 5/7] memcg: free memcg_caches slot on css offline

2015-01-19 Thread Vladimir Davydov
off-by: Vladimir Davydov --- include/linux/slab.h | 10 +- mm/memcontrol.c | 38 -- mm/slab_common.c | 39 --- 3 files changed, 65 insertions(+), 22 deletions(-) diff --git a/include/linux/slab.h b/incl

[PATCH -mm v2 4/7] slab: use css id for naming per memcg caches

2015-01-19 Thread Vladimir Davydov
it for so long, wasting valuable entries of memcg_cache_params->memcg_caches arrays. Therefore, to preserve cache name uniqueness, let us switch to css->id. Signed-off-by: Vladimir Davydov --- mm/slab_common.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/sla

[PATCH] fs: super: do not cacheline align s_{inode,dentry}_lru

2015-01-19 Thread Vladimir Davydov
to. The list_lru_node struct is already cacheline aligned by definition. So let us drop the cacheline aligned annotation in order not to waste space in struct super_block. Signed-off-by: Vladimir Davydov --- include/linux/fs.h |9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) di

Re: [PATCH -mm v2 3/7] cgroup: release css->id after css_free

2015-01-19 Thread Vladimir Davydov
Hi Tejun, On Mon, Jan 19, 2015 at 09:30:01AM -0500, Tejun Heo wrote: > On Mon, Jan 19, 2015 at 02:23:21PM +0300, Vladimir Davydov wrote: > > Currently, we release css->id in css_release_work_fn, right before > > calling css_free callback, so that when css_free is called, t

Re: [PATCH -mm 1/3] slub: don't fail kmem_cache_shrink if slab placement optimization fails

2015-01-26 Thread Vladimir Davydov
Hi Christoph, On Mon, Jan 26, 2015 at 09:48:00AM -0600, Christoph Lameter wrote: > On Mon, 26 Jan 2015, Vladimir Davydov wrote: > > > SLUB's kmem_cache_shrink not only removes empty slabs from the cache, > > but also sorts slabs by the number of objects in-use to cope wit

Re: [PATCH -mm 2/3] slab: zap kmem_cache_shrink return value

2015-01-26 Thread Vladimir Davydov
On Mon, Jan 26, 2015 at 09:49:47AM -0600, Christoph Lameter wrote: > On Mon, 26 Jan 2015, Vladimir Davydov wrote: > > > @@ -2400,11 +2400,16 @@ int __kmem_cache_shrink(struct kmem_cache *cachep) > > return (ret ? 1 : 0); > > } > > > > +void __kmem_ca

Re: [PATCH -mm 1/3] slub: don't fail kmem_cache_shrink if slab placement optimization fails

2015-01-26 Thread Vladimir Davydov
On Mon, Jan 26, 2015 at 12:24:49PM -0600, Christoph Lameter wrote: > On Mon, 26 Jan 2015, Vladimir Davydov wrote: > > > Anyways, I think that silently relying on the fact that the allocator > > never fails small allocations is kind of unreliable. What if this > > We are n

Re: [PATCH -mm 2/3] slab: zap kmem_cache_shrink return value

2015-01-26 Thread Vladimir Davydov
On Mon, Jan 26, 2015 at 12:26:57PM -0600, Christoph Lameter wrote: > On Mon, 26 Jan 2015, Vladimir Davydov wrote: > > > __cache_shrink() is used not only in __kmem_cache_shrink(), but also in > > SLAB's __kmem_cache_shutdown(), where we do need its return value to > >

Re: [PATCH -mm 2/3] slab: zap kmem_cache_shrink return value

2015-01-26 Thread Vladimir Davydov
On Mon, Jan 26, 2015 at 01:55:14PM -0600, Christoph Lameter wrote: > On Mon, 26 Jan 2015, Vladimir Davydov wrote: > > > Hmm, why? The return value has existed since this function was > > introduced, but nobody seems to have ever used it outside the slab core. > > Besides

Re: [PATCH -mm 2/3] slab: zap kmem_cache_shrink return value

2015-01-26 Thread Vladimir Davydov
On Mon, Jan 26, 2015 at 02:28:33PM -0600, Christoph Lameter wrote: > On Mon, 26 Jan 2015, Vladimir Davydov wrote: > > > Right, but I just don't see why a subsystem using a kmem_cache would > > need to check whether there are any objects left in the cache. I mean, > >

Re: [PATCH -mm 3/3] slub: make dead caches discard free slabs immediately

2015-01-27 Thread Vladimir Davydov
Hi Joonsoo, On Tue, Jan 27, 2015 at 05:00:09PM +0900, Joonsoo Kim wrote: > On Mon, Jan 26, 2015 at 03:55:29PM +0300, Vladimir Davydov wrote: > > @@ -3381,6 +3390,15 @@ void __kmem_cache_shrink(struct kmem_cache *s) > > kmalloc(sizeof(struct list_head) * obje

Re: linux-next: build warnings after merge of the akpm-current tree

2015-01-27 Thread Vladimir Davydov
Hi, On Tue, Jan 27, 2015 at 07:12:43PM +1100, Stephen Rothwell wrote: > In file included from mm/slab_common.c:26:0: > mm/slab_common.c: In function 'kmem_cache_destroy': > mm/slab.h:259:30: warning: right-hand operand of comma expression has no > effect [-Wunused-value] > for (iter = NULL, tmp

Re: [PATCH -mm 3/3] slub: make dead caches discard free slabs immediately

2015-01-27 Thread Vladimir Davydov
On Tue, Jan 27, 2015 at 06:21:14PM +0900, Joonsoo Kim wrote: > 2015-01-27 17:23 GMT+09:00 Vladimir Davydov : > > Hi Joonsoo, > > > > On Tue, Jan 27, 2015 at 05:00:09PM +0900, Joonsoo Kim wrote: > >> On Mon, Jan 26, 2015 at 03:55:29PM +0300, Vladimir Davydov wro

Re: [PATCH -mm 1/3] slub: don't fail kmem_cache_shrink if slab placement optimization fails

2015-01-27 Thread Vladimir Davydov
On Mon, Jan 26, 2015 at 01:53:32PM -0600, Christoph Lameter wrote: > On Mon, 26 Jan 2015, Vladimir Davydov wrote: > > > We could do that, but IMO that would only complicate the code w/o > > yielding any real benefits. This function is slow and called rarely > > anyway, s

[PATCH -mm v2 1/3] slub: never fail to shrink cache

2015-01-28 Thread Vladimir Davydov
t any ordering imposed on them. Signed-off-by: Vladimir Davydov --- mm/slub.c | 57 ++--- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 1562955fe099..dbf9334b6a5c 100644 --- a/mm/slub.c +++ b/mm/slub

[PATCH -mm v2 0/3] slub: make dead caches discard free slabs immediately

2015-01-28 Thread Vladimir Davydov
race between put_cpu_partial reading ->cpu_partial and kmem_cache_shrink updating it as proposed by Joonsoo v1: https://lkml.org/lkml/2015/1/26/317 Thanks, Vladimir Davydov (3): slub: never fail to shrink cache slub: fix kmem_cache_shrink return value slub: make dead caches discard fr

Re: [PATCH -mm v2 2/3] slub: fix kmem_cache_shrink return value

2015-01-28 Thread Vladimir Davydov
On Wed, Jan 28, 2015 at 10:33:50AM -0600, Christoph Lameter wrote: > On Wed, 28 Jan 2015, Vladimir Davydov wrote: > > > @@ -3419,6 +3420,9 @@ int __kmem_cache_shrink(struct kmem_cache *s) > > for (i = SHRINK_PROMOTE_MAX - 1; i >= 0; i--) > >

Re: [PATCH -mm 1/3] slub: don't fail kmem_cache_shrink if slab placement optimization fails

2015-01-28 Thread Vladimir Davydov
On Tue, Jan 27, 2015 at 11:02:12AM -0600, Christoph Lameter wrote: > What you could do is simply put all slab pages with more than 32 objects > available at the end of the list. OK, got it, will redo. Thanks! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of

[PATCH -mm v2 3/3] slub: make dead caches discard free slabs immediately

2015-01-28 Thread Vladimir Davydov
.mm/118649/focus=118650 Signed-off-by: Vladimir Davydov --- mm/slab.c|4 ++-- mm/slab.h|2 +- mm/slab_common.c | 15 +-- mm/slob.c|2 +- mm/slub.c| 31 ++- 5 files changed, 43 insertions(+), 11 deletions(-) d

[PATCH -mm v2 2/3] slub: fix kmem_cache_shrink return value

2015-01-28 Thread Vladimir Davydov
It is supposed to return 0 if the cache has no remaining objects and 1 otherwise, while currently it always returns 0. Fix it. Signed-off-by: Vladimir Davydov --- mm/slub.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mm/slub.c b/mm/slub.c index dbf9334b6a5c

Re: [PATCH -mm v2 1/3] slub: never fail to shrink cache

2015-01-28 Thread Vladimir Davydov
On Wed, Jan 28, 2015 at 10:37:09AM -0600, Christoph Lameter wrote: > On Wed, 28 Jan 2015, Vladimir Davydov wrote: > > > + /* We do not keep full slabs on the list */ > > + BUG_ON(free <= 0); > > Well sorry we do actually keep a n

Re: [PATCH] signal: improve warning about using SI_TKILL in rt_[tg]sigqueueinfo

2015-03-19 Thread Vladimir Davydov
On Thu, Mar 19, 2015 at 02:00:46PM +0100, Oleg Nesterov wrote: > On 03/19, Vladimir Davydov wrote: > > > > Sending SI_TKILL from rt_[tg]sigqueueinfo was deprecated, so now we > > issue a warning on the first attempt of doing it. We use WARN_ON_ONCE, > > which is not inf

[PATCH] Documentation/memcg: update memcg/kmem status

2015-04-01 Thread Vladimir Davydov
Memcg/kmem reclaim support has been finally merged. Reflect this in the documentation. Signed-off-by: Vladimir Davydov --- Documentation/cgroups/memory.txt |8 +++- init/Kconfig |6 -- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a

Re: [PATCH] Documentation/memcg: update memcg/kmem status

2015-04-01 Thread Vladimir Davydov
On Wed, Apr 01, 2015 at 04:44:31PM +0200, Jonathan Corbet wrote: > On Wed, 1 Apr 2015 17:30:36 +0300 > Vladimir Davydov wrote: > > > Memcg/kmem reclaim support has been finally merged. Reflect this in the > > documentation. > > So the text you've removed says no

[PATCH v3 2/3] proc: add kpagecgroup file

2015-04-28 Thread Vladimir Davydov
/proc/kpagecgroup contains a 64-bit inode number of the memory cgroup each page is charged to, indexed by PFN. Having this information is useful for estimating a cgroup working set size. The file is present if CONFIG_PROC_PAGE_MONITOR && CONFIG_MEMCG. Signed-off-by: Vladimir

[PATCH v3 0/3] idle memory tracking

2015-04-28 Thread Vladimir Davydov
" nidle = count_idle() for dir, subdirs, files in os.walk(CGROUP_MOUNT): ino = os.stat(dir)[stat.ST_INO] print dir + ": " + str(nidle.get(ino, 0)) END SCRIPT Comments are more than welcome. Thanks, Vladimir Davydov (3):

[PATCH v3 3/3] proc: add kpageidle file

2015-04-28 Thread Vladimir Davydov
page flags when compiled on 32 bit. Signed-off-by: Vladimir Davydov --- Documentation/vm/pagemap.txt | 10 ++- fs/proc/page.c | 154 ++ fs/proc/task_mmu.c |4 +- include/linux/mm.h | 88 inc

[PATCH v3 1/3] memcg: add page_cgroup_ino helper

2015-04-28 Thread Vladimir Davydov
end on CONFIG_MEMCG instead of CONFIG_MEMCG_SWAP (I've no idea why it was made dependant on CONFIG_MEMCG_SWAP initially). Signed-off-by: Vladimir Davydov --- include/linux/memcontrol.h |8 ++--- mm/hwpoison-inject.c |5 +-- mm/memcontrol.c

[RFC v2 3/3] proc: add kpageidle file

2015-04-07 Thread Vladimir Davydov
ave plenty of space for page flags. We could use page_ext to accomodate new flags on 32BIT, but this is left for the future work. Signed-off-by: Vladimir Davydov --- Documentation/vm/pagemap.txt | 17 - fs/proc/page.c | 149 ++ fs/proc/

[RFC v2 0/3] idle memory tracking

2015-04-07 Thread Vladimir Davydov
s Enter") print "Counting idle pages..." nidle = count_idle() for dir, subdirs, files in os.walk(CGROUP_MOUNT): ino = os.stat(dir)[stat.ST_INO] print dir + ": " + str(nidle.get(ino, 0)) END SCRIPT Comments are more than welcome. Thanks,

[RFC v2 2/3] proc: add kpagecgroup file

2015-04-07 Thread Vladimir Davydov
/proc/kpagecgroup contains a 64-bit inode number of the memory cgroup each page is charged to, indexed by PFN. Having this information is useful for estimating a cgroup working set size. The file is present if CONFIG_PROC_PAGE_MONITOR && CONFIG_MEMCG. Signed-off-by: Vladimir

[RFC v2 1/3] memcg: add page_cgroup_ino helper

2015-04-07 Thread Vladimir Davydov
end on CONFIG_MEMCG instead of CONFIG_MEMCG_SWAP (I've no idea why it was made dependant on CONFIG_MEMCG_SWAP initially). Signed-off-by: Vladimir Davydov --- include/linux/memcontrol.h |8 ++--- mm/hwpoison-inject.c |5 +-- mm/memcontrol.c

Re: [RFC v2 0/3] idle memory tracking

2015-04-07 Thread Vladimir Davydov
Forgot to mention: Originally, the patch for tracking idle memory was proposed back in 2011 by Michel Lespinasse (see http://lwn.net/Articles/459269/). The main difference between Michel's patch and this one is that Michel implemented a kernel space daemon for estimating idle memory size per cgrou

[PATCH -mm] slab: use cgroup ino for naming per memcg caches

2015-04-07 Thread Vladimir Davydov
to css id, it can be easily obtained from userspace. Signed-off-by: Vladimir Davydov --- mm/slab_common.c |9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mm/slab_common.c b/mm/slab_common.c index 999bb3424d44..e97bf3e04ed7 100644 --- a/mm/slab_common.c +++ b/mm/sla

Re: [PATCH -mm] slab: use cgroup ino for naming per memcg caches

2015-04-08 Thread Vladimir Davydov
On Tue, Apr 07, 2015 at 01:38:19PM -0700, Andrew Morton wrote: > On Tue, 7 Apr 2015 16:53:18 +0300 Vladimir Davydov > wrote: > > > The name of a per memcg kmem cache consists of three parts: the global > > kmem cache name, the cgroup name, and the css id. The latter is

Re: [PATCH -mm] slab: use cgroup ino for naming per memcg caches

2015-04-08 Thread Vladimir Davydov
On Wed, Apr 08, 2015 at 08:46:22AM -0500, Christoph Lameter wrote: > On Wed, 8 Apr 2015, Vladimir Davydov wrote: > > > has its own copy of kmem cache. What if we decide to share the same kmem > > cache among all memory cgroups one day? Of course, this will hardly ever > &

Re: [PATCH v3 0/3] idle memory tracking

2015-04-29 Thread Vladimir Davydov
Hi Minchan, Thank you for taking a look at this patch set. On Wed, Apr 29, 2015 at 12:57:22PM +0900, Minchan Kim wrote: > On Tue, Apr 28, 2015 at 03:24:39PM +0300, Vladimir Davydov wrote: > > * /proc/kpageidle. For each page this file contains a 64-bit number, which > >equal

Re: [PATCH v3 3/3] proc: add kpageidle file

2015-04-29 Thread Vladimir Davydov
On Wed, Apr 29, 2015 at 01:57:59PM +0900, Minchan Kim wrote: > On Tue, Apr 28, 2015 at 03:24:42PM +0300, Vladimir Davydov wrote: > > @@ -69,6 +69,14 @@ There are four components to pagemap: > > memory cgroup each page is charged to, indexed by PFN. Only available > > when

Re: [PATCH v3 3/3] proc: add kpageidle file

2015-04-29 Thread Vladimir Davydov
On Wed, Apr 29, 2015 at 01:35:36PM +0900, Minchan Kim wrote: > On Tue, Apr 28, 2015 at 03:24:42PM +0300, Vladimir Davydov wrote: > > diff --git a/fs/proc/page.c b/fs/proc/page.c > > index 70d23245dd43..cfc55ba7fee6 100644 > > --- a/fs/proc/page.c > > +++ b/fs/proc/pa

Re: [PATCH v3 3/3] proc: add kpageidle file

2015-04-30 Thread Vladimir Davydov
On Thu, Apr 30, 2015 at 05:25:31PM +0900, Minchan Kim wrote: > On Wed, Apr 29, 2015 at 12:12:48PM +0300, Vladimir Davydov wrote: > > On Wed, Apr 29, 2015 at 01:35:36PM +0900, Minchan Kim wrote: > > > On Tue, Apr 28, 2015 at 03:24:42PM +0300, Vladimir Davydov wrot

[PATCH] memcg: do not call reclaim if !__GFP_WAIT

2015-05-28 Thread Vladimir Davydov
When trimming memcg consumption excess (see memory.high), we call try_to_free_mem_cgroup_pages without checking if we are allowed to sleep in the current context, which can result in a deadlock. Fix this. Signed-off-by: Vladimir Davydov Cc: Johannes Weiner Cc: Michal Hocko --- mm/memcontrol.c

[PATCH -mm v6 4/6] proc: add kpagecgroup file

2015-06-12 Thread Vladimir Davydov
/proc/kpagecgroup contains a 64-bit inode number of the memory cgroup each page is charged to, indexed by PFN. Having this information is useful for estimating a cgroup working set size. The file is present if CONFIG_PROC_PAGE_MONITOR && CONFIG_MEMCG. Signed-off-by: Vladimir

[PATCH -mm v6 5/6] proc: add kpageidle file

2015-06-12 Thread Vladimir Davydov
page flags when compiled on 32 bit. Signed-off-by: Vladimir Davydov --- Documentation/vm/pagemap.txt | 12 ++- fs/proc/page.c | 178 +++ fs/proc/task_mmu.c | 4 +- include/linux/mm.h | 88 + include/

[PATCH -mm v6 1/6] memcg: add page_cgroup_ino helper

2015-06-12 Thread Vladimir Davydov
This function returns the inode number of the closest online ancestor of the memory cgroup a page is charged to. It is required for exporting information about which page is charged to which cgroup to userspace, which will be introduced by a following patch. Signed-off-by: Vladimir Davydov

[PATCH -mm v6 6/6] proc: export idle flag via kpageflags

2015-06-12 Thread Vladimir Davydov
be too costly to iterate over all page mappings on each /proc/kpageflags read to provide an up-to-date value. To make sure the flag is up-to-date one has to read /proc/kpageidle first. Signed-off-by: Vladimir Davydov --- Documentation/vm/pagemap.txt | 6 ++ fs/proc/page.c

[PATCH -mm v6 3/6] memcg: zap try_get_mem_cgroup_from_page

2015-06-12 Thread Vladimir Davydov
It is only used in mem_cgroup_try_charge, so fold it in and zap it. Signed-off-by: Vladimir Davydov --- include/linux/memcontrol.h | 6 -- mm/memcontrol.c| 48 -- 2 files changed, 12 insertions(+), 42 deletions(-) diff --git a

[PATCH -mm v6 2/6] hwpoison: use page_cgroup_ino for filtering by memcg

2015-06-12 Thread Vladimir Davydov
Hwpoison allows to filter pages by memory cgroup ino. Currently, it calls try_get_mem_cgroup_from_page to obtain the cgroup from a page and then its ino using cgroup_ino, but now we have an apter method for that, page_cgroup_ino, so use it instead. Signed-off-by: Vladimir Davydov --- mm

[PATCH -mm v6 0/6] idle memory tracking

2015-06-12 Thread Vladimir Davydov
e workload accesses its working set, then press Enter") print "Counting idle pages..." nr_idle = count_idle() for dir, subdirs, files in os.walk(CGROUP_MOUNT): ino = os.stat(dir)[stat.ST_INO] print dir + ": " + str(nr_idle.get(ino, 0) * 4) + " KB" END SCRI

Re: [PATCH v5 0/4] idle memory tracking

2015-06-07 Thread Vladimir Davydov
On Sun, Jun 07, 2015 at 11:41:15AM +0530, Raghavendra KT wrote: > Thanks for the patches, I was able test how the series is helpful to determine > docker container workingset / idlemem with these patches. (tested on ppc64le > after porting to a distro kernel). Hi, Thank you for using and testing

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 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 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 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 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 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 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 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 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 v3 2/7] memcg, slab: cleanup memcg cache creation

2014-02-22 Thread Vladimir Davydov
On 02/22/2014 04:11 AM, Andrew Morton wrote: > On Thu, 20 Feb 2014 11:22:04 +0400 Vladimir Davydov > wrote: > >> This patch cleanups the memcg cache creation path as follows: >> - Move memcg cache name creation to a separate function to be called >>from kmem

[PATCH -mm 04/12] memcg: move slab caches list/mutex init to memcg creation

2014-02-26 Thread Vladimir Davydov
I need them initialized for cgroups that haven't got kmem accounting initialized. Signed-off-by: Vladimir Davydov Cc: Johannes Weiner Cc: Michal Hocko Cc: Glauber Costa --- mm/memcontrol.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/memcontrol.c

[PATCH -mm 12/12] slub: make sure all memcg caches have unique names on sysfs

2014-02-26 Thread Vladimir Davydov
#x27;s fix this by appending the cache address to sysfs names of all memcg caches so that they are guaranteed to have unique names. Signed-off-by: Vladimir Davydov Cc: Johannes Weiner Cc: Michal Hocko Cc: Glauber Costa Cc: Christoph Lameter Cc: Pekka Enberg --- mm/slub.c | 13 +++

[PATCH -mm 08/12] memcg: do not charge kmalloc_large allocations

2014-02-26 Thread Vladimir Davydov
We don't have a way to track kmalloc_large allocations so that charging them makes kmemcg reparenting impossible. Since such allocations are rare and can't be massively triggered from userspace, let's just ignore them. Cc: Johannes Weiner Cc: Michal Hocko Cc: Glauber Costa Cc: Christoph Lameter

[PATCH -mm 02/12] memcg: fix race in memcg cache destruction path

2014-02-26 Thread Vladimir Davydov
_caches, because the cache is already empty when we release its last page. And if we drop the reference taken by memcg in the work handler, we can detect who exactly scheduled the worker - mem_cgroup_destroy_all_caches or memcg_release_pages. Signed-off-by: Vladimir Davydov Cc: Johannes Weiner

[PATCH -mm 09/12] fork: do not charge thread_info to kmemcg

2014-02-26 Thread Vladimir Davydov
we could uncharge thread_info on task exit, but that wouldn't help us against fork bombs. So revert and forget about this. Signed-off-by: Vladimir Davydov Cc: Johannes Weiner Cc: Michal Hocko Cc: Glauber Costa Cc: Frederic Weisbecker --- include/linux/thread_info.h |2 -- kernel/fork

[PATCH -mm 11/12] memcg: reparent slab on css offline

2014-02-26 Thread Vladimir Davydov
es an object to a cache being reparented, he might see a pointer to the old memcg, but that's OK, we only need to use RCU to protect against use-after-free. Let's just do it. Signed-off-by: Vladimir Davydov Cc: Johannes Weiner Cc: Michal Hocko Cc: Glauber Costa --- mm/memc

[PATCH -mm 07/12] memcg: rework slab charging

2014-02-26 Thread Vladimir Davydov
here we should actually charge kmem pages, why not just insert kmemcg charge/uncharge there passing on the slab we are allocating from instead of introdudingh into the generic allocation path. That's what this patch does. Note, it does not remove the old code - it will be handled further. Sig

[PATCH -mm 10/12] memcg: kill GFP_KMEMCG and stuff

2014-02-26 Thread Vladimir Davydov
No one uses it any more. Just get rid of it. Signed-off-by: Vladimir Davydov Cc: Johannes Weiner Cc: Michal Hocko Cc: Glauber Costa --- include/linux/gfp.h |5 -- include/linux/memcontrol.h | 90 include/trace/events/gfpflags.h |1 - mm

[PATCH -mm 01/12] memcg: flush cache creation works before memcg cache destruction

2014-02-26 Thread Vladimir Davydov
can get a leaked kmem cache or, even worse, an attempt to use after free. Signed-off-by: Vladimir Davydov Cc: Johannes Weiner Cc: Michal Hocko Cc: Glauber Costa --- mm/memcontrol.c | 32 +++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/mm

[PATCH -mm 03/12] memcg: fix root vs memcg cache destruction race

2014-02-26 Thread Vladimir Davydov
e from its memcg. That prevents the work from being rescheduled from memcg offline path. Signed-off-by: Vladimir Davydov Cc: Johannes Weiner Cc: Michal Hocko Cc: Glauber Costa --- include/linux/memcontrol.h |2 +- include/linux/slab.h |1 + mm/memcontrol.c

[PATCH -mm 06/12] memcg: keep all children of each root cache on a list

2014-02-26 Thread Vladimir Davydov
to get a memcg. However, this is going to change when memcg cache reparenting is introduced - only active (not dead) caches will reside in this array. So let's organize all child caches of the same root cache into a list on memcg_cache_params. Signed-off-by: Vladimir Davydov Cc: Johannes W

[PATCH -mm 05/12] memcg: add pointer from memcg_cache_params to cache

2014-02-26 Thread Vladimir Davydov
reparenting of memcg caches is introduced. So let's embed a pointer back to the memcg cache into the memcg_cache_params struct. Signed-off-by: Vladimir Davydov Cc: Johannes Weiner Cc: Michal Hocko Cc: Glauber Costa --- include/linux/slab.h |2 ++ mm/memcontrol.c | 28 +++

[PATCH -mm 00/12] kmemcg reparenting

2014-02-26 Thread Vladimir Davydov
roposed the idea and kindly outlined basic design principles. Thanks, Vladimir Davydov (12): memcg: flush cache creation works before memcg cache destruction memcg: fix race in memcg cache destruction path memcg: fix root vs memcg cache destruction race memcg: move slab caches list/mutex in

[PATCH RESEND -mm 00/12] kmemcg reparenting

2014-03-13 Thread Vladimir Davydov
l, of course). Many thanks to Johannes Weiner, who proposed the idea and kindly outlined basic design principles. Thanks, Vladimir Davydov (12): memcg: flush cache creation works before memcg cache destruction memcg: fix race in memcg cache destruction path memcg: fix root vs memcg cache dest

[PATCH RESEND -mm 04/12] memcg: move slab caches list/mutex init to memcg creation

2014-03-13 Thread Vladimir Davydov
I need them initialized for cgroups that haven't got kmem accounting initialized. Signed-off-by: Vladimir Davydov Cc: Johannes Weiner Cc: Michal Hocko Cc: Glauber Costa --- mm/memcontrol.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/memcontrol.c

[PATCH RESEND -mm 08/12] memcg: do not charge kmalloc_large allocations

2014-03-13 Thread Vladimir Davydov
We don't have a way to track kmalloc_large allocations so that charging them makes kmemcg reparenting impossible. Since such allocations are rare and can't be massively triggered from userspace, let's just ignore them. Signed-off-by: Vladimir Davydov Cc: Johannes Weiner Cc: M

[PATCH RESEND -mm 12/12] slub: make sure all memcg caches have unique names on sysfs

2014-03-13 Thread Vladimir Davydov
#x27;s fix this by appending the cache address to sysfs names of all memcg caches so that they are guaranteed to have unique names. Signed-off-by: Vladimir Davydov Cc: Johannes Weiner Cc: Michal Hocko Cc: Glauber Costa Cc: Christoph Lameter Cc: Pekka Enberg --- mm/slub.c | 13 +++

[PATCH RESEND -mm 10/12] memcg: kill GFP_KMEMCG and stuff

2014-03-13 Thread Vladimir Davydov
No one uses it any more. Just get rid of it. Signed-off-by: Vladimir Davydov Cc: Johannes Weiner Cc: Michal Hocko Cc: Glauber Costa --- include/linux/gfp.h |5 -- include/linux/memcontrol.h | 90 -- include/trace/events/gfpflags.h |1

[PATCH RESEND -mm 09/12] fork: do not charge thread_info to kmemcg

2014-03-13 Thread Vladimir Davydov
we could uncharge thread_info on task exit, but that wouldn't help us against fork bombs. So revert and forget about this. Signed-off-by: Vladimir Davydov Cc: Johannes Weiner Cc: Michal Hocko Cc: Glauber Costa Cc: Frederic Weisbecker --- include/linux/thread_info.h |2 -- kernel/fork

[PATCH RESEND -mm 02/12] memcg: fix race in memcg cache destruction path

2014-03-13 Thread Vladimir Davydov
_caches, because the cache is already empty when we release its last page. And if we drop the reference taken by memcg in the work handler, we can detect who exactly scheduled the worker - mem_cgroup_destroy_all_caches or memcg_release_pages. Signed-off-by: Vladimir Davydov Cc: Johannes Weiner

[PATCH RESEND -mm 11/12] memcg: reparent slab on css offline

2014-03-13 Thread Vladimir Davydov
es an object to a cache being reparented, he might see a pointer to the old memcg, but that's OK, we only need to use RCU to protect against use-after-free. Let's just do it. Signed-off-by: Vladimir Davydov Cc: Johannes Weiner Cc: Michal Hocko Cc: Glauber Costa --- mm/memc

[PATCH RESEND -mm 06/12] memcg: keep all children of each root cache on a list

2014-03-13 Thread Vladimir Davydov
to get a memcg. However, this is going to change when memcg cache reparenting is introduced - only active (not dead) caches will reside in this array. So let's organize all child caches of the same root cache into a list on memcg_cache_params. Signed-off-by: Vladimir Davydov Cc: Johannes W

[PATCH RESEND -mm 03/12] memcg: fix root vs memcg cache destruction race

2014-03-13 Thread Vladimir Davydov
e from its memcg. That prevents the work from being rescheduled from memcg offline path. Signed-off-by: Vladimir Davydov Cc: Johannes Weiner Cc: Michal Hocko Cc: Glauber Costa --- include/linux/memcontrol.h |2 +- include/linux/slab.h |1 + mm/memcontrol.c

[PATCH RESEND -mm 05/12] memcg: add pointer from memcg_cache_params to cache

2014-03-13 Thread Vladimir Davydov
reparenting of memcg caches is introduced. So let's embed a pointer back to the memcg cache into the memcg_cache_params struct. Signed-off-by: Vladimir Davydov Cc: Johannes Weiner Cc: Michal Hocko Cc: Glauber Costa --- include/linux/slab.h |2 ++ mm/memcontrol.c | 28 +++

[PATCH RESEND -mm 01/12] memcg: flush cache creation works before memcg cache destruction

2014-03-13 Thread Vladimir Davydov
can get a leaked kmem cache or, even worse, an attempt to use after free. Signed-off-by: Vladimir Davydov Cc: Johannes Weiner Cc: Michal Hocko Cc: Glauber Costa --- mm/memcontrol.c | 32 +++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/mm

[PATCH RESEND -mm 07/12] memcg: rework slab charging

2014-03-13 Thread Vladimir Davydov
here we should actually charge kmem pages, why not just insert kmemcg charge/uncharge there passing on the slab we are allocating from instead of introdudingh into the generic allocation path. That's what this patch does. Note, it does not remove the old code - it will be handled further. Sig

Re: [PATCH -mm 00/12] kmemcg reparenting

2014-03-04 Thread Vladimir Davydov
Hi Johannes, Michal Could you please take a look at this set when you have time? Thank you. On 02/26/2014 07:05 PM, Vladimir Davydov wrote: > Hi, > > During my recent attempt to push kmemcg shrinkers, I was pointed out > that current kmemcg implementation has a serious design fla

Re: [PATCH -mm 00/12] kmemcg reparenting

2014-03-04 Thread Vladimir Davydov
On 03/04/2014 07:21 PM, Michal Hocko wrote: > On Tue 04-03-14 18:56:06, Vladimir Davydov wrote: >> Hi Johannes, Michal >> >> Could you please take a look at this set when you have time? > I plan to catch up with others as well. I was on vacation last week and > now catc

Re: [PATCH RESEND -mm 01/12] memcg: flush cache creation works before memcg cache destruction

2014-03-18 Thread Vladimir Davydov
On 03/17/2014 08:07 PM, Michal Hocko wrote: > On Thu 13-03-14 19:06:39, Vladimir Davydov wrote: >> When we get to memcg cache destruction, either from the root cache >> destruction path or when turning memcg offline, there still might be >> memcg cache creation works pendi

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