From patchwork Thu Jan 28 07:03:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12052053 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=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 C8971C433DB for ; Thu, 28 Jan 2021 07:04:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 574BB64DD6 for ; Thu, 28 Jan 2021 07:04:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 574BB64DD6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5AF6F6B0070; Thu, 28 Jan 2021 02:04:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 539966B0071; Thu, 28 Jan 2021 02:04:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 38B246B0072; Thu, 28 Jan 2021 02:04:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0078.hostedemail.com [216.40.44.78]) by kanga.kvack.org (Postfix) with ESMTP id 1E0D96B0070 for ; Thu, 28 Jan 2021 02:04:16 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id DDC678249980 for ; Thu, 28 Jan 2021 07:04:15 +0000 (UTC) X-FDA: 77754294870.24.group68_56062a12759d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id B06771A4A5 for ; Thu, 28 Jan 2021 07:04:15 +0000 (UTC) X-HE-Tag: group68_56062a12759d X-Filterd-Recvd-Size: 4195 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Thu, 28 Jan 2021 07:04:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=pHmMPYJfZBRLbAE614BrSgF4Qt/dpevDIb6z8WYnHzg=; b=bFVpzXOZcQmefDQap7PvwUAkLl WMLUcdrQNyxBidm2C0IgO+a7I0XWHj2tSfdmFWni9wtnMIZqMaGzXkbASX9I75ZS6+0a3rhSyZGtq qSBlxjD3klpeud5Ghl83QF+M33Sa58sdXnn8E/7JHbZjX8UjxZO/FVnaBhAaFmpnfHSXxj3poX9R/ Jq4d0enFUE2kSRwkS7s0+Q6YA40kI+UR5KmJGB4J9d39ORTpegSxIZnko9Nowo8dydYBnKZeqP/zi 8oU2wBa6lmowPJGHhJA0IQO7rvM/ABhinO8DtRnXLUK+6lOLnQ3YRj6Nioia8Oou7gjWz2s130Bd4 J2kODcAA==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1l51Ld-00846D-OP; Thu, 28 Jan 2021 07:04:10 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org Subject: [PATCH v3 03/25] mm/vmstat: Add folio stat wrappers Date: Thu, 28 Jan 2021 07:03:42 +0000 Message-Id: <20210128070404.1922318-4-willy@infradead.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210128070404.1922318-1-willy@infradead.org> References: <20210128070404.1922318-1-willy@infradead.org> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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/ Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/vmstat.h | 60 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 773135fc6e19..3c3373c2c3c2 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -396,6 +396,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) +{ + __inc_zone_page_state(&folio->page, item); +} + +static inline +void __dec_zone_folio_stat(struct folio *folio, enum zone_stat_item item) +{ + __dec_zone_page_state(&folio->page, item); +} + +static inline +void inc_zone_folio_stat(struct folio *folio, enum zone_stat_item item) +{ + inc_zone_page_state(&folio->page, item); +} + +static inline +void dec_zone_folio_stat(struct folio *folio, enum zone_stat_item item) +{ + dec_zone_page_state(&folio->page, item); +} + +static inline +void __inc_node_folio_stat(struct folio *folio, enum node_stat_item item) +{ + __inc_node_page_state(&folio->page, item); +} + +static inline +void __dec_node_folio_stat(struct folio *folio, enum node_stat_item item) +{ + __dec_node_page_state(&folio->page, item); +} + +static inline +void inc_node_folio_stat(struct folio *folio, enum node_stat_item item) +{ + inc_node_page_state(&folio->page, item); +} + +static inline +void dec_node_folio_stat(struct folio *folio, enum node_stat_item item) +{ + dec_node_page_state(&folio->page, item); +} + static inline void __mod_zone_freepage_state(struct zone *zone, int nr_pages, int migratetype) { @@ -530,6 +578,18 @@ static inline void __dec_lruvec_page_state(struct page *page, __mod_lruvec_page_state(page, idx, -1); } +static inline void __inc_lruvec_folio_stat(struct folio *folio, + enum node_stat_item idx) +{ + __mod_lruvec_page_state(&folio->page, idx, 1); +} + +static inline void __dec_lruvec_folio_stat(struct folio *folio, + enum node_stat_item idx) +{ + __mod_lruvec_page_state(&folio->page, idx, -1); +} + static inline void inc_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx) {