]> www.infradead.org Git - users/willy/linux.git/commitdiff
mm: Remove slab from struct page struct-slab
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Thu, 30 Sep 2021 03:10:53 +0000 (23:10 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 4 Oct 2021 13:31:03 +0000 (09:31 -0400)
All members of struct slab can now be removed from struct page.
This shrinks the definition of struct page by 30 LOC, making
it easier to understand.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
include/linux/mm_types.h
include/linux/page-flags.h

index c2ea71aba84e9c3b3d034c2063d46a5400723ba7..417c5e8a3371bc453f6f94559f198eddca752af7 100644 (file)
@@ -117,33 +117,6 @@ struct page {
                                atomic_long_t pp_frag_count;
                        };
                };
-               struct {        /* slab, slob and slub */
-                       union {
-                               struct list_head slab_list;
-                               struct {        /* Partial pages */
-                                       struct page *next;
-#ifdef CONFIG_64BIT
-                                       int pages;      /* Nr of pages left */
-                                       int pobjects;   /* Approximate count */
-#else
-                                       short int pages;
-                                       short int pobjects;
-#endif
-                               };
-                       };
-                       struct kmem_cache *slab_cache; /* not slob */
-                       /* Double-word boundary */
-                       void *freelist;         /* first free object */
-                       union {
-                               void *s_mem;    /* slab: first object */
-                               unsigned long counters;         /* SLUB */
-                               struct {                        /* SLUB */
-                                       unsigned inuse:16;
-                                       unsigned objects:15;
-                                       unsigned frozen:1;
-                               };
-                       };
-               };
                struct {        /* Tail pages of compound page */
                        unsigned long compound_head;    /* Bit zero is set */
 
@@ -207,9 +180,6 @@ struct page {
                 * which are currently stored here.
                 */
                unsigned int page_type;
-
-               unsigned int active;            /* SLAB */
-               int units;                      /* SLOB */
        };
 
        /* Usage count. *DO NOT USE DIRECTLY*. See page_ref.h */
@@ -283,11 +253,7 @@ struct slab {
        static_assert(offsetof(struct page, pg) == offsetof(struct slab, sl))
 SLAB_MATCH(flags, flags);
 SLAB_MATCH(compound_head, slab_list);  /* Ensure bit 0 is clear */
-SLAB_MATCH(slab_list, slab_list);
 SLAB_MATCH(rcu_head, rcu_head);
-SLAB_MATCH(slab_cache, slab_cache);
-SLAB_MATCH(s_mem, s_mem);
-SLAB_MATCH(active, active);
 SLAB_MATCH(_refcount, _refcount);
 #ifdef CONFIG_MEMCG
 SLAB_MATCH(memcg_data, memcg_data);
index 57bdb1eb2f2904ee6836bdb22506e1703c24fb18..d3d0806c1535fc9b34ffec3da033e5350e8b8ce2 100644 (file)
@@ -799,43 +799,6 @@ extern bool is_free_buddy_page(struct page *page);
 
 __PAGEFLAG(Isolated, isolated, PF_ANY);
 
-/*
- * If network-based swap is enabled, sl*b must keep track of whether pages
- * were allocated from pfmemalloc reserves.
- */
-static inline int PageSlabPfmemalloc(struct page *page)
-{
-       VM_BUG_ON_PAGE(!PageSlab(page), page);
-       return PageActive(page);
-}
-
-/*
- * A version of PageSlabPfmemalloc() for opportunistic checks where the page
- * might have been freed under us and not be a PageSlab anymore.
- */
-static inline int __PageSlabPfmemalloc(struct page *page)
-{
-       return PageActive(page);
-}
-
-static inline void SetPageSlabPfmemalloc(struct page *page)
-{
-       VM_BUG_ON_PAGE(!PageSlab(page), page);
-       SetPageActive(page);
-}
-
-static inline void __ClearPageSlabPfmemalloc(struct page *page)
-{
-       VM_BUG_ON_PAGE(!PageSlab(page), page);
-       __ClearPageActive(page);
-}
-
-static inline void ClearPageSlabPfmemalloc(struct page *page)
-{
-       VM_BUG_ON_PAGE(!PageSlab(page), page);
-       ClearPageActive(page);
-}
-
 #ifdef CONFIG_MMU
 #define __PG_MLOCKED           (1UL << PG_mlocked)
 #else