On Tue, Sep 01, 2015 at 01:51:29PM -0400, Mike Snitzer wrote: > The slab aliasing/merging by default transition went unnoticed (at least > to the DM subsystem). Add a new SLAB_NO_MERGE flag that allows > individual slabs to be created without slab merging. This beats forcing > all slabs to be created in this fashion by specifying sl[au]b_nomerge on > the kernel commandline. I didn't realise that this merging had also been applied to SLAB - I thought it was just SLUB that did this. Indeed, one of the prime reasons for using SLAB over SLUB was that it didn't merge caches and so still gave excellent visibility of runtime slab memory usage on production systems. I had no idea that commit 12220de ("mm/slab: support slab merge") had made SLAB do this as well as it was not cc'd to any of the people/subsystems that maintain code that uses slab caches. IMNSHO the commit message gives pretty flimsy justification for such a change, especially considering we need to deal with slab caches that individually grow to contain hundreds of millions of objects. > DM has historically taken care to have separate named slabs that each > devices' mempool_t are backed by. These separate slabs are useful -- > even if only to aid inspection of DM's memory use (via /proc/slabinfo) > on production systems. Yup, that's one of the reasons XFS has 17 separate slab caches. The other main reason is that slab separation also helps keep memory corruption and use-after free issues contained; if you have a problem with the objects from one slab cache, the isolation of the slab makes it less likely that the problem propagates to other subsystems. Hence failures also tend to be isolated to the code that has the leak/corruption problem, making them easier to triage and debug on production systems... > I stumbled onto slab merging as a side-effect of a leak in dm-cache > being attributed to 'kmalloc-96' rather than the expected > 'dm_bio_prison_cell' named slab. Moving forward DM will disable slab > merging for all of DM's slabs by using SLAB_NO_MERGE. Seems like a fine idea to me. I can apply it to various slabs in XFS once it's merged.... Acked-by: Dave Chinner <dchinner@xxxxxxxxxx> Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>