From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933125AbdBQJ1d (ORCPT ); Fri, 17 Feb 2017 04:27:33 -0500 Received: from LGEAMRELO13.lge.com ([156.147.23.53]:50270 "EHLO lgeamrelo13.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932088AbdBQJ1c (ORCPT ); Fri, 17 Feb 2017 04:27:32 -0500 X-Original-SENDERIP: 156.147.1.126 X-Original-MAILFROM: minchan@kernel.org X-Original-SENDERIP: 10.177.223.161 X-Original-MAILFROM: minchan@kernel.org Date: Fri, 17 Feb 2017 18:27:24 +0900 From: Minchan Kim To: Johannes Weiner 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 V3 3/7] mm: reclaim MADV_FREE pages Message-ID: <20170217092724.GA23524@bbox> References: <20170216184018.GC20791@cmpxchg.org> <20170217054108.GA3653@bbox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170217054108.GA3653@bbox> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 17, 2017 at 02:41:08PM +0900, Minchan Kim wrote: > Hi Johannes, > > On Thu, Feb 16, 2017 at 01:40:18PM -0500, Johannes Weiner wrote: > > On Tue, Feb 14, 2017 at 11:36:09AM -0800, Shaohua Li wrote: > > > @@ -1419,11 +1419,18 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma, > > > VM_BUG_ON_PAGE(!PageSwapCache(page) && PageSwapBacked(page), > > > page); > > > > > > - if (!PageDirty(page) && (flags & TTU_LZFREE)) { > > > - /* It's a freeable page by MADV_FREE */ > > > - dec_mm_counter(mm, MM_ANONPAGES); > > > - rp->lazyfreed++; > > > - goto discard; > > > + if (flags & TTU_LZFREE) { > > > + if (!PageDirty(page)) { > > > + /* It's a freeable page by MADV_FREE */ > > > + dec_mm_counter(mm, MM_ANONPAGES); > > > + rp->lazyfreed++; > > > + goto discard; > > > + } else { > > > + set_pte_at(mm, address, pvmw.pte, pteval); > > > + ret = SWAP_FAIL; > > > + page_vma_mapped_walk_done(&pvmw); > > > + break; > > > + } > > > > I don't understand why we need the TTU_LZFREE bit in general. More on > > that below at the callsite. > > The reason I introduced it was ttu is used for migration/THP split path > as well as reclaim. It's clear to discard them in reclaim path because > it means surely memory pressure now but not sure with other path. > > If you guys think it's always win to discard them in try_to_unmap > unconditionally, I think it would be better to be separate patch. I was totally wrong. Anon page with THP split/migration/HWPoison will not reach to discard path in try_to_unmap_one so Johannes is right. We don't need TTU_LZFREE. Sorry for the noise. Thanks.