Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755137AbdCGJ7C (ORCPT ); Tue, 7 Mar 2017 04:59:02 -0500 Received: from mx2.suse.de ([195.135.220.15]:52353 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754969AbdCGJ6h (ORCPT ); Tue, 7 Mar 2017 04:58:37 -0500 Date: Tue, 7 Mar 2017 10:58:33 +0100 From: Michal Hocko To: Minchan Kim Cc: Johannes Weiner , Andrew Morton , linux-kernel@vger.kernel.org, shli@fb.com, hillf.zj@alibaba-inc.com, hughd@google.com, mgorman@techsingularity.net, riel@redhat.com, mm-commits@vger.kernel.org Subject: Re: + mm-reclaim-madv_free-pages.patch added to -mm tree Message-ID: <20170307095833.GB28642@dhcp22.suse.cz> References: <58b616a6.hCl1D/BVn0fPDi+K%akpm@linux-foundation.org> <20170303025237.GB3503@bbox> <20170303151851.GA16835@cmpxchg.org> <20170306030344.GG8779@bbox> <20170306154906.GA2090@cmpxchg.org> <20170307055551.GC29458@bbox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170307055551.GC29458@bbox> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1526 Lines: 54 On Tue 07-03-17 14:55:51, Minchan Kim wrote: [...] > >From d42d296950c3bbce74afddcff307fa18eef305fe Mon Sep 17 00:00:00 2001 > From: Minchan Kim > Date: Tue, 7 Mar 2017 14:48:37 +0900 > Subject: [PATCH] mm: fix lazyfree bug on check in try_to_unmap_one > > If a page is swapbacked, it means it should be in swapcache > in try_to_unmap_one's path. > > If a page is !swapbacked, it mean it shouldn't be in swapcache > in try_to_unmap_one's path. > > Check both two cases all at once and if it fails, warn and > return SWAP_FAIL. Such bug never mean we should shut down > the kernel. > > Suggested-by: Johannes Weiner > Signed-off-by: Minchan Kim looks good to me Acked-by: Michal Hocko > --- > mm/rmap.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/mm/rmap.c b/mm/rmap.c > index 35acb83..9925f32 100644 > --- a/mm/rmap.c > +++ b/mm/rmap.c > @@ -1413,8 +1413,13 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma, > * Store the swap location in the pte. > * See handle_pte_fault() ... > */ > - VM_BUG_ON_PAGE(!PageSwapCache(page) && PageSwapBacked(page), > - page); > + if (VM_WARN_ON_ONCE(PageSwapBacked(page) != > + PageSwapCache(page))) { > + ret = SWAP_FAIL; > + page_vma_mapped_walk_done(&pvmw); > + break; > + > + } > > /* MADV_FREE page check */ > if (!PageSwapBacked(page)) { > -- > 2.7.4 > -- Michal Hocko SUSE Labs