From patchwork Sat Jun 29 01:33:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13716751 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 D10C5C3064D for ; Sat, 29 Jun 2024 01:33:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B9AF96B0089; Fri, 28 Jun 2024 21:33:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B483B6B008C; Fri, 28 Jun 2024 21:33:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9C2186B0092; Fri, 28 Jun 2024 21:33:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 80A066B0089 for ; Fri, 28 Jun 2024 21:33:46 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 30380C0950 for ; Sat, 29 Jun 2024 01:33:46 +0000 (UTC) X-FDA: 82282204452.09.052CFCB Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) by imf26.hostedemail.com (Postfix) with ESMTP id 68BF614001A for ; Sat, 29 Jun 2024 01:33:44 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="m0m/o8XS"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.44 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719624810; a=rsa-sha256; cv=none; b=fgoQ06wieQG2b1jOCic8au4bq3b45n0D3yUJWYQ70bAhHukaTNCUnDFI/oNP+IiqtmrguA NJ/+UINR0SF9taFrr9TOTHtVWZs737Zm9zUm9BUN3R6m/15aX6c9GMQKPOZN8U/33ll189 kzlfhIZarFPD5RLTi4esOZTwlXOorZ0= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="m0m/o8XS"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.44 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719624810; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:dkim-signature; bh=/cFljxBBWTzFxiiZnk6Pd9Jll5+l7oDT2rf5v2DyvNY=; b=7CTY0HQUB/1FCKVdd/n1Ag7s5ffqMFgTibs+pHhPmEe0CLffi27JGU+ACkoQRLHeI55F5G z3HQGruVdmMjZvVovRyyYU9QBa9InXXI5q0vaiO7BnUYk+S7YMRORD9I7WlD8jcKGd3qoq ffITavbUE5fxdh+urQoNKhs28EibZSc= Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-57d1782679fso1561953a12.0 for ; Fri, 28 Jun 2024 18:33:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719624823; x=1720229623; darn=kvack.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=/cFljxBBWTzFxiiZnk6Pd9Jll5+l7oDT2rf5v2DyvNY=; b=m0m/o8XSQJOBihf4zOuTWtIQxkZRtzXVvrnuJJBiBamPfzTtCTmyTLvOjctciIcZjW Rq5+CBQOrB1SKFRQyVaJcHRcbYcyp9B7vaE6jBiWJz9Zwa/Ilii3CQkv+PYmUjE7v+Bs vYNdv223t/OO+iZ2tNbsKO77TvWW3O7Vw9oNFXDcrEvaE5kaPtAwV4Hqq1rAKAmF1dZM 5KXZxMAUSZKuer53CV70zJGlZBPfAl5backg3ZjOBdWrElG/NyddJ5nWS0JBcmIP7cN0 9UjEEofCkATZVLuunalIrIBB3yPMTXHiAqFrbdQ1MyFENgWxZrtDsW8h/boNnAOsry63 ai8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719624823; x=1720229623; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/cFljxBBWTzFxiiZnk6Pd9Jll5+l7oDT2rf5v2DyvNY=; b=Be4hhvLsQHBN8JeBo5wCOjwD7p9e6DEF7aasO2etascsT52qSM34tWaIzBN+EBBT0Q eOk6tHSO0T5OfJXTr/JUYXO3MOpJOrl8vorgSA6YRakZrK8ZypGhm7IcaF0aWyLarZKY u9WAs4V3QTfDy3V5fiFOQDa6zgsKHLf8dInbdDtlGDQHdVgyrpZ6dPFrwrjpqRbyBh1o svG8P4Oe7rH3CAasj0LvaEf52uT6sTdkiZQ867n4mi9f1Pn/Sm9VTRePkQpfA8FXjC8f dGnolHwtBr1FbEk06M2M3dIpo8g1MTjBQtLjzhCvuCAePM25V7apnZCumb5Cuk6jLqDf rc7A== X-Gm-Message-State: AOJu0YyfdqLjkr29RvXW27XRLtJt8tZeTpjB6tTXxr3PUS23Ieiuhw6I zY5gNYtZDCQxH+ODKWYnIUemczNcVNtbOlxr/0+xyKoAwDbJM/tg X-Google-Smtp-Source: AGHT+IEZG466tNs8HZlvHuBRrH6qMyNDwwCL45R1g6+KYqCMygpUd4xOyKFaZJA1fS0t+mbQdQDpUA== X-Received: by 2002:a17:907:118c:b0:a6f:c167:614e with SMTP id a640c23a62f3a-a7245b64c48mr1203671766b.31.1719624822819; Fri, 28 Jun 2024 18:33:42 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72ab08d143sm122598966b.151.2024.06.28.18.33.42 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 28 Jun 2024 18:33:42 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org, rppt@kernel.org Cc: linux-mm@kvack.org, Wei Yang , Nathan Zimmer , David Hildenbrand Subject: [PATCH 2/4] mm: not __SetPageReserved on initializing hot-plugged memory Date: Sat, 29 Jun 2024 01:33:20 +0000 Message-Id: <20240629013322.12364-2-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20240629013322.12364-1-richard.weiyang@gmail.com> References: <20240629013322.12364-1-richard.weiyang@gmail.com> X-Rspamd-Queue-Id: 68BF614001A X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: y7amtx4x9i7bjnr1934gxxb61wjaf6as X-HE-Tag: 1719624824-994563 X-HE-Meta: U2FsdGVkX18/pyKqYci88pmLRzsag2andOjS318HyBAqSy6RNSRD6zM/Kr1/BPnBoUt1HAkbSbLhO8k2K9KPLyV4eFyZfV0yyX1SRRVz1H41tbQIC36fJrX4ktAl8FIeU6LeThI9mOZvWuB+1lSlcJ3KUE+6Td7KRvVcGLi8dnNMx9/LEJ8nb5gu9XCe3puWRu2ORnkBmcHfV7Tv7nId5chCBoXIR0WHpXaPYJhgyk7J+S0u/5E+nABPOzYYuU+U0d/TYUJJnPH+z+gFAPgtd1NZuMqHNNsET7aA0mSo1JGUb7WqpYW5QF3yd1f8A1xoBDaybGZaAp+mHg+Z2iK6YqRPQn/di9kuz+FZFsczq9OvK2Z48UCn/+3rd2Eeo9vkaz/PX8S4Vi3Qt8SU7LaG16/0ewlTOKxLo/hcrVANrjT3lHC2HdVcknTIzBqGoaAjtoKfYbe6fQoIr2VZdooIZn0kX0W/fGFNo48c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Qokf7WlFth6KMN1WNsCLcAbQy5K6q0SyPY4SI06ZnBIAEo8ryT 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: List-Subscribe: List-Unsubscribe: Initialize all pages reserved is an ancient behavior. Since commit 92923ca3aace ("mm: meminit: only set page reserved in the memblock region"), SetPageReserved is removed from __init_single_page(). Only those reserved pages are marked PG_reserved. But we still set PG_reserved on offline and check it on online. Following two commits removed both of them: * Commit 0ee5f4f31d36 ("mm/page_alloc.c: don't set pages PageReserved() when offlining") removed the set on offline. * Commit 5ecae6359e3a ("mm/memory_hotplug: drop PageReserved() check in online_pages_range()") removed the check on online. This means we set PG_reserved for hot-plugged memory at initialization is not helpful and a little different from bootmem initialization path. Now we can remove it. Memory hot-add and hot-remove have been tested. Signed-off-by: Wei Yang CC: Nathan Zimmer CC: David Hildenbrand CC: Mike Rapoport (IBM) --- mm/mm_init.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mm/mm_init.c b/mm/mm_init.c index 3ec04933f7fd..362ac4334b99 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -839,9 +839,8 @@ static void __init init_unavailable_range(unsigned long spfn, } /* - * Initially all pages are reserved - free ones are freed - * up by memblock_free_all() once the early boot process is - * done. Non-atomic initialization, single-pass. + * Free ones are freed up by memblock_free_all() once the early boot process + * is done. Non-atomic initialization, single-pass. * * All aligned pageblocks are initialized to the specified migratetype * (usually MIGRATE_MOVABLE). Besides setting the migratetype, no related @@ -892,8 +891,6 @@ void __meminit memmap_init_range(unsigned long size, int nid, unsigned long zone page = pfn_to_page(pfn); __init_single_page(page, pfn, zone, nid); - if (context == MEMINIT_HOTPLUG) - __SetPageReserved(page); /* * Usually, we want to mark the pageblock MIGRATE_MOVABLE,