• Joonsoo Kim's avatar
    mm/slab: reverse iteration on find_mergeable() · 54362057
    Joonsoo Kim authored
    Unlike SLUB, sometimes, object isn't started at the beginning of the slab
    in the SLAB.  This causes the unalignment problem when after slab merging
    is supported by commit 12220dea ("mm/slab: support slab merge").
    Alignment mismatch check is introduced ("mm/slab: fix unalignment problem
    on Malta with EVA due to slab merge") to prevent merge in this case.
    
    This causes undesirable result that merging happens between infrequently
    used kmem_caches if there are kmem_caches with same size and is 256 bytes,
    are merged into pool_workqueue rather than kmalloc-256, because
    kmem_caches for kmalloc are at the tail of the list.
    
    To prevent this situation, this patch reverses iteration order in
    find_mergeable() to find frequently used kmem_caches.  This change helps
    to merge kmem_cache to frequently used kmem_caches, such as kmalloc
    kmem_caches.
    Signed-off-by: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
    Acked-by: default avatarChristoph Lameter <cl@linux.com>
    Cc: Pekka Enberg <penberg@kernel.org>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    54362057
slab_common.c 23.7 KB