From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (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 B7F3A2DB783 for ; Mon, 2 Feb 2026 21:37:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770068231; cv=none; b=Lc4fRTFt3+kpQpIv+uhbF+NBI8iLJ7b6W+wJJb+zsWbJVioD+rRA/1NxUVp+M4bbfkJDEWkWyPVnYlInJX4+0f8xqLAjhEutp55racFZiBnGjjNMGx7v37BKeGE0jOdOti2FYNJulFbZBFS4Okh+GIbLngJnst+rnhPeeEJbVsU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770068231; c=relaxed/simple; bh=kWEypPVGwJEMybutYPQAIuFoGDfenpYyYtSso4g6JH4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=INzTPW3BsD/iia7p2ZhNntHLfxVVC2d0quxm2kVWK9D+fuVI1UIwh5OaqM9jTQEua0WNu8smjllTy+PXJElJlo8IyHcqSTC7eepUuskHCZLdZj+6QQcFXkoZz4sJWuaJXwq+fc/oJxdYA3Jhto3IDJhq2GbSllLc3gJQg9WpJTo= 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=Mzx9Hd/R; arc=none smtp.client-ip=209.85.222.175 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="Mzx9Hd/R" Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-8c6ac42b91eso612009685a.3 for ; Mon, 02 Feb 2026 13:37:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1770068228; x=1770673028; 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=8laAOVGcrjt3grREBpdlanB8iPI5gP36V5MB+/CpDTw=; b=Mzx9Hd/Rzt+M+pJq9wOJRdRLoK7Svg7rFWFXH2nBvx1PV9vaNObCnNYbF5O2Kk4OLb VjdBr7JKdmQzzE7uEqmt9JLCMpvCohdG2P1YFr2uBfPFwoKU3TPlMPjzgW62pD/yEXh8 wPAvQ2YR6/lVWr2aZXP7mV+0JIu88qFTCOcSoPvqmFz83INXqVooueaHMy00oCZlmgys XC+QiXVYxKLHy3bY7XOqqu0tjlENqGPiyXu+s2SLdl5vuVqJTvO5OQcwCEGokRqsm6S9 B6n3U3wEoh96z1SiUNTjG044xBGkEWryo/9BUQepQmGkdG9rpXMy4P/C638jFPArwfiw poKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770068228; x=1770673028; 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=8laAOVGcrjt3grREBpdlanB8iPI5gP36V5MB+/CpDTw=; b=vrWsfEmEVBIl46CC2fgW1ca+11Bsst9D9laBjlKf7ZdopYjTHO2eBTkUScMampoqhA RcOIiDIz7ah8VFMGHMmPQ03Xu2LI0p0ruxSBH11JcAjTXZiBNpVYLWdqjuIu6hCjLAWQ Fzz1yCQ/IMscx3Im/HAVx5Xvp4Vxc4t36XoBKAm2+GyQo2K10pDDog38WsVYzFUi9bW/ 9QZNpxlkcWuvsuQQ+NfUweq7dAqJjELcOOiJ5T+SHbmPWCBe0i4gZ3tu7GMwpTp8b0J9 FArQMAal4emSRBfZHXgFRk4MAR4sBugwqN7SMphh/1l2g3nts4pvvX/CqZjcW4NYTMx8 Ib6w== X-Forwarded-Encrypted: i=1; AJvYcCXDe1UxSyopW2TYzpIBbemmgG3iHdK6EgX6nDPNSAFTnmi/n5yQPCZPEXmIjGeBKSiHin+yUBd5fB9Wjf0=@vger.kernel.org X-Gm-Message-State: AOJu0YztKLVK91A0IDEoFUfxQbl1f5mJapYrAvZvj6pJReMUaelj10db j/R+yCP+lcMzi3GmnRfV4wAOLFwKrSlcKvBX7spvCkdH84a7YuNCUaEflvXL4h5SN0U= X-Gm-Gg: AZuq6aLgZYlcXgpFxgxOYlv6M4VT5ClmMT7P/lRGywPH4YRsn8slu/PXqCM/qwe8Xhu nYix0kLg2yRyOysT5Dw3T1ONDtSR8T1I3chcDHc8eLw2CPUE0+kkOBAqxoediNEOONqhwuZrrNw BHNtFvFfeJzV6SdFQi43DDmpsj0VxlaUs97HxnWobSAKSDr+tNj1cJnS+w7+FajPCp0SQUGeX4V 7CVGawF1Nc9dLGFCavGcNWs0wxezxjKW3MaFa3SbLDrNlyBluNPJX1X2YObeqKDnS++7oZPIq7W jRXRu8QnfIeXPeXLMM7/bKxzzq/l9ydZkuy3ZavKjMLcrBLObTafjhZYNiqngsPf0jiw9t9swZh AuqmSUcpDTcTyabLwpk0buRQkaJKyNj+XF89cz3gI4ObGcR8uva4qR1bURsn7T5U3tIctlN6npn qSkqN48Srlcx/QSIT3Bbmj1cXZVqvjUjXJkOjoqr0eq3JOpsEF+esgy76AHA4LIwT4MOAOHQ== X-Received: by 2002:a05:620a:46a6:b0:8c6:e22b:25f7 with SMTP id af79cd13be357-8c9eb1fc204mr1562950785a.18.1770068228565; Mon, 02 Feb 2026 13:37:08 -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 af79cd13be357-8c711d61c6fsm1317392985a.47.2026.02.02.13.37.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Feb 2026 13:37:08 -0800 (PST) Date: Mon, 2 Feb 2026 16:37:05 -0500 From: Gregory Price To: Jonathan Cameron Cc: linux-mm@kvack.org, linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kernel-team@meta.com, dave@stgolabs.net, dave.jiang@intel.com, alison.schofield@intel.com, vishal.l.verma@intel.com, ira.weiny@intel.com, dan.j.williams@intel.com, willy@infradead.org, jack@suse.cz, terry.bowman@amd.com, john@jagalactic.com, David Hildenbrand , Oscar Salvador , Andrew Morton Subject: Re: [PATCH 2/9] mm/memory_hotplug: add __add_memory_driver_managed() with online_type arg Message-ID: References: <20260129210442.3951412-1-gourry@gourry.net> <20260129210442.3951412-3-gourry@gourry.net> <20260202172524.00000c6d@huawei.com> <20260202184609.00004a02@huawei.com> 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: <20260202184609.00004a02@huawei.com> On Mon, Feb 02, 2026 at 06:46:09PM +0000, Jonathan Cameron wrote: > > > > I can add a cleanup-patch prior to use the enum, but i don't think this > > actually enables the compiler to do anything new at the moment? > > Good point. More coffee needed (or sleep) > > It lets sparse do some checking, but sadly only for wrong enum assignment. > (Gcc has -Wenum-conversion as well which I think is effectively the same) > I.e. you can't assign a value from a different enum without casting. > > It can't do anything if people just pass in an out of range int. > Which, after looking a bit... mm/memory_hotplug.c does this quite a bit internally - except it uses a uint8_t Example: static int try_offline_memory_block(struct memory_block *mem, void *arg) { uint8_t online_type = MMOP_ONLINE_KERNEL; uint8_t **online_types = arg; ... snip ... } int offline_and_remove_memory(u64 start, u64 size) { uint8_t *online_types, *tmp; ... snip ... online_types = kmalloc_array(mb_count, sizeof(*online_types), GFP_KERNEL); } So that's fun. I'm not sure it's worth the churn here, but happy to do it if there are strong opinions. --- David do you have thoughts here? ~Gregory