On 11/8/24 12:13, Hyeonggon Yoo wrote: > On Fri, Nov 8, 2024 at 6:56 PM Vlastimil Babka <vbabka@xxxxxxx> wrote: >> >> On 11/6/24 22:22, Mikulas Patocka wrote: >> > >> > >> > On Wed, 6 Nov 2024, Vlastimil Babka wrote: >> > >> >> On 11/6/24 13:05, Mikulas Patocka wrote: >> >> > >> >> > >> >> > On Wed, 6 Nov 2024, Vlastimil Babka wrote: >> >> > >> >> >> On 11/6/24 12:19, Mikulas Patocka wrote: >> >> >> > Hi >> >> >> >> >> >> Hi, >> >> >> >> >> >> > The commit 4c39529663b93165953ecf9b1a9ea817358dcd06 ("slab: Warn on >> >> >> > duplicate cache names when DEBUG_VM=y") is causing large number of >> >> >> > warnings about "dm_bufio_buffer", "dm_bufio_buffer-%u" (and other) device >> >> >> > mapper caches. >> >> >> >> >> >> Hmm wonder why nobody run into this before. We thought the code that would >> >> >> cause the warning would be all fixed before introducing it, but we missed >> >> >> some, sorry. >> >> >> >> >> >> > I'd like to ask - how to properly fix it? >> >> >> > >> >> >> > We create a "dm_bufio_buffer" or "dm_bufio_buffer-%u" cache with every dm >> >> >> > bufio client. It used to work (and the duplicate caches are merged), but >> >> >> >> >> >> Note the merging can be disabled so then it's really several caches with >> >> >> exactly same name in /proc/slabinfo and inability to create their >> >> >> sysfs/debugfs directories. >> >> > >> >> > Would it be sensible to allow merging caches with the same name and same >> >> > attributes and only warn if there are caches with the same name and >> >> > different attributes? >> >> >> >> We might consider that. >> > >> > That would be good - so that users don't have to write their own slab >> > cache merge logic. >> >> So Pedro, wanna do that? Or Hyeonggon maybe? :) > > IIUC it would be a special slab merging logic if the names and > attributes match, even if slab merging is disabled. Right? Yes, I'm thinking of a new SLAB_ flag to make this opt-in and not accidental. It would need to override even the (debugging etc) flags or cache-specific that prevent merging, in addition to the global setting. Instead we'd need to check that everything is exactly the same - flags, ctor, etc...