From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33B5DC433DB for ; Sun, 14 Mar 2021 04:13:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E103C64EE2 for ; Sun, 14 Mar 2021 04:12:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234946AbhCNEM1 (ORCPT ); Sat, 13 Mar 2021 23:12:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234941AbhCNEMJ (ORCPT ); Sat, 13 Mar 2021 23:12:09 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE863C061574; Sat, 13 Mar 2021 20:12:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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; bh=02jgM/7ByYHgEtTryAQckCxQUmrHridrlm+xFZ5jOkE=; b=Vh9jIURFq7H64sfFuYM3dyj+gH EqZ+P5PatjvVgG8RRjDFxFsp0IETWf19ZavYwd07/Gz1Ud6lFQxi6eM/LHblG/UgvFvU6JtpGqNJ9 s3WeyRblL8QMjOJ2NYycDb0xLkzf6J+ZwlooyrTNhn7jxATSLTVqJb/zjkADLikWEfTURw61zA6Wd nZzsogrO9XIe5wMZ7De4MVDE/neCSSdd2uDpM4pTGWOfsYphEOvId51WaS/O2TrqrJscPugCLz/9S moBQ4oJfeY0bK8sJ4Cn4aEnLtvfaEu7gbqRMfsZHWiszkyPlcy+CokVNTnumseEdjJessOwVgq+QF 1mj2H7lA==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lLI6d-00FWm2-Ih; Sun, 14 Mar 2021 04:11:57 +0000 Date: Sun, 14 Mar 2021 04:11:55 +0000 From: Matthew Wilcox To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v4 03/25] mm/vmstat: Add functions to account folio statistics Message-ID: <20210314041155.GP2577561@casper.infradead.org> References: <20210305041901.2396498-1-willy@infradead.org> <20210305041901.2396498-4-willy@infradead.org> <20210313123707.231fe9852872b269a00fcc89@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210313123707.231fe9852872b269a00fcc89@linux-foundation.org> Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Sat, Mar 13, 2021 at 12:37:07PM -0800, Andrew Morton wrote: > On Fri, 5 Mar 2021 04:18:39 +0000 "Matthew Wilcox (Oracle)" wrote: > > > Allow page counters to be more readily modified by callers which have > > a folio. Name these wrappers with 'stat' instead of 'state' as requested > > by Linus here: > > https://lore.kernel.org/linux-mm/CAHk-=wj847SudR-kt+46fT3+xFFgiwpgThvm7DJWGdi4cVrbnQ@mail.gmail.com/ > > > > --- a/include/linux/vmstat.h > > +++ b/include/linux/vmstat.h > > @@ -402,6 +402,54 @@ static inline void drain_zonestat(struct zone *zone, > > struct per_cpu_pageset *pset) { } > > #endif /* CONFIG_SMP */ > > > > +static inline > > +void __inc_zone_folio_stat(struct folio *folio, enum zone_stat_item item) > > +{ > > + __mod_zone_page_state(folio_zone(folio), item, folio_nr_pages(folio)); > > +} > > The naming is unfortunate. We expect > > inc: add one to > dec: subtract one from > mod: modify by signed quantity > > So these are inconsistent. Perhaps use "add" and "sub" instead. At > least to alert people to the fact that these are different. > > And, again, it's nice to see the subsystem's name leading the > identifiers, so "zone_folio_stat_add()". I thought this was a 'zone stat', so __zone_stat_add_folio()? I'm not necessarily signing up to change the existing __inc_node_page_state(), but I might. If so, __node_stat_add_page()?