Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2182314ybz; Thu, 23 Apr 2020 13:06:42 -0700 (PDT) X-Google-Smtp-Source: APiQypIwa2bLIOPIucLyji+Zxxwyg52vjTwBUPjz3GF36vn2nB9oT2r2f89vATwCXw984yB6Qlqi X-Received: by 2002:a50:8d02:: with SMTP id s2mr4440596eds.81.1587672401758; Thu, 23 Apr 2020 13:06:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587672401; cv=none; d=google.com; s=arc-20160816; b=EO9d7uyvWTZ7fE40+fDDyn1/pHTwP+JH+38hMUf7SfV3MSCLwsPDgNA65inoA3ZKo/ HxtkJTAcLxGV/VL7Xy2+qfJt1+oKgAKXoqdIGH2AQpxWz57Nt1iqXvjj2ekKNsKm29l1 SdO9oDXb6uTDw8pLmKg6bq22fh23wcxzveDqy8iCCMuYle94OEF+ACoAd+v3JzDRTy0V omeZWQbJvoOSO/S5FDBYjASEEgT4k55OMBzxT34g13g+VMbuJjotSvwM47E15+/bdhO/ 1hUot9zc6KEHseaio/QXBfoarVIkRFxgK6MUWjRituez/6EjnLyMdXCB2iKKXkWrMopH 6bmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=WNO7NKxkJpAJDOutrLoHzbNSgDH4TOj7e9H6a/yToIs=; b=Hhkv/B6twwMiSsr7OvIy57DZmo0JLNBtbZ5Rx/4+5CHBrJFtrOJIED2D48qw/IzQti kMcZK3xRVWkfnN1OzF02YwvVXem3OnrL+ehiqhAzEzuH/fLAyNjp+gbMbZ1YPfZsPVUG PBAqBL8UEcjSyGa6SAFrZMKpFFuJFYpb17deBXSuUWLHErjsilM2bM4SqI02051mKewF VgzZ/X+K39cRkunfYhv8E/aywjYxpfiwrfTmpMJDGYoLWs0X8WgpHY1euvHdJTs3KyIf XX1QCZO68raBwrN88JkHi5vTtSUQjYcgL9zdQs4oap3AwqNmNNuWZvGmZkM5TWKLer5r PVTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=GDpy3Gt5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v22si1853357ejw.454.2020.04.23.13.06.15; Thu, 23 Apr 2020 13:06:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=GDpy3Gt5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726343AbgDWUA0 (ORCPT + 99 others); Thu, 23 Apr 2020 16:00:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725934AbgDWUAZ (ORCPT ); Thu, 23 Apr 2020 16:00:25 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7638FC09B042 for ; Thu, 23 Apr 2020 13:00:24 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id h69so3415553pgc.8 for ; Thu, 23 Apr 2020 13:00:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=WNO7NKxkJpAJDOutrLoHzbNSgDH4TOj7e9H6a/yToIs=; b=GDpy3Gt5Dwy59orl+GSWU7IVcoSdVcntRMwW14jzXGDkk4y1D7XCaT6NAAk/JyNIFM H+K/0KFCU5NpOQcqT/4f42/Kkm2KBKVFl1tkHIjEO6XgaZJTN/sVH0IudLJc+ITFULlG 82XcYlMkz1OXsnrw+b/5icSWyNJLY32toCTgo6V0LR/sJwbvJaDI1N+eYdIr+dvHDM3Z VvJyFFmZ6OUEobZ+qmv8VlvEE+iA3SgXNNPMTBSyjUkrRi9aaZgo5FV29yq7L+sHNNWp ILZj90Nf8C7Fj/FjlbS/mUwFYhDvdDSet6oSjy90VRXRHY+LkqOgItlJquqY88+Wp9Dz CKSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=WNO7NKxkJpAJDOutrLoHzbNSgDH4TOj7e9H6a/yToIs=; b=JGbgSZg1iU4hcQw95fOSzjdxAiE5grjAYPpnPhTj3ndCz3D/NhacjSYPexA3kKghA9 cpThEhXEvJrksq+a4iMCDuFexeQ2r0Xf6m6KJaajWJjLiFY4dEzjKRfwigN7Hei90lug 9K3x1fk0cOBKLagb4MBt4sfBWc9xFEiDfP1AEMTbH4u6wU+Vu71q9skB+kB2orDIxdXo xshYZWC94N5BiyE6SIqhs4BXhT8qdGJfDVCsKRumNjXczb+71UP4+Q8r0heEtHbOFRSz zxzQEy3vtoGd4VJr8N+VoNdBlsLcG1c7Xu4iPTNU7EeO35hJma/iiwNnXQi9w6JSJsjp CuHg== X-Gm-Message-State: AGi0PuZwREflIRPONu+YINYZMj2Imfjyy6D/r295RNLkG+M0XPycgWV8 t7vH52Impxo6g3ujUvkCi7M= X-Received: by 2002:a65:6288:: with SMTP id f8mr5449714pgv.118.1587672023904; Thu, 23 Apr 2020 13:00:23 -0700 (PDT) Received: from google.com ([2620:15c:211:1:3e01:2939:5992:52da]) by smtp.gmail.com with ESMTPSA id b29sm3471291pfp.68.2020.04.23.13.00.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 13:00:22 -0700 (PDT) Date: Thu, 23 Apr 2020 13:00:20 -0700 From: Minchan Kim To: Johannes Weiner Cc: Jaewon Kim , mgorman@suse.de, m.szyprowski@samsung.com, mina86@mina86.com, shli@fb.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, jaewon31.kim@gmail.com, ytk.lee@samsung.com Subject: Re: [PATCH v2] mm/vmscan: count layzfree pages and fix nr_isolated_* mismatch Message-ID: <20200423200020.GB46847@google.com> References: <20200422084815.21913-1-jaewon31.kim@samsung.com> <20200422130751.GD358439@cmpxchg.org> <5EA10872.3010500@samsung.com> <20200423160546.GA389168@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200423160546.GA389168@cmpxchg.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 23, 2020 at 12:05:46PM -0400, Johannes Weiner wrote: > On Thu, Apr 23, 2020 at 12:16:02PM +0900, Jaewon Kim wrote: > > > > > > On 2020년 04월 22일 22:07, Johannes Weiner wrote: > > > On Wed, Apr 22, 2020 at 05:48:15PM +0900, Jaewon Kim wrote: > > >> @@ -1295,11 +1295,15 @@ static unsigned long shrink_page_list(struct list_head *page_list, > > >> */ > > >> if (page_mapped(page)) { > > >> enum ttu_flags flags = ttu_flags | TTU_BATCH_FLUSH; > > >> + bool lazyfree = PageAnon(page) && !PageSwapBacked(page); > > >> > > >> if (unlikely(PageTransHuge(page))) > > >> flags |= TTU_SPLIT_HUGE_PMD; > > >> + > > >> if (!try_to_unmap(page, flags)) { > > >> stat->nr_unmap_fail += nr_pages; > > >> + if (lazyfree && PageSwapBacked(page)) > > > This looks pretty strange, until you remember that try_to_unmap() > > > could SetPageSwapbacked again. > > > > > > This might be more obvious? > > > > > > was_swapbacked = PageSwapBacked(page); > > > if (!try_to_unmap(page, flags)) { > > > stat->nr_unmap_fail += nr_pages; > > > if (!was_swapbacked && PageSwapBacked(page)) > > Hello Johannes, thank you for your comment. > > > > The name can changed from layzyfree to was_swapbacked. > > By the way, did you mean removing PageAnon(page), too? It seems to be OK, though. > > I can't decide whether PageAnon() makes it clearer or not. But it's > not really needed for correctness. So feel free to keep what you had. Yub, PageAnon is redundant. > I would really just at least change bool lazyfree to was_lazyfree, It's better.