Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2656375yba; Fri, 10 May 2019 16:07:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqxiLSXN3VvXRz1ACoXhtI8TdFuSIJ6J16cpH14AutSDfxEYjm+3Fc8ZyzweYySB52bbOdIx X-Received: by 2002:a17:902:20e2:: with SMTP id v31mr16323284plg.138.1557529664516; Fri, 10 May 2019 16:07:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557529664; cv=none; d=google.com; s=arc-20160816; b=tYubiWrsHC0uiy1zzQbWSU/accEsf1PCCX8kUUgZIrikQweyIEuOPrk54hnTRXJkMl 0LoYo61BBhVfjff57F7wnH8oPrqSHqmQdUmMus0STRV1E+CRasEST1htjr3rg1Q15SHw EsXkc8QJetwuZ03VP9/xtgN1E7q0sAGIkDZ9OFdYFUOJ/zUX/AtHDJMJDERV88MfEagt v8q//gg6NEljdmvRLzlQXC7/scbjoN6zShfM7Z4wxVn3zYy1/EzB9tfYk5zBIOmZeU6/ V1q1E58oHG4PXFFsKLThjlIv1PO9Myd7W3oj9bTAPdCnCOQAD8JRn32SAtNRwcWsOuss /6zA== 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=teDBeReCOPgEIA4YvlNHjGWi0MjwIkQN8utbqMkM4JY=; b=umvRVFJshCNvP+425Ge4ylZJqziMKEtOqo9/VYts3qunBM+UyrH8DYoZZQCHyhtaEe t/IoFim6l0kpHxKVnZ07yYlf0yfV4dOTIO/FPQ1Qg/xJbPzY4BS0ch8kSr88dXPrY99Q 4QIvYM5qTqQD4lk84K1YYR61hu18IH/yiiP7gxeeJKmIwXV7R4LdbxbQ+tML1cdKuu8b QxaJRGPKBtmv0YWlHqd2/lSU1HQY/PJnuK54c0Ov4xKuSZtt8HXaELRmjU6aVy5961zE kJdXfhlMtRiOY5hseyYGWL9jPMsvLdBb5+TB051SKg94gb4/UIsF9bOxa+eMQW+iO0r1 VG2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ST5fCNq3; 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 v32si9208513plb.383.2019.05.10.16.07.27; Fri, 10 May 2019 16:07:44 -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=ST5fCNq3; 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 S1728049AbfEJXGj (ORCPT + 99 others); Fri, 10 May 2019 19:06:39 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:41610 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726944AbfEJXGi (ORCPT ); Fri, 10 May 2019 19:06:38 -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=teDBeReCOPgEIA4YvlNHjGWi0MjwIkQN8utbqMkM4JY=; b=ST5fCNq3P16ipcDSRBeOWzXml 7FhiGG3myj/I9/8Od4g2FDJVl9ra/7I3wWkDFs6SeTRoh80jmS4DDdjyxLupc8Bl6jPM5l+/e6a5b uLpGRA0jwaOCHY/yAQzIcZJ8WBFx/3PHUFcPCWrHBPGzelKMROkf6g1BseGmVMIJBNINg8LEzDh4e +svUFpd86SF1IZxArY1qnaSa3EC/RVFtM8knp2iF2UHLHb1H1RtvjLJV0h8LdpFsDpFkxyrG1/FNI NAYuDoCSGtAaSmp55TEUHro31WNrR0UfaKk9Gny1/nkZ0GljaDyN7FpN80UAKr2DP26E7q+QHm/yk dEQFe4j6g==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1hPEaq-0005m7-7X; Fri, 10 May 2019 23:06:20 +0000 Date: Fri, 10 May 2019 16:06:20 -0700 From: Matthew Wilcox To: Ira Weiny Cc: "Huang, Ying" , 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: <20190510230620.GA12158@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> <20190510225456.GA13529@iweiny-DESK2.sc.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190510225456.GA13529@iweiny-DESK2.sc.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 03:54:56PM -0700, Ira Weiny wrote: > On Fri, May 10, 2019 at 09:36:12AM -0700, 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). > > > > 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. > > Stupid question : what does 'nr' stand for? NumbeR. It's relatively common argot in the Linux kernel (as you can see from the earlier example ... > > > nr_reclaimed += hpage_nr_pages(page); willy@bobo:~/kernel/xarray-2$ git grep -w nr mm |wc -l 388 willy@bobo:~/kernel/xarray-2$ git grep -w nr fs |wc -l 1067