Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2341414yba; Fri, 10 May 2019 09:53:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRQflTZfYmhGULgiMX9cMk901ZpBPLhvu8I6rRDMzrYMKzeq+AlQaEM/V/IGO5a5NQAn6r X-Received: by 2002:a62:2a55:: with SMTP id q82mr15903064pfq.90.1557507209925; Fri, 10 May 2019 09:53:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557507209; cv=none; d=google.com; s=arc-20160816; b=gXRObWHzVo4tETzQhE6NKXJGNVc0gCQM1NDggkZE2Fe1Om1zP/4NUmfAUT1tmsc/Le DmPsbm6NIdtXEfsQYbJV7N95DnrdYGlybXf56lYDp3pd7pPpY2QTADhPLnsp3s4y+6P4 Zet7K82VdXGtZOE4SwNpYOZlCKh+9w3ksn/8mQG3CNnohD/NwroajV/PV7RHoD42qNai lsZFLBeQhUjD2w5JVLi2Plgob5uMIU6dTp9BF0c6FyA2l/YPQ0dhLhMv91iHd37UBhIF KNmBYtfrHPlXliik9XXmHkvbg5GP2G1QAy5f/UG6WV7pYMfq7/grkjpGSUmpLPvmPNNC 2dqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hkMgP0pxOFd4HXfh4zG7QpG6/qI5aXSYBZKtEO3EEOI=; b=Q/B8LSE6jtGS7iFpC2w7BW4djYy72tIi0aJXdDyx+dUqyLg10xcyb556F6ca5BoE7v 96qbspzaF4umD+TpR6dmjDMKFBXreluA3PvK6KSJNesbkpCG+/RXvm+/l30GsfiVFlYC eefXgbs8Gx8kQL7pUps62gDyS1hwA/f9N6ckcPUgVpYOIiDInWJngIl7HB06NiELWUaR ZD4IPFx+exv3ejy5ikWBriVziI0+VGNb13jzjmR5KLJYGwMFEnejFUj1l1+ADwY30Bm/ 36sCa7oBcasFdv46r6f4xKIIohB/At1h5Pip7CvfbvwNS4GxJQDmC3H2KjsVSb0qjBK+ CF/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=MRHCCiJ+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 9si2387933pgu.189.2019.05.10.09.53.13; Fri, 10 May 2019 09:53:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=MRHCCiJ+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727879AbfEJQwP (ORCPT + 99 others); Fri, 10 May 2019 12:52:15 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:56442 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727650AbfEJQwO (ORCPT ); Fri, 10 May 2019 12:52:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=hkMgP0pxOFd4HXfh4zG7QpG6/qI5aXSYBZKtEO3EEOI=; b=MRHCCiJ+3KeZif+1OowuNRo8gx rw7Pi279ZHHTn8y+BPlMF+KGvPAKwTr37z9Le5nCCU1xz0k7mZTBVhCYs+rrX1T4qSXTySjZOVkgi FBkfp8faCE6Yp6LnvgcG3RoGA3/Q4LrApYMwdTfaWfeoBJIh3f9bdUwV4LpCNcqccpSO9e5SzeC55 bwjPm+PaV0By4jwPQ29iFDXr0OACaYxAJJILFO4Gni3WsTwj68bWAnoSyx3FpWLgXcaFSd6ZirxlU 0IGUnh+W3pbx1E1b1A5SgRfD666iyufVPJKb++1gBE6nHF68XkZ6DP/SWIcLissANZMhMeybeCplc PoVJlybA==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP8kh-00045a-F2; Fri, 10 May 2019 16:52:07 +0000 Date: Fri, 10 May 2019 09:52:07 -0700 From: Matthew Wilcox To: Yang Shi Cc: "Huang, Ying" , hannes@cmpxchg.org, mhocko@suse.com, mgorman@techsingularity.net, kirill.shutemov@linux.intel.com, hughd@google.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: vmscan: correct nr_reclaimed for THP Message-ID: <20190510165207.GB3162@bombadil.infradead.org> References: <1557447392-61607-1-git-send-email-yang.shi@linux.alibaba.com> <87y33fjbvr.fsf@yhuang-dev.intel.com> <20190510163612.GA23417@bombadil.infradead.org> <3a919cba-fefe-d78e-313a-8f0d81a4a75d@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3a919cba-fefe-d78e-313a-8f0d81a4a75d@linux.alibaba.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 10, 2019 at 09:50:04AM -0700, Yang Shi wrote: > On 5/10/19 9:36 AM, Matthew Wilcox wrote: > > On Fri, May 10, 2019 at 10:12:40AM +0800, Huang, Ying wrote: > > > > + nr_reclaimed += (1 << compound_order(page)); > > > How about to change this to > > > > > > nr_reclaimed += hpage_nr_pages(page); > > Please don't. That embeds the knowledge that we can only swap out either > > normal pages or THP sized pages. I'm trying to make the VM capable of > > supporting arbitrary-order pages, and this would be just one more place > > to fix. > > > > I'm sympathetic to the "self documenting" argument. My current tree has > > a patch in it: > > > > mm: Introduce compound_nr > > Replace 1 << compound_order(page) with compound_nr(page). Minor > > improvements in readability. > > > > It goes along with this patch: > > > > mm: Introduce page_size() > > > > It's unnecessarily hard to find out the size of a potentially huge page. > > Replace 'PAGE_SIZE << compound_order(page)' with page_size(page). > > So you prefer keeping using? "1 << compound_order" as v1 did? Then you will > convert all "1 << compound_order" to compound_nr? Yes. Please, let's merge v1 and ignore v2.