From patchwork Wed Jun 5 08:20:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13686370 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 117D9C25B76 for ; Wed, 5 Jun 2024 08:21:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 472A36B0089; Wed, 5 Jun 2024 04:21:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4227B6B008A; Wed, 5 Jun 2024 04:21:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 310856B008C; Wed, 5 Jun 2024 04:21:06 -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 130976B0089 for ; Wed, 5 Jun 2024 04:21:06 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B0D66160A65 for ; Wed, 5 Jun 2024 08:21:05 +0000 (UTC) X-FDA: 82196139690.16.428458C Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf14.hostedemail.com (Postfix) with ESMTP id B987A100014 for ; Wed, 5 Jun 2024 08:21:03 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qyBOBK7c; spf=pass (imf14.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717575664; 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=i/eues1WW/yiMwAykbiFbn1SdnXDqqHFFvI2YHTBdhk=; b=sNiFUxAiK6+op7wfPu0zhzH1pEC6rmDLZFFyeXGxcZ1r+VE5ChYz9PuPcx0OpOHMbL9FDF ql2j8s1mK5DZSkqo+NEw9WweNbBimt5tXNjmxgOzQBW0lHVFs+1CEh6xuF9Yau3ad+hP74 nbhkRwnt1qHmu6ewts5BOeqy2qQ9h4E= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qyBOBK7c; spf=pass (imf14.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717575664; a=rsa-sha256; cv=none; b=fsKSuilhXhP9g8sQNrKiLSdKkRDP4roL9+8PF+mjP8TszI2e3CCnaPRbfxwMMw2tPaGNW/ 1wZEpivg4n20D/DdMWxYqAH1XwuwZDnOMRvqHxMVRHIj5wG57gIj9u4u7v+Gj6GpPvbgOT NfcfdweswVGk62pZgc/keXKA2Lv+rd8= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 4B5A1CE0E0D; Wed, 5 Jun 2024 08:21:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47CCCC3277B; Wed, 5 Jun 2024 08:20:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717575659; bh=EvHXfhJQo+1JIqkLSowLXdMVi7K/zBiTFwHkny2F8S0=; h=From:To:Cc:Subject:Date:From; b=qyBOBK7cnJQladW5TQw2rznQKowkIacm0mTY+DLi/jT2RLbrOFvImnRVB661krn81 BFfOoVmz/QCe1WWDVFZjO9dwIkzShfDFsEdEO57/N8GFKEC9C96ejBpMx7fd563YXp z4StBme/imqe4LbfZu+N7L26DuD5PdhzERA2wJxJZ9VoljFnpBTex9iA4oESwMjYlv bhZtLoECi7uCqu8TMZ9VDbFgnt5nEKyZIoa1sg7/I5AwuFa9Gm2dHWwmaAVpzwBZWr QwKj+US/JqXqNGOcuLJOUB8a3SJIR9u4z/PvwHbxo2szvwiU3XajoUiHcV1dcnwZfz b0ipyN9GKjsoQ== From: Mike Rapoport To: linux-mm@kvack.org Cc: Andrew Morton , David Hildenbrand , Jonathan Cameron , Mike Rapoport , Oscar Salvador , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.org Subject: [PATCH] mm/memory_hotplug: Drop memblock_phys_free() call in try_remove_memory() Date: Wed, 5 Jun 2024 11:20:49 +0300 Message-ID: <20240605082049.973242-1-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: B987A100014 X-Stat-Signature: w5hn84dbxr546cnkqyzgyb51qoo8xrnb X-Rspam-User: X-HE-Tag: 1717575663-982648 X-HE-Meta: U2FsdGVkX1+QJ8TnA/3ODpoKQ10EI0kUX3yVtil7gQp9YVStKMmqWSWukKI+jP2FVSHbsjvS8PmtsJ0mxYN6+DuMJvly8c5r/8UQGqiLwZotLApX6MLrGTgVZ5PWqFejzZlUPldEUI8L2mH6X7XhhlLNlAg3Gg24/sliMPhQfaoCglJZX+TedqtupSqPx8DWhOXspF3v70xQnXJUUvRL80ZsjaAPw9g86/QiDeJzxWcUPqDVNhJJ1o/L/KFkYfhv3q9AVEXhnes4c0f18QIcuUeGqxO9v97dL+l5Kc6pB30IORWIGcywJx1rTg0a9FqPQEFE7OKU+SaJhdbca06oVym+ci3CzRpN7kEdQHmDTjfhE/SvwytsLIlSZ85rBNv7CL52/yGjkxHWs6ywbZAfMz0u9zJpRO1CIRvjvU4uqQMf3WpEdCwlhu/MsJ9eX56AO28xEGfWevYmWc1hZvD6TilnZdm33reicC8IJzCIUfFI2YaSu4fmtLwvdAvhlU+9be/dwkTK4KRIj4CLhmvmCnW0Lg4O6cofpF/VtfCYqxCF0F6sDiBimpRA7d1p2bvyWUuGjm5oW6lEe7dpBz9lGAkenCxI+Gsoc9jE/7552GWZtcnqBOEnbN/rrTl0exrK2UJecbr24NuqvzaQcFPPbomgaq5abKxV51H9NS5m2YnAPOGnyXkITSu2PWaoaM6eMg2MWWPPxyzjOH8RepwmMumVLHaCivp2qW9q27gPOVTvCYo9XejPPyXOEqz424tzvcS8vWVeu2MGHTVcHTMIGxLQ8hkOPHn/MaLF7ZuImEoxHkIiFq9VbxEeEPsWt02/5u86Zq86tmebzLLQHMCK381Pl0alfTzhYxNDyrL9+uedqUYEjGAazHaocwYOr0RSozekYjI8fSE4Zg7ZhHjKFX5FF1/R81ZSePtGDG88esUuJiMEep1im4Hmor86CS7wrSIMwZzpJ1cH42FEEsA z2O4PqRf ytqNnpjPupM8vpEDEY/vd2g7nkGho6E8MdjwN3O/zH3UK6GvNmSHYxtQFbKN0FvVsgEePmz8+BvrMIAs+yGB5mqn8fzPm57f/1eezsctG3ctCKKavy/Do02jr1c8ju2/Nc4wBeiQzwCGq1plun6QK9QUpL/bIpol2gLV7XuAPLmTDNnfVnV3Y6Dp7bTQMwG3C0RD+ZwJFtjymxn9ST9hmvzhnriTEI3ySdwxb2oYn2cmCVsc2n0K1+JEkXl3kbka9xkum/zGr3OmAWyrKvrwvfkMZxLaHilSK1TDZt/8mgMjZLHpuOaNDsCvw3A== 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: From: Jonathan Cameron The call for memblock_phys_free() in try_remove_memory() does not balance any call to memblock_alloc() (or memblock_reserve() for that matter). There are no memblock_reserve() calls in mm/memory_hotplug.c, no memblock allocations possible after mm_core_init(), and even if memblock_add_node() called from add_memory_resource() would need to allocate memory, that memory would ba allocated from slab. The patch f9126ab9241f ("memory-hotplug: fix wrong edge when hot add a new node") that introduced that call to memblock_free() does not provide adequate description why that was required and tinkering with memblock in the context of memory hotplug on x86 seems bogus because x86 never kept memblock after boot anyway. Drop memblock_phys_free() call in try_remove_memory(). Signed-off-by: Jonathan Cameron [rppt: rewrite the commit message] Signed-off-by: Mike Rapoport (IBM) Acked-by: Oscar Salvador Acked-by: Oscar Salvador --- mm/memory_hotplug.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 431b1f6753c0..e0d49f128e0d 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -2283,10 +2283,8 @@ static int __ref try_remove_memory(u64 start, u64 size) remove_memory_blocks_and_altmaps(start, size); } - if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK)) { - memblock_phys_free(start, size); + if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK)) memblock_remove(start, size); - } release_mem_region_adjustable(start, size);