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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 986C2C433EF for ; Thu, 23 Jun 2022 16:07:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DAB3E8E015D; Thu, 23 Jun 2022 12:07:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D5AE48E0144; Thu, 23 Jun 2022 12:07:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C4B298E015D; Thu, 23 Jun 2022 12:07:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B70918E0144 for ; Thu, 23 Jun 2022 12:07:23 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 91B6834639 for ; Thu, 23 Jun 2022 16:07:23 +0000 (UTC) X-FDA: 79609980366.09.FC2CC31 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf27.hostedemail.com (Postfix) with ESMTP id 0FB5640037 for ; Thu, 23 Jun 2022 16:07:20 +0000 (UTC) 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=RB9/m8uHQQCll+yG7QN8tRCGkMzH5JCZ3P5+Y2rpVfU=; b=Ny0nEvwFdfc6EVSrWqfXikAfTJ VgknjhOz4xAbwFEFOeseKN/4eOP8DYT9LwHUj18zA1L/753iiyDB7aY9JONqxSAgQQCjxsi0yNFeT +vG4j9zLO6wE/tQ3fhgaWIvIeYD7fatkAnZK69SdEcZdA6q79Drrb0D4eMHV2INpiaKBMMXbUZaD3 og2lJeSB7+L8gHJpwvFefJIu0xnA6MUfVtys8ZT+sNkEtIyI0PPJUuYpUZrmzBj0/pCbOX2KltNh8 Cr9I/OsTx/XOhnYEVfi+2Evl4z4MJ9FsxqSbcgPVEoVBijUoY0XzKHOt7B0o7IL1tlDehhbn5lWJ8 evAcpCpg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4PMQ-007zFY-4Z; Thu, 23 Jun 2022 16:07:14 +0000 Date: Thu, 23 Jun 2022 17:07:14 +0100 From: Matthew Wilcox To: Baolin Wang Cc: akpm@linux-foundation.org, rppt@linux.ibm.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v2 1/3] mm: Factor out the pagetable pages account into new helper function Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Ny0nEvwF; spf=none (imf27.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656000443; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=RB9/m8uHQQCll+yG7QN8tRCGkMzH5JCZ3P5+Y2rpVfU=; b=H13Zu8zk1/RCzjYAvzr/infdBRElBSTEmDnxCxW3RFEPwnvfXjSQWecFXIHZyoGamVh7/1 o8G8BT26/uFZ2xJGQ7JoVgJKMvuk8sAPg8DbIMTDpsSukAA66Uw5UWq0JEpccXj11jEMIg jljjBnQXVadYo0GtbOPBoe0PV9WZw78= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656000443; a=rsa-sha256; cv=none; b=jrgAUFiTEotKXVOUIZD3YyZtbqhuvkNYwKn2IC3NfnukfBIR73GLjQ1qYGcdlX5zyxhk+s nIwn+H1f8uN4s9OnEpu5PY88c4MJvGLdDYcfOERYeY9fC1Pr72ywaItt3slvw0vWdQUC6D fXZQmalakpucJvzcyc7afA+1uUHwE78= X-Stat-Signature: pgbki7fog5rxifqac7hq77w9dbz8jm3s X-Rspam-User: X-Rspamd-Server: rspam07 Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Ny0nEvwF; spf=none (imf27.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspamd-Queue-Id: 0FB5640037 X-HE-Tag: 1656000440-597837 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: On Wed, Jun 22, 2022 at 04:58:52PM +0800, Baolin Wang wrote: > +static inline void pgtable_set_and_inc(struct page *page) > +{ > + __SetPageTable(page); > + inc_lruvec_page_state(page, NR_PAGETABLE); > +} I don't like the names. The accounting is also wrong for non-order-0 allocations. It should be mod_lruvec_page_state(page, NR_PAGETABLE, compound_nr(page)) but it's probably better to change the API to pass in the number of pages instead of recalculating it. I can't think of a good name. What's wrong with just adding static inline bool pgtable_pud_page_ctor(struct page *page) to go along with the pte and pmd variants?