Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2327130yba; Fri, 10 May 2019 09:38:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqyaaYz6xktbUZIiNS9Tfpcz1SkNOEhH8GngiRvUWkaQ23/Y620f7730HZgLS5eTUD53+F3b X-Received: by 2002:a65:6145:: with SMTP id o5mr14968414pgv.262.1557506326832; Fri, 10 May 2019 09:38:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557506326; cv=none; d=google.com; s=arc-20160816; b=bsMksnb47BqUdIm93S7EwrwYuYYzAnJmHZ4U/IpMY0hlxaYkH9icb1Eyndlbfszg47 /FtFunodnKmtRTuKelZ30jbI9ucXSw8fpmtnsIoR7b8cTDPf0opdnoEzH0bswe3gpObX RRA9l5EFjKD0GLQpKBAwfzao5Mv9cKTfpwnuZIr2ZYIRTzWPUyqQcnW6W2z3emIscWt1 ZxG2BHKEqo1Rx6jPR9fHPMyrQywS0gCJ6n/wfgJ8khEQrVd7d7X8ajxQbrNRffY1E3Km n0DwyvJZn6JbHmpH/yIbVW00ivoLoyYWWZIF1WKDmWfujtRQZsuhzqOlHT3Tn6aSWlqw KrEQ== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=b/JhnmzdXvcZzBwouxXoQxGy1LUWG9vrwQ6s+nGq3oI=; b=ebn/N7x+/ado3qIhWrxsa8O+94mvFYaeP57IsEJI56NVOViMGB0Jr3AkzYtJ0LoiJu mI7cky0Ape/QZ2rc+VeQVeLuh0Lx2npqbufMXMpcylvcIS8IxkHLAORF59Az4j2whsY5 346+oU6OzSX5RX6wfjhdAJ+XkjyAwW00OdCsi6h/RErh1OGVQv2oRj01MOoV4cbGcR+B VxFP0Gi3J9Xle6urImVal+7PlMTZ8tYYspharZe7Ml+RETsOCDtL61a8XVPn3JG95jRF OooefKgHfyBWPBX9BQV3MDr+s8qqH1M6gAHkiFnewPJukHhSTP7TtUvOqELij4clJGpl jxCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=aa7n+JxO; 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 n1si8531598pld.61.2019.05.10.09.38.30; Fri, 10 May 2019 09:38:46 -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=aa7n+JxO; 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 S1727710AbfEJQgV (ORCPT + 99 others); Fri, 10 May 2019 12:36:21 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:51372 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727496AbfEJQgV (ORCPT ); Fri, 10 May 2019 12:36:21 -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-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding: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=b/JhnmzdXvcZzBwouxXoQxGy1LUWG9vrwQ6s+nGq3oI=; b=aa7n+JxOP4GJyt+6e9t186rvV ZLNOAx0QcDgAMax2GMB3YAFR2nvjovRMNFHsqMoqrw7bksP5Q8t57AlEyhctFD8PzdKtfIZxNHlhk BrX2diNGkIneThNr0j/li+YDar0K9CwzwSzMjRNI7W+Txv4AWT/oCeGKEGoBxCafblJbgmvzstPVA 30TskXHyRLMWWBNBqfYi9PHfso3dkPLNR5XffHnIz7m43cbLaBTst9Kf/A9/zzwKrOG2FJqqc30DE YXtWqLHH6vgBfoqm12GBjjebNEbUh6DPDhKHlp48pY78sCZhOkd4aV3aHiXiSQcBrDo9Uyo4bZNRj uw3aSHlXQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP8VJ-0007RN-1p; Fri, 10 May 2019 16:36:13 +0000 Date: Fri, 10 May 2019 09:36:12 -0700 From: Matthew Wilcox To: "Huang, Ying" Cc: Yang Shi , 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: <20190510163612.GA23417@bombadil.infradead.org> References: <1557447392-61607-1-git-send-email-yang.shi@linux.alibaba.com> <87y33fjbvr.fsf@yhuang-dev.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87y33fjbvr.fsf@yhuang-dev.intel.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 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). Better suggestions on naming gratefully received. I'm more happy with page_size() than I am with compound_nr(). page_nr() gives the wrong impression; page_count() isn't great either.