Skip to content

Commit d4fc506

Browse files
Matthew Wilcoxtorvalds
Matthew Wilcox
authored andcommitted
mm: switch s_mem and slab_cache in struct page
This will allow us to store slub's counters in the same bits as slab's s_mem. slub now needs to set page->mapping to NULL as it frees the page, just like slab does. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Matthew Wilcox <[email protected]> Acked-by: Christoph Lameter <[email protected]> Acked-by: Vlastimil Babka <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Jérôme Glisse <[email protected]> Cc: "Kirill A . Shutemov" <[email protected]> Cc: Lai Jiangshan <[email protected]> Cc: Martin Schwidefsky <[email protected]> Cc: Pekka Enberg <[email protected]> Cc: Randy Dunlap <[email protected]> Cc: Andrey Ryabinin <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 1d40a5e commit d4fc506

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

include/linux/mm_types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ struct page {
8383
/* See page-flags.h for the definition of PAGE_MAPPING_FLAGS */
8484
struct address_space *mapping;
8585

86-
void *s_mem; /* slab first object */
86+
struct kmem_cache *slab_cache; /* SL[AU]B: Pointer to slab */
8787
atomic_t compound_mapcount; /* first tail page */
8888
/* page_deferred_list().next -- second tail page */
8989
};
@@ -194,7 +194,7 @@ struct page {
194194
spinlock_t ptl;
195195
#endif
196196
#endif
197-
struct kmem_cache *slab_cache; /* SL[AU]B: Pointer to slab */
197+
void *s_mem; /* slab first object */
198198
};
199199

200200
#ifdef CONFIG_MEMCG

mm/slub.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,6 +1695,7 @@ static void __free_slab(struct kmem_cache *s, struct page *page)
16951695
__ClearPageSlab(page);
16961696

16971697
page_mapcount_reset(page);
1698+
page->mapping = NULL;
16981699
if (current->reclaim_state)
16991700
current->reclaim_state->reclaimed_slab += pages;
17001701
memcg_uncharge_slab(page, order, s);

0 commit comments

Comments
 (0)