Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2623900rdb; Fri, 22 Sep 2023 04:21:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFgj7R/i6BWR1dKLFVSAQhgorolNdG9bClNFqL8Ujrz2Lb8iikxYEQYeqrSxEobZxwiD6dJ X-Received: by 2002:a05:6a00:21d4:b0:68a:6d34:474b with SMTP id t20-20020a056a0021d400b0068a6d34474bmr4187690pfj.15.1695381660055; Fri, 22 Sep 2023 04:21:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695381660; cv=none; d=google.com; s=arc-20160816; b=nQ1TAC/ml5WkQUe93OHnhbYzMzOt5KCislZPYSkPq49OuWTegMtMmJgE3NF0inHnBO r5f1e9Mn59CpNcpnOlWTGZ8p8l72+LgCkjwmjrJIL9vPeL9xz8HXh//pbQOtCSgYHEDg O71+JbWzAr7NuXHtkgFz55SAwD0uHecm+8VlBs3o1eqAzQD2OSQZ75M6TETDLnK8o8HL pLGbaaqwmpPS1HHKoeYS2jJG4InUAVNmVASAEfjQHfbfIj6ZJ/TZBMbRN0bcoj0VOGqZ AQo15lQDVPSjBEKoepCbNuWdnX8RzFGObITvsb31JfhlQBtUIysq51tckuuMOo3Ojn5d CVQA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0NMcmRX/w2n3M3EQea1/2ZhpgRQyZV6LdD1tfFyUHrY=; fh=KSy1dDf6lUvgdoPctzpy47/Mjv6bi14N3nvpkZLQDdc=; b=wRdLaWqOcb/BFENqMFe4vgz2GJ34v79WUVGSoFiD3u+zQu47VJ6RnqV+vRmnG/c+h7 rfhvAhoTRsXrmCAzjg8j9FLEQ5X61IAPrvcDXlJGk/if8+RRrH3bo91kjVPq7S5hgW9g o0LDUXvzB1mEQOqoc/UWnDKxioSF/xhGw7nH3lIgBWd74c7rfLDQo/yK4VKA4EfD9/ET TZghY/zPglJbQVO38NrFbU+yX53hoDfzLxgCHJRzjWwIic7jYh0ihVW+LSy0LbdwFq8o ZrFCuWTcqcA7123oCCyFgAHwBn2Zgh6yFehAMXFW6YIdY3xbzUQxrs/MJdeP6bUNfQNv tYNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=fPPxKFrT; 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 u23-20020a056a00099700b00687008df88dsi3973985pfg.52.2023.09.22.04.20.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 04:21:00 -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=fPPxKFrT; 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 180518087C8B; Fri, 22 Sep 2023 00:10:57 -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 S230469AbjIVHKj (ORCPT + 99 others); Fri, 22 Sep 2023 03:10:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230253AbjIVHKd (ORCPT ); Fri, 22 Sep 2023 03:10:33 -0400 Received: from out-217.mta0.migadu.com (out-217.mta0.migadu.com [91.218.175.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFDC318F for ; Fri, 22 Sep 2023 00:10:27 -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=1695366626; 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: in-reply-to:in-reply-to:references:references; bh=0NMcmRX/w2n3M3EQea1/2ZhpgRQyZV6LdD1tfFyUHrY=; b=fPPxKFrTLFfvL3jUV7itB9gMnKWR/r7Snjv26hnF+iiC5cBKWt1EOcJiso/9kwp07Pc/E/ xO9LzRFYie1qlDtSrkxynAhhzP/0j+M5qMOLAGoypKYac3zL2PZvrY3sznXwcP3QWg6wwc 6fDf5t+PpwLmQdL+crOn+jgf7v0Hej8= 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 4/4] mm: don't set page count in deferred_init_pages Date: Fri, 22 Sep 2023 15:09:23 +0800 Message-Id: <20230922070923.355656-5-yajun.deng@linux.dev> In-Reply-To: <20230922070923.355656-1-yajun.deng@linux.dev> References: <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:10:57 -0700 (PDT) The operations of page count in deferred_init_pages and deferred_free_range is the opposite operation. It's unnecessary and time-consuming. Don't set page count in deferred_init_pages, as it'll be reset later. The following data was tested on an x86 machine with 190GB of RAM. before: node 0 deferred pages initialised in 78ms after: node 0 deferred pages initialised in 72ms Signed-off-by: Yajun Deng --- mm/mm_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/mm_init.c b/mm/mm_init.c index 1cc310f706a9..fe78f6916c66 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -1984,7 +1984,7 @@ static void __init deferred_free_range(unsigned long pfn, if (nr_pages == MAX_ORDER_NR_PAGES && IS_MAX_ORDER_ALIGNED(pfn)) { for (i = 0; i < nr_pages; i += pageblock_nr_pages) set_pageblock_migratetype(page + i, MIGRATE_MOVABLE); - __free_pages_core(page, MAX_ORDER, MEMINIT_LATE); + __free_pages_core(page, MAX_ORDER, MEMINIT_EARLY); return; } @@ -1994,7 +1994,7 @@ static void __init deferred_free_range(unsigned long pfn, for (i = 0; i < nr_pages; i++, page++, pfn++) { if (pageblock_aligned(pfn)) set_pageblock_migratetype(page, MIGRATE_MOVABLE); - __free_pages_core(page, 0, MEMINIT_LATE); + __free_pages_core(page, 0, MEMINIT_EARLY); } } @@ -2068,7 +2068,7 @@ static unsigned long __init deferred_init_pages(struct zone *zone, } else { page++; } - __init_single_page(page, pfn, zid, nid, true, false); + __init_single_page(page, pfn, zid, nid, false, false); nr_pages++; } return (nr_pages); -- 2.25.1