From patchwork Mon Sep 25 07:21:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yajun Deng X-Patchwork-Id: 14463 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1033965vqu; Mon, 25 Sep 2023 00:28:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsn3lSR13cd0ZQBhms/71zLYT1XsSZ8mR2zW2MABZC41Op4QeZLFKZmDZbu8+7EkXoTGs7 X-Received: by 2002:a05:6358:4404:b0:135:4003:7851 with SMTP id z4-20020a056358440400b0013540037851mr7094536rwc.19.1695626898283; Mon, 25 Sep 2023 00:28:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695626898; cv=none; d=google.com; s=arc-20160816; b=YUqbrTs7HE0B7mp0dEgr53JiZ27jfVFQUye8VgapVyeFv1RDgdaoF+YMDECREb+/ty eRWHo9X/MPf404kQl+gIqvq24/k9RTo/h67kUtBRtrlxKYCHv94V6FJ3a3cb35WiE/49 CcSEjJvTL/y5/T5zzkDH919FNioQQyiRp+1LIs58PnbniPAXSRwYDuiIgMb2R+7SSILR vhGzcmSmkPmxyGsED8yLW9BT0RHD2miBrGORYiRq1INuGfarJKlQA3uyrsIampLeQ1Ng 5OjXNGuH2HTaiGw1mCdCSz1RHfrJiesu2ngpuT4dmgBXQ0ll+ZmSXqOaHwlWW6xYaU/V C7mw== 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=xYGJKvwyxelEGCoj1HuYpU6D4jZuMAySPDKkIDk1zzk=; fh=KOqnwf3wLq339F86BgBAUBm2BDBdSDR9Q3xMFmvILoY=; b=hiyFhiaQhm798t4iJIIYjp8j3a3DZ2cBv8q4T6I2PtNBR+zApScXEsZ8Q+uTis814L ThIjR0wp178NSNFx3bR7q5nIVKcdcDRB7kUdwDa28AVwrLW11nKsp9tdkJ71uM6GMdRd Aij9gfaMH4Nre7SRz9Z1IRY3s9w8gNo7fORWhGg7oAbD0oPV/r0xrnDoBjc4C0t/W+7U l7keh1C5IotzCB8Np33IF9yHRvqVSH6g9jpY+zYUa4DHr51ppzylxci/o+E2Mh3LGmCS TyYcceqyn2CHmnESX2pDerB1P3bgviaePBQYGEWcJVmS1vPXd+CZQg5pA0+3pc93wJEE WSqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Pe4cl4at; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id w186-20020a6382c3000000b00578ac490e7bsi9614632pgd.638.2023.09.25.00.28.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 00:28:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Pe4cl4at; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 8B85880A9985; Mon, 25 Sep 2023 00:22:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229720AbjIYHW2 (ORCPT + 30 others); Mon, 25 Sep 2023 03:22:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229832AbjIYHW0 (ORCPT ); Mon, 25 Sep 2023 03:22:26 -0400 Received: from out-194.mta1.migadu.com (out-194.mta1.migadu.com [95.215.58.194]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DCA3192 for ; Mon, 25 Sep 2023 00:22:15 -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=1695626531; 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=xYGJKvwyxelEGCoj1HuYpU6D4jZuMAySPDKkIDk1zzk=; b=Pe4cl4atEQiQ9Qr4Vs1ri25Wr5RLSc9i6noi+ib0BrhZ7cOI85cev+Qf4qrzLCjkiKzPBL y4WTkVs10+cFYeFIqHLzyYHbPUwe15k9gpQDNtBDV1ZvLKCZSuaMUGdduP8V28kzzgcKy2 h3yaS7/Q/mbue5RK+JzfXzrGZXHrjcs= From: Yajun Deng To: akpm@linux-foundation.org, rppt@kernel.org Cc: mike.kravetz@oracle.com, muchun.song@linux.dev, willy@infradead.org, david@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yajun Deng Subject: [PATCH v2 0/2] mm: Don't set and reset page count in MEMINIT_EARLY Date: Mon, 25 Sep 2023 15:21:48 +0800 Message-Id: <20230925072150.386880-1-yajun.deng@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT 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 pete.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 (pete.vger.email [0.0.0.0]); Mon, 25 Sep 2023 00:22:34 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777993670599830379 X-GMAIL-MSGID: 1777993670599830379 __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 1st patch is pass page count and reserved to __init_single_page. It's in preparation for the 2nd patch, it didn't change anything. The 2nd patch only set page count for the reserved region, not all of the region. Yajun Deng (2): mm: pass page count and reserved to __init_single_page mm: Init page count in reserve_bootmem_region when MEMINIT_EARLY mm/hugetlb.c | 2 +- mm/internal.h | 8 +++++++- mm/mm_init.c | 45 ++++++++++++++++++++++++++++----------------- mm/page_alloc.c | 20 ++++++++++++-------- 4 files changed, 48 insertions(+), 27 deletions(-)