Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp684703ybz; Wed, 22 Apr 2020 06:10:59 -0700 (PDT) X-Google-Smtp-Source: APiQypLTsZ9DvCdrrfqQMh68Clqe2EZF4J4tJM+fkuhwDVzx18wEoFImDnimBoc06QOTyQPyWuRN X-Received: by 2002:a17:906:35cd:: with SMTP id p13mr27046750ejb.206.1587561059179; Wed, 22 Apr 2020 06:10:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587561059; cv=none; d=google.com; s=arc-20160816; b=mfHxb7/J6biyR7OVDfco7te8S5Pud1oyMliAzJgKd+9buiufLNjgNcGbNF2eiXcD3Y WKJC5g3ZaTEhtUIza1RBaAzEjGcMzgypW9VCkWzWBsW9q8GyQtRUTV8NUDRvEDXsuUer 4QJSWC/+wBuKENSgxVEDJBoTnMXyVt0zm8Bv3PJi6H4H2V+ucuEgWyGzTW/6LNCHtTpP e7yzbThuVL7aE076+CZzmAXeGCOPOpFJdoDCVzY6mw+CnLndjobg6qiRc6HyeH7Ap/ih lU8kTs+et7j3wVTdJmBNWFcK94JJ58nr6zdO774UPlvJ/U6RH8baVsW+9x/QB5nCC+ZP y9Aw== 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-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=t/d88ptbHW16yolwYgjYhhzxJpVgAUC7qN1Ke/LGyuQ=; b=B21s3wlaPBhU9LiOcvoa3lMU/g89Y+Tn2D77EXzig3Xb63IzW2KcchLOtAyXrz0fJN kXoiU2i3ttVN5aj+mcwSn/Q2rFTa5YraWzLhbTP85cJ/8oPRYz4ZLxWQOmHjgWprtveC v2UwwhLuKCyd3OHXAjzqmaL28ltzAbxrd0ydBys8eOULh1LvuGMpRie/JldghWGnE2CQ 1C9falhrl2Mfw7FkbntTiaJhhF3BS+hFnE0brGdIe476/Y7KDieWxqknwmI7X+lr4K87 P1qCA98G1ANenAQcG7DDyz7XV51hOp9cUZiomCmbmK/Y3lDP7LAP21Bzwlhy3Zx07s1c MhMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=qsaB9olm; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d6si3336175edy.66.2020.04.22.06.10.23; Wed, 22 Apr 2020 06:10:59 -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=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=qsaB9olm; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726534AbgDVNHz (ORCPT + 99 others); Wed, 22 Apr 2020 09:07:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726323AbgDVNHy (ORCPT ); Wed, 22 Apr 2020 09:07:54 -0400 Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 423C1C03C1A9 for ; Wed, 22 Apr 2020 06:07:54 -0700 (PDT) Received: by mail-qk1-x744.google.com with SMTP id l78so2213744qke.7 for ; Wed, 22 Apr 2020 06:07:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=t/d88ptbHW16yolwYgjYhhzxJpVgAUC7qN1Ke/LGyuQ=; b=qsaB9olmzPIZAD6whvSiEFkbwl6xLcgwsnRvannVlmAsxdFLZ/RRfMEjlKmi/6OOgu kHYx+tcAXRlSCo/zbrWDhApTqyKO8wuvGNbYSxBaWHI2Ud0Rs082zBJMw1ZunAJesho0 fckblzPFrqXW7GtRmvi4suci54vNSBw6essdzZyE7g2hkcBXcgzQlweIKFZN3nv2d7Hk FGXqOUG57vbo7S1jjGLXCJSvYV/owIdJHJjJM41nlfZS7pDLfdoRPDQx5NNfkj3cp8na 5sNWxBCG1/yv29Os99j9OCm7iFk016k5Dy3MdH1Oe0xQwj0K7gfEPZlGC10SkI+EAgct UJrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=t/d88ptbHW16yolwYgjYhhzxJpVgAUC7qN1Ke/LGyuQ=; b=pNXtlE+HRc2/Z5zb4lj7TBshhZqUe2OMVTP0cqVxOFFAbzPNLUfbCyOvbVd+9rqLux BZu8H4o48k+00SwPO/CUX2avLwACqJp+QYUOjuXa7oVtf8118rliRTryMmfFT7fo9kZa atoGSGn6/cj6G6wONNv/F8ICleUjVRVHYAnPT7O6oP01kZuvNVoIRHoWaRnBIVm2DzL1 HAJI1CFunLRbd/w9pwmY/qrbeLZQYyFrTpjJKuzxTXIW1l00RsKv2iUmUKdY0PvlpAfX m+qaMETAUGtsxAkcdEVPO5LrOH0XTjqZjZnnHXe3gw/I2hRyvl1VPVeLL++QXb0D6idi /MfA== X-Gm-Message-State: AGi0PubEbC5T1QSjDK5q++AmrZbDR4HQp9VI6wR7TiMmkaGpZfmZUFzf pwPUuE6/yHzRItIkrpz/BgHz/Q== X-Received: by 2002:a37:a9c7:: with SMTP id s190mr27254227qke.435.1587560873513; Wed, 22 Apr 2020 06:07:53 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::921]) by smtp.gmail.com with ESMTPSA id t27sm3739061qkg.4.2020.04.22.06.07.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2020 06:07:52 -0700 (PDT) Date: Wed, 22 Apr 2020 09:07:51 -0400 From: Johannes Weiner To: Jaewon Kim Cc: minchan@kernel.org, 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: <20200422130751.GD358439@cmpxchg.org> References: <20200422084815.21913-1-jaewon31.kim@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200422084815.21913-1-jaewon31.kim@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)) > + stat->nr_lazyfree_fail += nr_pages; > goto activate_locked; Or at least was_lazyfree. > @@ -1491,8 +1495,8 @@ unsigned long reclaim_clean_pages_from_list(struct zone *zone, > .priority = DEF_PRIORITY, > .may_unmap = 1, > }; > - struct reclaim_stat dummy_stat; > - unsigned long ret; > + struct reclaim_stat stat; > + unsigned long reclaimed; nr_reclaimed would be better. I also prefer keeping dummy_stat, since that's still what it is.