linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Gregory Price <gourry@gourry.net>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: linux-mm@kvack.org, vishal.l.verma@intel.com,
	dave.jiang@intel.com, akpm@linux-foundation.org,
	osalvador@suse.de, dan.j.williams@intel.com, ljs@kernel.org,
	Liam.Howlett@oracle.com, vbabka@kernel.org, rppt@kernel.org,
	surenb@google.com, mhocko@suse.com, linux-kernel@vger.kernel.org,
	nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org,
	kernel-team@meta.com
Subject: Re: [PATCH 1/8] mm/memory-tiers: consolidate memory type dedup into mt_get_memory_type()
Date: Mon, 13 Apr 2026 15:41:39 -0400	[thread overview]
Message-ID: <ad1G84KdvOmKSRNM@gourry-fedora-PF4VCD3F> (raw)
In-Reply-To: <e0e48659-8ce1-496d-8b5a-f6d4416f2ea0@kernel.org>

On Mon, Apr 13, 2026 at 05:06:35PM +0200, David Hildenbrand (Arm) wrote:
> On 3/21/26 16:03, Gregory Price wrote:
> > Replace per-driver memory type list infrastructure with a single
> > mt_get_memory_type(adist) that deduplicates against the global
> > default_memory_types list under memory_tier_lock.
> > 
> > The per-driver lists (mutex + list_head + find/put wrappers) provided
> > dedup within a single driver, but not across drivers or with the core.
> > Since the number of distinct adist values is bounded and types on
> > default_memory_types are never freed anyway, the per-driver cleanup
> > on module unload was not useful.
> > 
> > Add MEMTIER_DEFAULT_LOWTIER_ADISTANCE to replace the default DAX
> > adistance, since it was really used as a standin for all kmem hotplugged
> > memory.  This at least makes the default tier relationship clearer to
> > other drivers and they can see where to put their memory in relation to
> > the default lower tier.
> 
> Very confusing code.
> 
> What's the purpose of kref_get/kref_put if "the types on
> default_memory_types are never freed anyway" ?
> 

Mostly trying to retain existing functionality rather than delete it.

I think the entire memory_type() infrastructure in memory-tiers.c is
generally very confusing and of dubious value - but i don't know who
out there still depends on it.

> IOW, couldn't init_node_memory_type()/clear_node_memory_type() just
> consume the "adist", and lookup the memory type itself?
> 
> All you'd need is some way in the driver to verify that there is a
> memory type for the given adist, as some kind of prepare step.
> 
> Alternatively, let init_node_memory_type() return an error to get a
> clean interface? :)
> 

tl;dr: yes all of this is true and I will rework it.

~Gregory


  reply	other threads:[~2026-04-13 19:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-21 15:03 [PATCH 0/8] dax/kmem: atomic whole-device hotplug via sysfs Gregory Price
2026-03-21 15:03 ` [PATCH 1/8] mm/memory-tiers: consolidate memory type dedup into mt_get_memory_type() Gregory Price
2026-04-13 15:06   ` David Hildenbrand (Arm)
2026-04-13 19:41     ` Gregory Price [this message]
2026-03-21 15:03 ` [PATCH 2/8] mm/memory: add memory_block_align_range() helper Gregory Price
2026-04-13 15:12   ` David Hildenbrand (Arm)
2026-03-21 15:03 ` [PATCH 3/8] mm/memory_hotplug: pass online_type to online_memory_block() via arg Gregory Price
2026-03-21 15:04 ` [PATCH 4/8] mm/memory_hotplug: export mhp_get_default_online_type Gregory Price
2026-04-13 15:18   ` David Hildenbrand (Arm)
2026-03-21 15:04 ` [PATCH 5/8] mm/memory_hotplug: add __add_memory_driver_managed() with online_type arg Gregory Price
2026-04-13 15:21   ` David Hildenbrand (Arm)
2026-03-21 15:04 ` [PATCH 6/8] dax: plumb hotplug online_type through dax Gregory Price
2026-04-13 15:23   ` David Hildenbrand (Arm)
2026-03-21 15:04 ` [PATCH 7/8] dax/kmem: extract hotplug/hotremove helper functions Gregory Price
2026-03-21 15:04 ` [PATCH 8/8] dax/kmem: add sysfs interface for atomic whole-device hotplug Gregory Price
2026-03-21 17:40 ` [PATCH 0/8] dax/kmem: atomic whole-device hotplug via sysfs Andrew Morton
2026-03-21 20:26   ` Gregory Price
2026-04-13 15:47     ` David Hildenbrand (Arm)
2026-04-13 19:38       ` Gregory Price
2026-04-13 19:40         ` David Hildenbrand (Arm)
2026-04-13 19:59           ` Gregory Price
2026-04-13 14:49 ` David Hildenbrand (Arm)
2026-04-13 14:53   ` David Hildenbrand (Arm)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ad1G84KdvOmKSRNM@gourry-fedora-PF4VCD3F \
    --to=gourry@gourry.net \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=david@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=nvdimm@lists.linux.dev \
    --cc=osalvador@suse.de \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox