Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6008202iog; Thu, 23 Jun 2022 09:26:40 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t0MzPjBVdwmYKYo55hKnBym/M7cC/7AtqJdD4ZleJNda5YEJYLRQ20aP9ThtVLgBfJ3Ayx X-Received: by 2002:a63:6b41:0:b0:3fe:22d6:e6aa with SMTP id g62-20020a636b41000000b003fe22d6e6aamr8023748pgc.249.1656001599572; Thu, 23 Jun 2022 09:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656001599; cv=none; d=google.com; s=arc-20160816; b=YNFRyDBUz1SvtJYp9JWCDt0vfz0KKUGia4NsPN3hNL5Ivd73KdxBvbA+TCtvlBY+Cz XJg2xFN6g/mBUcTJbsL/2Mx3lXYNvSuWzrbSOZg56kgxUrUasukBk3aI/v/JU7hLDCL9 DcJABz/JL2sT3jFJ2Xwg4hq+dEXeMr3SpEtun7QYA7SQ5xQjOJhyj9J3zTZEBJvMSw/L BAwR0xe9ys2SPLtoRATKvlpJM6FYUcMCi2ca9V9riTF50IIp6biObfNOBrVDlOWT/A7m IB+HtfevZYyvQinf35w7eeDEv7tduA5IawwOfpkfkQ3LvzOyV4yzXYjgyizTiQKgvHmD A6kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RB9/m8uHQQCll+yG7QN8tRCGkMzH5JCZ3P5+Y2rpVfU=; b=fkyfoLYN09+0aoceQvESNlGObyzNPLsn7qlLp4VadVRLChE7TSMhtrTfv16doO3fU7 Muo0k+PI+GYHBV0aEm7sHY81PhWwv8XW7MRkNNJrOQtlWli+5le6C7Wl+IViMdEeyB/U V6hLw4BmSDyLfz2ji1Vrte00mLdir7d0kKpae7SWvebIaytpfGGsPvwrtzy0RvO6J99Q SxRRh3N/TJsQ5spWUxyUI35gmuMCv5VO0dhzCS5J7JuoWWwxvWVvhOrvpSqvy0Fj5HdR UOxe452oJqPN2WZet+MVi6k6btHadh6WxlsBA/4ipEJt5ud7vaSpYiCt1V/PfAc/Dark rq9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Ny0nEvwF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kk8-20020a17090b4a0800b001eccf97e562si3738257pjb.4.2022.06.23.09.26.27; Thu, 23 Jun 2022 09:26:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Ny0nEvwF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232122AbiFWQH0 (ORCPT + 99 others); Thu, 23 Jun 2022 12:07:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231656AbiFWQHY (ORCPT ); Thu, 23 Jun 2022 12:07:24 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B143B44A1C for ; Thu, 23 Jun 2022 09:07:21 -0700 (PDT) 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: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?