From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3268D337B8C for ; Tue, 6 Jan 2026 16:54:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767718449; cv=none; b=FfwyCmovHuqEmKac6KbxtxK/oHw/RPOlQWLkxJI1P0GmUQCdeiWI608JkKjhC/7avCD9PPTA81yRqIUqJpPAnkvEuC0Lmqm6vgWv7zCUefFjkaZuq487R/GBcrELn1XEi3lh5EBIXxWdMCdt1jN1/FokVlytt/8qKr6O+fZtPps= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767718449; c=relaxed/simple; bh=70quCddtbjCQd65CaaISyDM+wTgczR0YCEP5KlY9l0w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dwIAiQ25cTx0ab5fncVbQxGQiTR+8wCYY9z5DU0jvvELbgLL1sLi3VfvjqKX3uPYn3TrFvr5vLWmkTORKjYzkQH0YnfPI9S/I0tIF31pXv/IxH/V+sN9TZgh844SRVLlv5+ms1kl36/VtxwUwMhQPP5HV7i6V695GxeZZIpG138= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=P0cRbnEf; arc=none smtp.client-ip=209.85.219.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="P0cRbnEf" Received: by mail-qv1-f43.google.com with SMTP id 6a1803df08f44-88fe44cce7eso8922366d6.3 for ; Tue, 06 Jan 2026 08:54:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1767718445; x=1768323245; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=kYDvBAzOkhTALwT3eyIczOsonUSioadjWvkMgob3zZc=; b=P0cRbnEfA1sgjy1DwIy7tCHDNLO/EqLfKFEYiMr+dUB/B/JwD6BaYO5bLOCUyBkMMc cla3CtzICJUBguKkYiDKV/ArvtVjZkIC7qVN6YDVHhWBi7vVmVv1HoOdHYRejXkU7JMT 8InJuxvN4v5Wg4pI4Za19jGKISfiFvcO2dMSlmk6nL3H3KkqBRJRBLZVFsI7ZuFnJzUy nVhygkVoxBCczuZGTjd8aYQytaObYSkm068VdJn4Of20OSMSAcY0LSuvA1x9WwI0aPqi y+7ojQLEL6aUQ9uRSr3lozCt1zRq72D5K4Wme7LDRBI7S0pHYNlHMwhmKAMCNVWmaUwE Q7kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767718445; x=1768323245; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kYDvBAzOkhTALwT3eyIczOsonUSioadjWvkMgob3zZc=; b=tPTz/52I7ITaKAn/HSo5+Er98SlTb2LemlnxVEXyXkLymPeAgUvqt9Ea1npSw10Ajc LJ18Bbayk31NFPoRGIsuhviZIUB6zYuX8mGRQpOzRsG3u7mPXSVTTjA3JrDdl0gAhA1X kIZeXzrsv7SsFPp5v7vnD69CR1wtQoJ6ggIcQdltebw2DP2sygufHiaQjNgZ0tixoeQj Yw1R7tAj/C6wm5OJyUgKCIY9+cJI2o+GQQTpbDLe34sI37zd8ur+RUqPAIZbnKa4H+Be o5i79QLnOI2eVkbyaWBnzfm6BAKjFbBBIQoQvXAkahFTRoSWrOwbXUeEIeVmqnsl0I8V LTGg== X-Forwarded-Encrypted: i=1; AJvYcCUJoSQeJ8/gSpTPJ4wseAqZbtNySwKtmxUZ/RAI94h2Oi0GkOmfNToPM2PoFAs9FfllqwqLf2UVeLynfgM=@vger.kernel.org X-Gm-Message-State: AOJu0Ywu8m+ws4DRGReTJY28TNQnTY5yO9g8ZOpkHfYsnQA5TA2x+759 zNael4wxy4n/La0WXO/3XDxdjP68o9BWC0dNBT8ovUR0xberv6LzPq0nOsCjfpe7SsM= X-Gm-Gg: AY/fxX6Nn1rKqRNi/qJVePmS4SAWuwV1Hup/FbxwujxPetcOdw8+Ey9J4zTybLbVoVu DmjhKP8JTViUtNUZYF/M8zbIrDnyQxPnTjgkBKWCoAd4h3SeJeRBGzkXk+bW03HmlYU31JZd0Wo ApTTngp+8OfyTetzMM2Gb0Se8X82/vxR8ogYxceFS7ygpX8T9lKte5PbowmgYmpv3kRs5zhDvIH jsTipE+Fx0L3ZHz45w+9dZaDo/c46JkrG0iOMJbJdFa+SnLGlfP/LgHRQENHY7wsxGUIy9yZ96O kicIysMrZUSKeybyVaSfs7hZWABCZwZuaO8QP3mPfJUbiorDqmF/8G/rkPVr/N9F3JfsZEfU2MZ j72Xj2i96dEXyjsmY+Q0Ki48oFpSGhFCczIY81dxPVS3yncJr1WtBy8lSo85uTQ8WcEAtKXNOQV jknux852FExyFQmdH1gkanDKLMnW9T3HNTSLQNt24W1oayHlOal+A8oVdR/B2Vs/mLzzujpFSh+ BOVvVQz X-Google-Smtp-Source: AGHT+IEi8zj6WqmI82CY2AQdJr047h5UMomuGGL/gYN5QJO+P0m+nYFAEyPxUyu5PKAelEybPRtnxg== X-Received: by 2002:a05:6214:5786:b0:88a:442c:2988 with SMTP id 6a1803df08f44-89075e49c9bmr47967136d6.6.1767718444827; Tue, 06 Jan 2026 08:54:04 -0800 (PST) Received: from gourry-fedora-PF4VCD3F (pool-96-255-20-138.washdc.ftas.verizon.net. [96.255.20.138]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-890770ce659sm16547896d6.10.2026.01.06.08.54.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jan 2026 08:54:04 -0800 (PST) Date: Tue, 6 Jan 2026 11:53:30 -0500 From: Gregory Price To: Michal Hocko Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, david@redhat.com, osalvador@suse.de, gregkh@linuxfoundation.org, rafael@kernel.org, dakr@kernel.org, akpm@linux-foundation.org, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org, surenb@google.com, hare@suse.de Subject: Re: [RFC PATCH] memory,memory_hotplug: allow restricting memory blocks to zone movable Message-ID: References: <20260105203611.4079743-1-gourry@gourry.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Jan 06, 2026 at 04:05:48PM +0100, Michal Hocko wrote: > On Mon 05-01-26 15:36:11, Gregory Price wrote: > > It was reported (LPC 2025) that userland services which monitor memory > > blocks can cause hot-unplug to fail permanently. > > > > This can occur when drivers attempt to hot-remove memory in two phases > > (offline, remove), while a userland service detects the memory offline > > and re-onlines the memory into a zone which may prevent removal. > > Are there more details about this? The details are with Hannes, I was just recapping what was described in his devmem talk at LPC ("To online or not online"). > > > This patch allows a driver to specify that a given memory block is > > intended as ZONE_MOVABLE memory only (i.e. the system should try to > > protect its hot-unpluggability). This is done via an MHP flag and a new > > "movable_only" bool in `struct memory_block`. > > > > Attempts to online a memory block with movable_only=true with any value > > other than MMOP_ONLINE_MOVABLE will fail with -EINVAL. > > > > It is hard to catch all possible ways to implement offline/remove > > process, so a race condition here can clearly still occur if the > > userland service onlines the memory back into ZONE_MOVABLE, but it at > > least will not prevent the removal of a block at a later time. > > Irrespective of the userspace note above (which seems like a policy that > should probably be re-evaluated or allow for a better fine tuning) I can > see some sense in drivers having a better control of which zones (kernel > vs. movable) can their managed memory fall into. Hannes pointed out that this is some default policy on one or more distributions, which is quite annoying. Obviously a kernel change to fight against user-policy is not great, but trying to prevent hotplug-intended memory from being onlined in hotplug-unfriendly zones seemed like a pretty straight forward improvement. > > That being said, rather than movable_only, should we have a mask of > online types supported for the mem block? > I briefly considered this. I went with this for RFC-v1 since it's fairly simple and because movable is really the only zone with hotplug guarantees (any other zone makes no hotplug guarantees). It's also significantly more complex of a change for questionable value, but if people see this as the way to go i'll happily pivot to that. ~Gregory