Skip to content

Commit fb012e2

Browse files
Matthew Wilcox (Oracle)tehcaster
authored andcommitted
mm/slub: Convert print_page_info() to print_slab_info()
Improve the type safety and prepare for further conversion. For flags access, convert to folio internally. [ [email protected]: access flags via folio_flags() ] Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Signed-off-by: Vlastimil Babka <[email protected]> Reviewed-by: Roman Gushchin <[email protected]> Reviewed-by: Hyeonggon Yoo <[email protected]>
1 parent 0393895 commit fb012e2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

mm/slub.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -788,12 +788,13 @@ void print_tracking(struct kmem_cache *s, void *object)
788788
print_track("Freed", get_track(s, object, TRACK_FREE), pr_time);
789789
}
790790

791-
static void print_page_info(struct page *page)
791+
static void print_slab_info(const struct slab *slab)
792792
{
793-
pr_err("Slab 0x%p objects=%u used=%u fp=0x%p flags=%pGp\n",
794-
page, page->objects, page->inuse, page->freelist,
795-
&page->flags);
793+
struct folio *folio = (struct folio *)slab_folio(slab);
796794

795+
pr_err("Slab 0x%p objects=%u used=%u fp=0x%p flags=%pGp\n",
796+
slab, slab->objects, slab->inuse, slab->freelist,
797+
folio_flags(folio, 0));
797798
}
798799

799800
static void slab_bug(struct kmem_cache *s, char *fmt, ...)
@@ -833,7 +834,7 @@ static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p)
833834

834835
print_tracking(s, p);
835836

836-
print_page_info(page);
837+
print_slab_info(page_slab(page));
837838

838839
pr_err("Object 0x%p @offset=%tu fp=0x%p\n\n",
839840
p, p - addr, get_freepointer(s, p));
@@ -903,7 +904,7 @@ static __printf(3, 4) void slab_err(struct kmem_cache *s, struct page *page,
903904
vsnprintf(buf, sizeof(buf), fmt, args);
904905
va_end(args);
905906
slab_bug(s, "%s", buf);
906-
print_page_info(page);
907+
print_slab_info(page_slab(page));
907908
dump_stack();
908909
add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE);
909910
}

0 commit comments

Comments
 (0)