• Tobin C. Harding's avatar
    slob: use slab_list instead of lru · adab7b68
    Tobin C. Harding authored
    Currently we use the page->lru list for maintaining lists of slabs.  We
    have a list_head in the page structure (slab_list) that can be used for
    this purpose.  Doing so makes the code cleaner since we are not
    overloading the lru list.
    The slab_list is part of a union within the page struct (included here
    stripped down):
    	union {
    		struct {	/* Page cache and anonymous pages */
    			struct list_head lru;
    		struct {
    			dma_addr_t dma_addr;
    		struct {	/* slab, slob and slub */
    			union {
    				struct list_head slab_list;
    				struct {	/* Partial pages */
    					struct page *next;
    					int pages;	/* Nr of pages left */
    					int pobjects;	/* Approximate count */
    Here we see that slab_list and lru are the same bits.  We can verify that
    this change is safe to do by examining the object file produced from
    slob.c before and after this patch is applied.
    Steps taken to verify:
     1. checkout current tip of Linus' tree
        commit a667cb7a ("Merge branch 'akpm' (patches from Andrew)")
     2. configure and build (select SLOB allocator)
     3. dissasemble object file `objdump -dr mm/slub.o > before.s
     4. apply patch
     5. build
     6. dissasemble object file `objdump -dr mm/slub.o > after.s
     7. diff before.s after.s
    Use slab_list list_head instead of the lru list_head for maintaining
    lists of slabs.
    Link: http://lkml.kernel.org/r/20190402230545.2929-4-tobin@kernel.orgSigned-off-by: default avatarTobin C. Harding <tobin@kernel.org>
    Reviewed-by: default avatarRoman Gushchin <guro@fb.com>
    Acked-by: default avatarChristoph Lameter <cl@linux.com>
    Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Pekka Enberg <penberg@kernel.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
slob.c 17 KB