From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9569BC25B7E for ; Tue, 4 Jun 2024 09:38:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EbijWnJzTSHPxLw44kJJEg3P+S/x08fEw6if3DtO8gg=; b=KRA/hyf4n3TZ8m d5dZSMItTpdLQXjPipRD2QrbJVhnggkDtE48czBT3sp0EQupKp7TYmOtFi4kiSxf7DV9gQJNP/Xiu CiyxeyR5zq+BX1oU4wfPWjAzlPXSeVQRhHVT649R1Hi+CX036GzShIPTqf0NjS+zvARZP7FIY/z68 L2FhsgzKNXar85eIU0enxN6gvDZ+m+NGCEr/zMFyGFEiXHOtUrkXPTn1PPPjSzHUGHIpjkpGQqvhO jSQTkQw+sqg1HGpQ1rQdFDDCCAZ1PVsICDkg4+Le57PRIxqYeDws70QHzFdBwU86SDMnt5dQjooez 2L4tPA6esPyM56euiACg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sEQc6-00000001sdp-2IU7; Tue, 04 Jun 2024 09:37:54 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sEQc1-00000001sbW-1GlX for linux-arm-kernel@lists.infradead.org; Tue, 04 Jun 2024 09:37:51 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 96100CE10B4; Tue, 4 Jun 2024 09:37:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3CFFC2BBFC; Tue, 4 Jun 2024 09:37:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717493864; bh=GZWZkDa/GqVCvLUAbA3883f1mOynjynYFD8Gb/uzg9c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=T1yHPr2/NgB8WY5+bqkwHW+C5jm6kUuG089/KVTvx3aLRP491lusQCWZVhCp6vMEJ rpINvL2Rliqb0jux5m9juz1jpCBdSMjxDxCxSp+kAszP692ozbY04Rko2TtCcwwBtI mtOGIE9cCcpT1bpQrHDIeZnP1DTQKLgPfqRmmp193B0PExaloCokhP1mBiB3ViHI0U eL3PcwOsib/JrcAVTi1IltlIoq1xBn3F1zo/dilv5+popN83USz4V63xvwpQolVWEu 3g65wJRHwTN9oitHGJYJ1TECqn3GEG98sRTbrTV7vePvFuA/bjRqN+qHQfUwsloiDg ft1BTdH6gcfUg== Date: Tue, 4 Jun 2024 12:35:50 +0300 From: Mike Rapoport To: David Hildenbrand Cc: Jonathan Cameron , Dan Williams , linux-cxl@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sudeep Holla , Andrew Morton , Will Deacon , Jia He , Mike Rapoport , linuxarm@huawei.com, catalin.marinas@arm.com, Anshuman.Khandual@arm.com, Yuquan Wang , Oscar Salvador , Lorenzo Pieralisi , James Morse Subject: Re: [RFC PATCH 8/8] HACK: mm: memory_hotplug: Drop memblock_phys_free() call in try_remove_memory() Message-ID: References: <20240529171236.32002-1-Jonathan.Cameron@huawei.com> <20240529171236.32002-9-Jonathan.Cameron@huawei.com> <92ea53c6-a93b-4ab8-8aec-7f88300576eb@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_023749_750808_8584EEDC X-CRM114-Status: GOOD ( 41.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jun 03, 2024 at 10:53:03PM +0200, David Hildenbrand wrote: > On 03.06.24 12:43, Mike Rapoport wrote: > > On Mon, Jun 03, 2024 at 11:14:00AM +0200, David Hildenbrand wrote: > > > On 03.06.24 09:57, Mike Rapoport wrote: > > > > On Fri, May 31, 2024 at 09:49:32AM +0200, David Hildenbrand wrote: > > > > > On 29.05.24 19:12, Jonathan Cameron wrote: > > > > > > I'm not sure what this is balancing, but it if is necessary then the reserved > > > > > > memblock approach can't be used to stash NUMA node assignments as after the > > > > > > first add / remove cycle the entry is dropped so not available if memory is > > > > > > re-added at the same HPA. > > > > > > > > > > > > This patch is here to hopefully spur comments on what this is there for! > > > > > > > > > > > > Signed-off-by: Jonathan Cameron > > > > > > --- > > > > > > mm/memory_hotplug.c | 2 +- > > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > > > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > > > > > > index 431b1f6753c0..3d8dd4749dfc 100644 > > > > > > --- a/mm/memory_hotplug.c > > > > > > +++ b/mm/memory_hotplug.c > > > > > > @@ -2284,7 +2284,7 @@ static int __ref try_remove_memory(u64 start, u64 size) > > > > > > } > > > > > > if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK)) { > > > > > > - memblock_phys_free(start, size); > > > > > > + // memblock_phys_free(start, size); > > > > > > memblock_remove(start, size); > > > > > > } > > > > > > > > > > memblock_phys_free() works on memblock.reserved, memblock_remove() works on > > > > > memblock.memory. > > > > > > > > > > If you take a look at the doc at the top of memblock.c: > > > > > > > > > > memblock.memory: physical memory available to the system > > > > > memblock.reserved: regions that were allocated [during boot] > > > > > > > > > > > > > > > memblock.memory is supposed to be a superset of memblock.reserved. Your > > > > > > > > No it's not. > > > > memblock.reserved is more of "if there is memory, don't touch it". > > > > > > Then we should certainly clarify that in the comments! :P > > > > You are welcome to send a patch :-P > > I'll try once I understood what changed ever since you documented that in > 2018 -- or if we missed that detail back then already. > > > But for the memory hotunplug case, that's most likely why that code was > > > added. And it only deals with ordinary system RAM, not weird reservations > > > you describe below. > > > > The commit that added memblock_free() at the first place (f9126ab9241f > > ("memory-hotplug: fix wrong edge when hot add a new node")) does not really > > describe why that was required :( > > > > But at a quick glance it looks completely spurious. > > There are more details [1] but I also did not figure out why the > memblock_free() was really required to resolve that issue. > > [1] https://marc.info/?l=linux-kernel&m=142961156129456&w=2 The tinkering with memblock there and in f9126ab9241f seem bogus in the context of memory hotplug on x86. I believe that dropping that memblock_phys_free() is right thing to do regardless of this series. There's no corresponding memblock_alloc() and it was added as part of a fix for hotunplug on x86 that anyway had memblock discarded at that point. > -- > Cheers, > > David / dhildenb > -- Sincerely yours, Mike. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel