Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4152390rdb; Thu, 14 Sep 2023 13:28:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGnECzDuA0NcdyEa6T7QUEAWuwSLc2SsOm+HNP5ELtLvF6NCQJFtKgh65TyplYI3GC/dV57 X-Received: by 2002:a17:90a:9485:b0:274:6cc9:ec69 with SMTP id s5-20020a17090a948500b002746cc9ec69mr2353357pjo.49.1694723283322; Thu, 14 Sep 2023 13:28:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694723283; cv=none; d=google.com; s=arc-20160816; b=yXCSXNs+D2QzQV6hEfx/gzt9o2GtZnT8QBO0A6vqtOvgrAU8COSiNUfTBvlSHUoEbC AVfma+e9kDP+idoEowPunNRRSP398o83+6imeFH0MIjRgJ3wk3QhH2JVz8vPRicUgH4C lqLodP0HttI8AGthi2mHJN1OsGO5CC3yX8Gc2GGc07U/TX4TYsgSfH2Uv6bgPiY+/v6K ojdEhwtNPhpSCGavMaw3LxlSe9ybsvZYA6AegsFKBffXfUdfjRp1yDixDQLufPdrfYU0 3N12YSGP0UcL0nMHgpWUMZLIl3U48V3COGMpOC7DnI69r7Ion/eBvFhapNu1CXv88rhO ho2A== 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=vjEMrjw2C/jTAB+E0NqGEn/Bqv/9rRmcZIO86x/4wRQ=; fh=djSNIu4ZoCAj1RfstsNO7Lh0TFHErRB+z4pGntXdKK4=; b=QEkNUqUwgBpOvcXVpvWSHDQXSLOWgcm+yNDusmfIL5zuWQPfZj+nBOocArh3b1ViAe teN161Byj+xNpGWu97kOhUizwHrXx3SIsx/jznMs50frdkiSWwzTVqmTdoEZbgnIVkfN 0SXpMUUsnfnWO8qLalveSF2/oZezSgBE5s9LSC0Rs9iWOe2YTy1OgdqDhd8qJy9DTFjb MvY1dFTpU4o3/QErT6ZFRUwzMwhUvsmIvjhrUHyr6J2DmcbKZlp4SA2xnckE/QpTucPL nZKOp+ZBCelH37FQcmIOMHhuDG0svFt6s7iB7mjXdxO4l5sH3dh24mib50AwHPjhASf7 AkQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=B0sCLfaz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id lr13-20020a17090b4b8d00b00263c7cadb73si2347350pjb.152.2023.09.14.13.28.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 13:28:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=B0sCLfaz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 2E304829A57B; Thu, 14 Sep 2023 05:48:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237706AbjINMsq (ORCPT + 99 others); Thu, 14 Sep 2023 08:48:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237188AbjINMsq (ORCPT ); Thu, 14 Sep 2023 08:48:46 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8E561FD7; Thu, 14 Sep 2023 05:48:41 -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=vjEMrjw2C/jTAB+E0NqGEn/Bqv/9rRmcZIO86x/4wRQ=; b=B0sCLfazPBAGsbEZeWcayfQbh5 uT0mKgzbqGikyzNOd3EyNLVgaNP6VulcWnXiG0IpVV8KYAauTyMc1A1MbG2depWPYn9cka8FXGrI7 T+ZyjN1s0WHkKas/U48Gzlm2+qBVklO5o3Kl6TUDiHfi1YVCDLHs4WzUOmxecQc2+d56onboyan1J eGCUD0ziAW3lpO2vEHS8BZ2lkwOVwN2YLWT5hVhohCdsloTDVFsDAQlA5mZ3GEJcqJIq2xPg8sepN tPbZX0eKcfLx3DElFYlUWqUNTb6YNkEf0e2XBHvKKoTMG1h8wo29JhMGsWwjOghsu/CR0+QCi4KXB XLUXP8+w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qgllH-002y7n-2c; Thu, 14 Sep 2023 12:47:59 +0000 Date: Thu, 14 Sep 2023 13:47:59 +0100 From: Matthew Wilcox To: Mike Rapoport Cc: Sourav Panda , corbet@lwn.net, gregkh@linuxfoundation.org, rafael@kernel.org, akpm@linux-foundation.org, mike.kravetz@oracle.com, muchun.song@linux.dev, david@redhat.com, rdunlap@infradead.org, chenlinxuan@uniontech.com, yang.yang29@zte.com.cn, tomas.mudrunka@gmail.com, bhelgaas@google.com, ivan@cloudflare.com, pasha.tatashin@soleen.com, yosryahmed@google.com, hannes@cmpxchg.org, shakeelb@google.com, kirill.shutemov@linux.intel.com, wangkefeng.wang@huawei.com, adobriyan@gmail.com, vbabka@suse.cz, Liam.Howlett@oracle.com, surenb@google.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v1 1/1] mm: report per-page metadata information Message-ID: References: <20230913173000.4016218-1-souravpanda@google.com> <20230913173000.4016218-2-souravpanda@google.com> <20230913205125.GA3303@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230913205125.GA3303@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 14 Sep 2023 05:48:47 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email On Wed, Sep 13, 2023 at 11:51:25PM +0300, Mike Rapoport wrote: > > @@ -387,8 +390,12 @@ static int alloc_vmemmap_page_list(unsigned long start, unsigned long end, > > > > while (nr_pages--) { > > page = alloc_pages_node(nid, gfp_mask, 0); > > - if (!page) > > + if (!page) { > > goto out; > > + } else { > > + __mod_node_page_state(NODE_DATA(page_to_nid(page)), > > + NR_PAGE_METADATA, 1); > > We can update this once for nr_pages outside the loop, cannot we? Except that nr_pages is being used as the loop counter. Probably best to turn this into a normal (i = 0; i < nr_pages; i++) loop, and then we can do as you say. But this isn't a particularly interesting high-performance loop.