From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) (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 D91C548BD3F for ; Tue, 9 Jun 2026 15:15:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781018145; cv=none; b=N9n3N0OE0J0RftUUpR6U4zNu3q4rP/pkUCuesnebn7DgWMcr+ymtKFgw5koZ1OkAVYQogNXOdHYDcJB+eApczesZ8v8JsULUsPGZYJRTjF3DPhCTHZMtutu6+SIJfe5Yt7xuBPB0atApBxoQWwoAmKZ0wWqgkMPDe+ykb6VosbM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781018145; c=relaxed/simple; bh=4Q3lUCN/K5ogiGNFPWtDLaQVmKDt2aFt3PTUh0S3qXM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UrXd5vXj8t0Zk3xMKbpxyZDs4GENvWNllOKqb7vedB4sQ9I0QrO9tiFnLEmqTxW2AbAn5YrY62mz0JTTf47wancn8YJjlr2HJrEN0oYDGPM1OLfbM/nRsEgItt/oHJ7M/Rri79Awuwpxv7mtmtfdRC1CszFOdj9SWryE6YILSHc= 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=QYKlEwp1; arc=none smtp.client-ip=209.85.222.176 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="QYKlEwp1" Received: by mail-qk1-f176.google.com with SMTP id af79cd13be357-91563abd6a9so265109985a.3 for ; Tue, 09 Jun 2026 08:15:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1781018142; x=1781622942; 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=01y5Yp7Lv2fsZ0TiFN6M9m/RLD3dl7/dyTYKRdYu1dc=; b=QYKlEwp1NAeKXFH14vu88N/Jn3kbwlP3nN9KftlyUwc0sVPeNHbrFcKvdMCfxsTZwZ 7/utzHEww1ziDVO16OsAdJvAz6tNgEc1ODsGpNhP4TPipcWA59mg3UyV6JlsmIaSZv4u 2YbMRZ7LzVxll6mm4gBXF24O7wvKumb25xSRVDzQCBvvEQpoifN9VjHJmJeJsapmrbQk GB1xfENxYm8wHIAYyLTXx5++1Ise24d1xQECru8Qzx2O1GxkDlUAMg3/r3l7DY+w/cnK ZLRt1jVYnLZ+KpKEneVxmUrXNgglHlFV5MLkhbs9hke5TB4lybkrgoj6Zak8biTtcxHa v5Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781018142; x=1781622942; 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=01y5Yp7Lv2fsZ0TiFN6M9m/RLD3dl7/dyTYKRdYu1dc=; b=IHnqX+KB+62ILP/4OZzhLxa9H+XQawCpS4n7FNypfIJMGynEyxrd5ZBVOwQJFag0y+ wObUswDBKct4ugnJMVw81ipiwKwJHQ4+CnYb4VrJeY4ARCBb0j8/5HvjWfnsliBNiVhB 85Uit2xNH5xrs7yYAp48L1LArCDn0vo3sg6g5n1vGm8Xdsz9Yu/u1CXoN26OBXzGgaGh 9vGBJer856Gd0rd3d5qS1Mh9g7vGrfcNqmlI4pISKSL6RK+xC8t0bjSHz0cSXn4yk4b4 l5lz8pkaHJHk8cFCvqNzwDmdIhE4HfmjTJz6EhiAPci5KdT4W2TDWL26bQkc7BBYPhjZ ittQ== X-Forwarded-Encrypted: i=1; AFNElJ8wCdUmAGpX2YrkGhX1XbD40zvou7swAwP6dEaOrNURDQ8/W85JIMykq5hpiC64uh5WvZjx/Fhxc4mAHD8=@vger.kernel.org X-Gm-Message-State: AOJu0YxjQcXK4JZS9FiCMWgZCSdOc036xfTsAExV1funT4UlvLS3Y0w5 ZQ6MFDrP5yULXg+WtQNb3r2x8K8/YH2tidyx3zQMEdH+V69LVLqhSH9pzhVBC5NHqLA= X-Gm-Gg: Acq92OGNwUR0+xHNPvAoycXOi6sweXlLvviIs4qgDequynt0ZM7LmAskdT4GBj5a/K+ sD2Yv/uCk32l8tr/KJgr9JEST2tredGx4jS1I2vleN+eNeUxXtNftP3X8thEbDhjcPP0TAxnIVM RJfcgh6PKT8h6niVBA5GUHojtzAJ+AfnDYQupMfSkDMa/iLW1hp7cFvHtr7GU4pFXwyl+b3tEWe hAHafz+EPhoj4NiePlswxSLJSlmY3p/ruLeCt8qL81blbSmg1fIFwJrQOEhA6QFmT1kPXcmSaM8 wTslL5gcDzhipfvWmkCT7+SmPPLmLWiWZW8NHIpfqSgOOT4tTXJNnpOmFybItrqdVif99HqoulG S1//5/i1QQ1P5UzYqFpBleXKqkMAnFpuoCMnMhEcdXGtnxOzpoHWm5JKm2241xCK6P99lqkx41o Ki54S+LhxP4CQxEmlrqbQyHzi2TdeoTXY37AzNo+VvD7AJIMYgR5QR+WZEDm6i4G062aH3bUWPb 11ZQ6RlAe5N215IXA== X-Received: by 2002:a05:620a:2547:b0:915:9972:cfc with SMTP id af79cd13be357-915a9c7bba3mr3335701585a.19.1781018139752; Tue, 09 Jun 2026 08:15:39 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F (pool-173-79-60-52.washdc.fios.verizon.net. [173.79.60.52]) by smtp.gmail.com with ESMTPSA id af79cd13be357-91589ea0bcfsm2153439585a.0.2026.06.09.08.15.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2026 08:15:39 -0700 (PDT) Date: Tue, 9 Jun 2026 11:15:37 -0400 From: Gregory Price To: "David Hildenbrand (Arm)" Cc: linux-mm@kvack.org, nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, kernel-team@meta.com, linux-cxl@vger.kernel.org, linux-kselftest@vger.kernel.org, djbw@kernel.org, vishal.l.verma@intel.com, dave.jiang@intel.com, akpm@linux-foundation.org, ljs@kernel.org, liam@infradead.org, vbabka@kernel.org, rppt@kernel.org, surenb@google.com, mhocko@suse.com, osalvador@suse.de, shuah@kernel.org, alison.schofield@intel.com, Smita.KoralahalliChannabasappa@amd.com, ira.weiny@intel.com, apopple@nvidia.com Subject: Re: [PATCH v4 5/9] mm/memory_hotplug: add multi-range hotunplug Message-ID: References: <20260605211911.2160954-1-gourry@gourry.net> <20260605211911.2160954-6-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, Jun 09, 2026 at 12:06:38PM +0200, David Hildenbrand (Arm) wrote: > > > EXPORT_SYMBOL_GPL(offline_and_remove_memory); > > + > > +/** > > + * offline_and_remove_memory_ranges - offline and remove multiple memory ranges > > + * @ranges: array of physical address ranges to offline and remove > > + * @nr_ranges: number of entries in @ranges > > + * > > + * Offline and remove several memory ranges as one operation, serialized > > + * against other hotplug operations by a single lock_device_hotplug(). > > + * > > + * Unlike calling offline_and_remove_memory() in a loop, this offlines *all* > > + * ranges before removing any of them. If offlining any range fails, the > > + * offlining of the ranges processed so far is reverted and nothing is > > + * removed, leaving every range online as it was before the call. This gives > > + * callers all-or-nothing semantics for the offline step, so a failed unplug > > + * does not leave a device split between online and removed ranges. > > + * > > + * Each range must be memory-block aligned in start and size. > > + * > > + * Return: 0 on success, negative errno otherwise. On failure no range has > > + * been removed. > > + */ > > +int offline_and_remove_memory_ranges(const struct range *ranges, int nr_ranges) > > +{ > > Is there a way to just generalize the logic in offline_and_remove_memory() to > multiple ranges, making offline_and_remove_memory() then a simple wrapper around > the new offline_and_remove_memory_ranges(), providing only a single range? > Yeah that's reasonable, I'll look at what can be done. ~Gregory