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 E1015C25B74 for ; Thu, 30 May 2024 10:08:01 +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:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cc69qQN6vw0rMl/57xKFLTyT4/1envOI05BtBLFDAzc=; b=naStIAQTqHp8Uo 9yfmyBNMBHzkvj4JBAjanxVUDLCd/+KVJHbRONro5EgNnVQMuPzLRnlmi48TZT5uQrL0qmyV8fpHp mHiFNl4JpohCMqzYZEobyyAR4On22hIQg2cb/rNWAtE2LU0eHRNDOrLVmUBw8N1BKaF1pN8kP21lk 6qR5bHPw/63ZFdgPduX4nUaZA1s8zXwBWOd3vDIlEj02sEUcpkM1QtC6JKuV1OxJq9fpWBOkTdZuX g0XPO73jLmeMpLcrCth5JjAVXdaMMj2S1XtwFR9BP2wN2e3oH3CeRg7TNVNuiQC9y98lQKrzTsjwP +n6xQtSisaVovOAh+Dtw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCchF-00000006w2J-2B5c; Thu, 30 May 2024 10:07:45 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCchC-00000006w1r-3CqL for linux-arm-kernel@lists.infradead.org; Thu, 30 May 2024 10:07:44 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-52b7ca4ad02so703883e87.1 for ; Thu, 30 May 2024 03:07:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1717063660; x=1717668460; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=RLZUg4xxjbbci4WFVYlF6LST9L5GfNmEJ+vCvpQ6BCY=; b=fiBLHYejQIjMwNT123yWiiJbgFAjXEYBvoGpAA2gjRUmY1YfXcuGtVxzoPHGDEMeUs RKCrQxzJV/ZXsVHjJZvTVTTfoHXyoBMWdzE0cgovZ2G51HJ+9Ngiyw9HFxou5CBWEHXR eT9MbQ0hacodVHnXSnVeffhRWvxR+CtnvVg1l/met0BUoIJi/NUtbqBNt1Gr3sZE1vCj QpOVWVPsiLNhekWyWs5BQWhz43Yow6JljXvXkFyAxKtWaK1+QVW943Rb9W+sCDJFKvDG fTDhQhOSmL9QiCGOQdsEgwH0zduHwfB148KnTW3b1Y3G5ymXlSJVA05pKGUAUkQW0QUL hcWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717063660; x=1717668460; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=RLZUg4xxjbbci4WFVYlF6LST9L5GfNmEJ+vCvpQ6BCY=; b=ZEwGlLDZUJmkeB0TabHXoQd17Qkb+ZT3JyhTtvCROIMfeugtppxwLa69xu++O9RUFG Om2w5fko4io6kRuxom+aPy/og5xXnHhToQiDrKIiwS3yGGY+U0M8ViQUIRhk2xqWSU+o frLZLQUu7yVrRMQzRtc24fVCVFmQJVDX5dODA6xM7s6UPef3QuNZEqva5ejiOVt7JM6l j8ZiL5fnCrGJoLID4yEG2Q5igr66iS3h9ELCJyrFV+T/w9VE5tmtalmRFXPNch7JJOob L3Y+MSoez/QPPL4f8stlZR7eFWMGBAFzJt/jHQjJabPRw0kUSSs5aLe+iqZgdq1TnvoA P8fA== X-Forwarded-Encrypted: i=1; AJvYcCWrdR0vfmIpl61TvR5fj7waSDdd/f0ioYjRH0GjOf/Ybu1Df07DOGAzl4c48E7Y1pIWEY1TG0qmClp4W7/rrob251VB0zkJgD11pG5YKdLuDpcv6pI= X-Gm-Message-State: AOJu0Yzyg5oB/4buDfbv/NR54fV4JWvRMgK8N7x9SV7NuwILlrQVTYuG Cwu7X3+IABIIpq2GdzeW+iVR+MQaP+izf61fa8VyQOFrWEE39X7YFOwZ1IL+SlY= X-Google-Smtp-Source: AGHT+IHuZom72MS+DlLBVAVZr+NsBhcRlIEYTeYYYXrroztEc7NL8xilH1SLOPXekWX38QZ4U5NJwg== X-Received: by 2002:a19:6902:0:b0:516:cc2d:f6a1 with SMTP id 2adb3069b0e04-52b7d479c72mr1116532e87.51.1717063659996; Thu, 30 May 2024 03:07:39 -0700 (PDT) Received: from localhost.localdomain (62.83.84.125.dyn.user.ono.com. [62.83.84.125]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42127065b52sm20447875e9.13.2024.05.30.03.07.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 03:07:39 -0700 (PDT) From: Oscar Salvador X-Google-Original-From: Oscar Salvador Date: Thu, 30 May 2024 12:07:37 +0200 To: Jonathan Cameron Cc: Dan Williams , linux-cxl@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sudeep Holla , Andrew Morton , David Hildenbrand , Will Deacon , Jia He , Mike Rapoport , linuxarm@huawei.com, catalin.marinas@arm.com, Anshuman.Khandual@arm.com, Yuquan Wang , 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> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240529171236.32002-9-Jonathan.Cameron@huawei.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240530_030742_836926_7AF159E4 X-CRM114-Status: GOOD ( 15.86 ) 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 Wed, May 29, 2024 at 06:12:36PM +0100, 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. It is balancing previously allocated memory which was allocated via memblock_phys_alloc{_range,try_nid}. memblock_phys_alloc_try_nid() is who does the heavy-lifting, and also calls kmemleak_alloc_phys() to make kmemleak aware of that memory. A quick idea that came to me is: I think that it should be possible 1) create a new memory_block flag (check 'enum memblock_flags') and 2) flag the range you want with this range (check memblock_setclr_flag()) with a function like memblock_reserved_mark_{yourflag}. Then, in memblock_phys_free() (or down the path) we could check for that flag, and refuse to proceed if it is set. Would that work? I am not sure, but you might need to -- Oscar Salvador SUSE Labs _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel