From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751854AbdBXPoW (ORCPT ); Fri, 24 Feb 2017 10:44:22 -0500 Received: from gum.cmpxchg.org ([85.214.110.215]:37040 "EHLO gum.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751341AbdBXPm6 (ORCPT ); Fri, 24 Feb 2017 10:42:58 -0500 Date: Fri, 24 Feb 2017 10:36:55 -0500 From: Johannes Weiner To: Minchan Kim Cc: Shaohua Li , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Kernel-team@fb.com, mhocko@suse.com, hughd@google.com, riel@redhat.com, mgorman@techsingularity.net, akpm@linux-foundation.org Subject: Re: [PATCH V4 4/6] mm: reclaim MADV_FREE pages Message-ID: <20170224153655.GA20092@cmpxchg.org> References: <94eccf0fcf927f31377a60d7a9f900b7e743fb06.1487788131.git.shli@fb.com> <20170224021218.GD9818@bbox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170224021218.GD9818@bbox> User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 24, 2017 at 11:12:18AM +0900, Minchan Kim wrote: > > @@ -1525,8 +1531,8 @@ int try_to_unmap(struct page *page, enum ttu_flags flags) > > > > if (ret != SWAP_MLOCK && !page_mapcount(page)) { > > ret = SWAP_SUCCESS; > > - if (rp.lazyfreed && !PageDirty(page)) > > - ret = SWAP_LZFREE; > > + if (rp.lazyfreed && PageDirty(page)) > > + ret = SWAP_DIRTY; > > Hmm, I don't understand why we need to introduce new return value. > Can't we set SetPageSwapBacked and return SWAP_FAIL in try_to_unmap_one? I think that's a bad idea. A function called "try_to_unmap" shouldn't have as a side effect that it changes the page's LRU type in an error case. Let try_to_unmap be about unmapping the page. If it fails, make it report why and let the caller deal with the fallout. Any LRU fixups are much better placed in vmscan.c.