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 BB7FD30F804 for ; Mon, 2 Feb 2026 21:37:09 +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=1770068231; cv=none; b=X/SK/tsvkPbjjgoqpOPEidSF12H7OQ2Kl0+pDJRY2URFcarWcX2enJIw+hHtbid3i7wKX9MFmqr0glOL2BiPRG+7Lfol+YD9FXC/xl0v87LYD+X2ZGsXK9ak71ZOxHKAUn29iBhnfQazc0tq6rXxn5mfETuHekmh1P0UdLv+yUE= 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.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="Mzx9Hd/R" Received: by mail-qk1-f176.google.com with SMTP id af79cd13be357-8c6ac42b91eso612009885a.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=m/3UOt+88HSYnzYY5qMGoyavmGWm/UWa0De4WzfcUrQf3iF6phcVN74uP5S1N1Zyzr PK18/0MvlhxWb/klZTLvlTOQsQV++aUBlAnSWUnLlR5hJ4mXFv1M010eYhgBstC+WpET sq4mPmkwxzeY5LXLZmnUJ2Lpq8Wl5vFRkGBd6dHzsgPcl4mT5Bo1pZ8n7l0U55uuF8zt bFi9LpPhdPKL4VgWTMxVWBPSRuaKFYtQ4QfhFLnlOWq9HXCDSuZ8VO+4fum0UHkIkLM1 dC7uzY9nsUNjhpg3tO0eKVmijSFzykxeFWqm/6Yo/2Z+wmdaTuwON4xA+EsesNOL2xXE 1e0Q== X-Forwarded-Encrypted: i=1; AJvYcCV1h2EqzJBaWi9E8r7QgzJnJn2OvDXKT2jWIFn1fVTNGR1ZKYzQ4wyrBiv4szeOA8+VrwNb4SNDlVk=@vger.kernel.org X-Gm-Message-State: AOJu0YzWUBGH8YNn4sqF33trUAxMoQzvgdmfnBPUQUlB4MGZy+51K7RF xKvnNTRSTTZNcTz/JTn3ObnT23zMusklmi6dZogQDD3DbYkgquIbFy11ZTVvMv7jEnE+/TUILHF ocgvtTo8= X-Gm-Gg: AZuq6aIDo+iWswRXnfmu9YiqJjbzOYhpmHQoS5oXWo3JdWSDfN7dN8x4hG8rAWgHlmC OtVcmHxM2RYeqh4DgFVGythpY4BNRpUU6X/djn5T4lCiM/oOHbKHtIAG72TnFqcWRAwo4d1JGry ipf2OZgA25s7oJYMEofAaHKQDyH7PQpcVJdomFbE5WtswLqK/pWGziGXF3RT8712kTd1CRhnDKN GMqEgeotIzxCf3AEoiLVxwbDQsi773jDURGxdcUduy9KjyUNTa2dPeSMEEs1hJZM0gSUxwuNGCq nSV7MkMhMGosFaNuQFHwT6VnygzGxtpoLVW3r/8WupmSJl4EdJUpmbkhYnmRK0QFX+zXVuo8bSZ 9A7TEVlhoIzSWOAou88HotSq1Upxw5a47ZcHivRcNKyaYMrir5t1PqmwvWd2v5d4QKkA3lkwzfc vfeW9D2pFi2kiM77AXovNSluFp9Qhy7ariyNX0GAe4luxuXuzXh2DhbuIUeXeYBVjJzhrZIg== 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-doc@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