On Wed, Apr 20, 2022 at 12:08 PM Catalin Marinas <catalin.marinas@xxxxxxx> wrote: > > With kstrdup() modified to pass __GFP_PACKED (as per the last hunk in > the diff below), I get just after boot: > > kmalloc-128 8966 9056 128 32 > kmalloc-96 0 0 96 42 > kmalloc-64 192 192 64 64 > kmalloc-32 768 768 32 128 > kmalloc-16 2048 2048 16 256 > kmalloc-8 2560 2560 8 512 > > So that's probably the simplest approach and using the ftrace histogram > we can add the flag to more places. I agree that this seems to be the safest thing to do, and maybe __GFP_PACKED is a better flag name than __GFP_NODMA. That said, It worries me a bit in that to me "PACKED" implies "no alignment at all". And I could _easily_ see people still wanting to do 8-byte allocations that have 8-byte alignment because it's some kind of private pointer thing or whatever. For "kstrdup()", a flag like __GFP_PACKED makes 100% sense, since it literally wants byte alignment. But what about those "random small structures" cases? Anyway, I'm perfectly happy calling it __GFP_PACKED, but at a minimum document that "packed" in this case still means "__alignof__(unsigned long long)" or something like that? Linus