Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933226AbcLAVH2 (ORCPT ); Thu, 1 Dec 2016 16:07:28 -0500 Received: from gum.cmpxchg.org ([85.214.110.215]:50700 "EHLO gum.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751234AbcLAVH0 (ORCPT ); Thu, 1 Dec 2016 16:07:26 -0500 Date: Thu, 1 Dec 2016 16:07:15 -0500 From: Johannes Weiner To: Michal Hocko Cc: Andrew Morton , Vladimir Davydov , Marek =?iso-8859-1?Q?Marczykowski-G=F3recki?= , Balbir Singh , linux-mm@kvack.org, LKML Subject: Re: [PATCH] mm: workingset: fix NULL ptr in count_shadow_nodes Message-ID: <20161201210715.GA21302@cmpxchg.org> References: <20161201132156.21450-1-mhocko@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20161201132156.21450-1-mhocko@kernel.org> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 990 Lines: 23 On Thu, Dec 01, 2016 at 02:21:56PM +0100, Michal Hocko wrote: > From: Michal Hocko > > 0a6b76dd23fa ("mm: workingset: make shadow node shrinker memcg aware") > has made the workingset shadow nodes shrinker memcg aware. The > implementation is not correct though because memcg_kmem_enabled() might > become true while we are doing a global reclaim when the sc->memcg might > be NULL which is exactly what Marek has seen: [...] > This patch fixes the issue by checking sc->memcg rather than memcg_kmem_enabled() > which is sufficient because shrink_slab makes sure that only memcg aware shrinkers > will get non-NULL memcgs and only if memcg_kmem_enabled is true. > > Fixes: 0a6b76dd23fa ("mm: workingset: make shadow node shrinker memcg aware") > Reported-and-tested-by: Marek Marczykowski-G?recki > Cc: stable@vger.kernel.org # 4.6+ > Signed-off-by: Michal Hocko Acked-by: Johannes Weiner Thanks Michal