From patchwork Fri Sep 22 07:09:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yajun Deng X-Patchwork-Id: 13395074 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD091E7D0D6 for ; Fri, 22 Sep 2023 07:09:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 482376B0285; Fri, 22 Sep 2023 03:09:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 431CB6B0289; Fri, 22 Sep 2023 03:09:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3214F6B028A; Fri, 22 Sep 2023 03:09:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 255FE6B0285 for ; Fri, 22 Sep 2023 03:09:49 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id F050314096D for ; Fri, 22 Sep 2023 07:09:48 +0000 (UTC) X-FDA: 81263358456.24.D74437F Received: from out-219.mta0.migadu.com (out-219.mta0.migadu.com [91.218.175.219]) by imf12.hostedemail.com (Postfix) with ESMTP id 3B3E940003 for ; Fri, 22 Sep 2023 07:09:46 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=j0GTHFYy; spf=pass (imf12.hostedemail.com: domain of yajun.deng@linux.dev designates 91.218.175.219 as permitted sender) smtp.mailfrom=yajun.deng@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695366587; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=STMVv9/CmiXKMmwvCbzFA6MyMoHyyxo+IXJElKifvKA=; b=rmhVQYv67bacjAgO4jLj0Ux8qBjXuDrhB8cpX6Bhra6IEO+ijtzhQpQWQqtzT83S/7BoF/ BQwr4HYNbIpjWJdgqgAVOmBYhde/I153wyr6+5l9YntAYLdiHqogJjLSmou9lGD+zgEk82 0GnTTKbiFICyHueKbnhjgA9usxTkwTY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695366587; a=rsa-sha256; cv=none; b=5597XmAo68D7w4KZ2kw1bcniUUWSzFOnt6vIPjxKEdN91Iv/5ja0HSPdp8O5NqTHLSuorj eNmpIoABM06of1Dk6Qxymu4BiACIYECe6mdU0719Y6GnmEnpZewJwpKb4zX00fmpzCEQHA mBY6YioGYfOgNQyspJ6/k0IWd+GpqZ4= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=j0GTHFYy; spf=pass (imf12.hostedemail.com: domain of yajun.deng@linux.dev designates 91.218.175.219 as permitted sender) smtp.mailfrom=yajun.deng@linux.dev; dmarc=pass (policy=none) header.from=linux.dev 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 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 3B3E940003 X-Rspam-User: X-Stat-Signature: ch3i4m5dugwbj7anpe3qcp5wrme66hxn X-Rspamd-Server: rspam03 X-HE-Tag: 1695366586-116746 X-HE-Meta: U2FsdGVkX18OpIFAxLRdS29Kihs945IQbsDUGYOvWmPnfLMDc0htqMvuDuGBfNv9BnHsAr7gKxfVWpJOXQqu6h2fwNf9vUITbeKQh+zvueesXhNdEzE1CXt3dVeJIgXWfGewpimbIe9hMVvNzp1qYIFbwZihCoNyE2easQXgFsrdfrG0F76anFJ2AON/gKztSASpLXJ1Me3Msf02ysumca4zJP8sEu6ll4J8ULuNK4t3cdY3orsGq7cYg9a3oGM0y0lqX0F1Vm3pOYDFcsZNC/3ZZL7zSOklANmfTjpsDFBfWPIhzAfY6ZeS17mG5LJ3hqMK05Swd1Z5uKCFxT4qOgxlbwnRQVAP7fxPRYjm1v01Th5H/AolAbUpcek4OqWw0nMle1Sl8pmTO/UhY3mW3mRD86xbaBkwPO+fR+w7hA2OFrX7knuuukdig4NpU5bGQGZJLoZDw/Y5NzrtPYnF2PUynTX5JPBKEVQSiWgFS6SOt9aITQpVfAMAhgB9IHQTEwMCD+04OtF+OU9nQ1G7V9JO2YYHYu9PUl145qV8e7U7GIvRZfkHHPd+VwQJ4aO6ed2e4cz/U4XKBBVn7zLBLUvXwmGLU/9udfXDofQxMeLAuyh9ULUd6X/df+8PVXDfHNacjmQyr7LGSyILUWICUyk5gUcqQwqnHPVzlYXhTy3OA3LCskDI0FXsG6xfkMB9KV/emcr7ljKqEZW1jkliGG9mE4GsOPAFQjoFy0ux3epX39nns5P6pxqtTXHTgzNAGjsch4dNMmcm21i9aUjTwsgqATwUzplb7fNh8uxZQHTNlBiar/jgzmYqFtVQysBV/tVITGzAYzgEfbj3RSOtbY0BqmWSvyc752YV2a4luu+ZMh3tjtXF/srWVVEm6u/WzkBCf+p1XIAd3OjnXgbXCZHB8oLZvKX4USXTfM5vGMY9WVM0D9A/rrDZdMvGcExfnYngR0AB2rfk7lamb2Z IIGkR8qL Y3L/22V37DvsYB7uwwpeY7OXU5oo4WGh5pvn3pOXAT7K1ckurOZ/4FVc3qO4lT0pl7JeJjsKRv5okGXwFC8y8XCDlebem5yqrqlQ7lFaglrI5Fnx/o59WoFHYC7i9VpHjPzZC X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: __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(-)