Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2625770rdb; Fri, 22 Sep 2023 04:24:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFnCgivkPYcxEw0Z8FXWclg7ixqepZ6W/jUPJySXQtkgxgVpnUZ8rgAGrHDpVgq+apcyyeU X-Received: by 2002:a05:6358:881e:b0:143:723:8f89 with SMTP id hv30-20020a056358881e00b0014307238f89mr10088716rwb.4.1695381893154; Fri, 22 Sep 2023 04:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695381893; cv=none; d=google.com; s=arc-20160816; b=rX/QT465mP9snxHhPln0y9oSKHaUljSxOaw8/Ivp3PKu89oOl/pJJsEAoowTds+Q+Q BI8En1a3WuntIs9y+pshzsyb74aF21FSrx7tHn7AUUnPdm/hqgdal/W21Em40t26+VAI 0MHTfwXm0aeP6BvWym66pMC04emyoWTpvzsqik7CnxzChUPz6gVMRlxSfo+00zI0b+Ao ZW6S/0IF48Y0um17OY9XXu1D08yodm3KQNKZRjk7Bm1ZT8d8/PcGRYfjT6ay/t/o06MJ WVWXB/C+dnPAUbmbui67hxLBBf/YLEkqb4+Xv+ywiq2vneribJq/5UoLH1i4oz66VK+i T0+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=STMVv9/CmiXKMmwvCbzFA6MyMoHyyxo+IXJElKifvKA=; fh=KSy1dDf6lUvgdoPctzpy47/Mjv6bi14N3nvpkZLQDdc=; b=yet5yAMqRqsbgMry7eT8l2oG1uPv3eetnUrzI4Suq9t7WgS2EZVSj6/rFFPT/BKGEX +NouxcKub6LFWWp3aHYG8In7lA17ZAqaN5jbA7B811MHki2hEP9mqC2YN167MyEHrI7e j6QEWByk0Ltidu8PbsM5lHRCDVYFfhImlc87LrMYSZzJAyTh2zhJPLX1XqzRxYGhV4+V eZog67RhVLMjC+IiaTfrgiUQ4cRfOQ9Duidnwb8ft8MVaEbBlc30kTraCp6ucVXTlc3w HFMjQnah8Gr9f7IQFTWtZH1B8U+cMu0qpQECNO2tkRwxvnTlHrbcMbn/c7t1DGXxoXmY ZgFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=j0GTHFYy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id k5-20020a632405000000b00573fdbc93c0si3706012pgk.892.2023.09.22.04.24.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 04:24:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=j0GTHFYy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 723FD8040D4B; Fri, 22 Sep 2023 00:09:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230332AbjIVHJy (ORCPT + 99 others); Fri, 22 Sep 2023 03:09:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230000AbjIVHJx (ORCPT ); Fri, 22 Sep 2023 03:09:53 -0400 Received: from out-218.mta0.migadu.com (out-218.mta0.migadu.com [91.218.175.218]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10F9618F for ; Fri, 22 Sep 2023 00:09:46 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1695366584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=STMVv9/CmiXKMmwvCbzFA6MyMoHyyxo+IXJElKifvKA=; b=j0GTHFYy9Rk5aQNPly91khvCvLtwROqnl6vRLK2YLT+q+Ckq9y7J8JmUPeMGSeIGl6ob14 RQel5IHpBuyun/wEWjeoBxFMWPpb5arxb/E6E05pBTu3mlyQ0pzqEI0SX+E2uvTNOdnRHG 8GUu92LCbxLU8/Bk8txAzluhMqfxjas= From: Yajun Deng To: akpm@linux-foundation.org, mike.kravetz@oracle.com, muchun.song@linux.dev, glider@google.com, elver@google.com, dvyukov@google.com, rppt@kernel.org, david@redhat.com, osalvador@suse.de Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, Yajun Deng Subject: [PATCH 0/4] mm: Don't set and reset page count in MEMINIT_EARLY Date: Fri, 22 Sep 2023 15:09:19 +0800 Message-Id: <20230922070923.355656-1-yajun.deng@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Fri, 22 Sep 2023 00:09:53 -0700 (PDT) __init_single_page would set page count and __free_pages_core would reset it. A lot of pages don't need to do this when in MEMINIT_EARLY context. It's unnecessary and time-consuming. The first two patches are in preparation for the next two, they didn't change anything. The third patch only set page count for the reserved region, not all of the region. The fourth patch removes the set paget count in deferred_init_pages. Yajun Deng (4): mm: pass set_count and set_reserved to __init_single_page mm: Introduce MEMINIT_LATE context mm: Set page count and mark page reserved in reserve_bootmem_region mm: don't set page count in deferred_init_pages include/linux/mmzone.h | 1 + mm/hugetlb.c | 2 +- mm/internal.h | 10 +++++--- mm/kmsan/init.c | 2 +- mm/memblock.c | 4 +-- mm/memory_hotplug.c | 2 +- mm/mm_init.c | 57 +++++++++++++++++++++++++----------------- mm/page_alloc.c | 22 +++++++++------- 8 files changed, 59 insertions(+), 41 deletions(-) -- 2.25.1