[Intel-gfx] [PATCH] memcg, shmem: fix shmem migration to use lrucare. (was: Re: memcontrol.c BUG)

Johannes Weiner hannes at cmpxchg.org
Mon Feb 2 08:18:57 PST 2015


On Mon, Feb 02, 2015 at 04:00:51PM +0100, Michal Hocko wrote:
> From: Michal Hocko <mhocko at suse.cz>
> Date: Mon, 2 Feb 2015 15:22:19 +0100
> Subject: [PATCH] memcg, shmem: fix shmem migration to use lrucare.
> 
> It has been reported that 965GM might trigger
> 
> VM_BUG_ON_PAGE(!lrucare && PageLRU(oldpage), oldpage)
> 
> in mem_cgroup_migrate when shmem wants to replace a swap cache page
> because of shmem_should_replace_page (the page is allocated from an
> inappropriate zone). shmem_replace_page expects that the oldpage is not
> on LRU list and calls mem_cgroup_migrate without lrucare. This is obviously
> incorrect because swapcache pages might be on the LRU list (e.g. swapin
> readahead page).
> 
> Fix this by enabling lrucare for the migration in shmem_replace_page.
> Also clarify that lrucare should be used even if one of the pages might
> be on LRU list.
> 
> The BUG_ON will trigger only when CONFIG_DEBUG_VM is enabled but even
> without that the migration code might leave the old page on an
> inappropriate memcg' LRU which is not that critical because the page
> would get removed with its last reference but it is still confusing.
> 
> Fixes: 0a31bc97c80c (mm: memcontrol: rewrite uncharge API)
> Cc: stable at vger.kernel.org # 3.17+
> Reported-by: Chris Wilson <chris at chris-wilson.co.uk>
> Reported-by: Dave Airlie <airlied at gmail.com>
> Acked-by: Hugh Dickins <hughd at google.com>
> Signed-off-by: Michal Hocko <mhocko at suse.cz>

Acked-by: Johannes Weiner <hannes at cmpxchg.org>

Thanks, Michal.


More information about the Intel-gfx mailing list