diff mbox series

[45/62] mm/slub: Convert slab_err() to take a struct slab

Message ID 20211004134650.4031813-46-willy@infradead.org (mailing list archive)
State New
Headers show
Series Separate struct slab from struct page | expand

Commit Message

Matthew Wilcox Oct. 4, 2021, 1:46 p.m. UTC
Push slab_page() down.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/slub.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/mm/slub.c b/mm/slub.c
index 9651586a3450..98cc2545a9bd 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -866,7 +866,7 @@  static void object_err(struct kmem_cache *s, struct slab *slab,
 	add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE);
 }
 
-static __printf(3, 4) void slab_err(struct kmem_cache *s, struct page *page,
+static __printf(3, 4) void slab_err(struct kmem_cache *s, struct slab *slab,
 			const char *fmt, ...)
 {
 	va_list args;
@@ -879,7 +879,7 @@  static __printf(3, 4) void slab_err(struct kmem_cache *s, struct page *page,
 	vsnprintf(buf, sizeof(buf), fmt, args);
 	va_end(args);
 	slab_bug(s, "%s", buf);
-	print_page_info(page);
+	print_page_info(slab_page(slab));
 	dump_stack();
 	add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE);
 }
@@ -1024,7 +1024,7 @@  static int slab_pad_check(struct kmem_cache *s, struct slab *slab)
 	while (end > fault && end[-1] == POISON_INUSE)
 		end--;
 
-	slab_err(s, slab_page(slab), "Padding overwritten. 0x%p-0x%p @offset=%tu",
+	slab_err(s, slab, "Padding overwritten. 0x%p-0x%p @offset=%tu",
 			fault, end - 1, fault - start);
 	print_section(KERN_ERR, "Padding ", pad, remainder);
 
@@ -1093,18 +1093,18 @@  static int check_slab(struct kmem_cache *s, struct slab *slab)
 	int maxobj;
 
 	if (!slab_test_cache(slab)) {
-		slab_err(s, slab_page(slab), "Not a valid slab page");
+		slab_err(s, slab, "Not a valid slab page");
 		return 0;
 	}
 
 	maxobj = order_objects(slab_order(slab), s->size);
 	if (slab->objects > maxobj) {
-		slab_err(s, slab_page(slab), "objects %u > max %u",
+		slab_err(s, slab, "objects %u > max %u",
 			slab->objects, maxobj);
 		return 0;
 	}
 	if (slab->inuse > slab->objects) {
-		slab_err(s, slab_page(slab), "inuse %u > max %u",
+		slab_err(s, slab, "inuse %u > max %u",
 			slab->inuse, slab->objects);
 		return 0;
 	}
@@ -1134,7 +1134,7 @@  static int on_freelist(struct kmem_cache *s, struct slab *slab, void *search)
 					"Freechain corrupt");
 				set_freepointer(s, object, NULL);
 			} else {
-				slab_err(s, slab_page(slab), "Freepointer corrupt");
+				slab_err(s, slab, "Freepointer corrupt");
 				slab->freelist = NULL;
 				slab->inuse = slab->objects;
 				slab_fix(s, "Freelist cleared");
@@ -1152,13 +1152,13 @@  static int on_freelist(struct kmem_cache *s, struct slab *slab, void *search)
 		max_objects = MAX_OBJS_PER_PAGE;
 
 	if (slab->objects != max_objects) {
-		slab_err(s, slab_page(slab), "Wrong number of objects. Found %d but should be %d",
+		slab_err(s, slab, "Wrong number of objects. Found %d but should be %d",
 			 slab->objects, max_objects);
 		slab->objects = max_objects;
 		slab_fix(s, "Number of objects adjusted");
 	}
 	if (slab->inuse != slab->objects - nr) {
-		slab_err(s, slab_page(slab), "Wrong object count. Counter is %d but counted were %d",
+		slab_err(s, slab, "Wrong object count. Counter is %d but counted were %d",
 			 slab->inuse, slab->objects - nr);
 		slab->inuse = slab->objects - nr;
 		slab_fix(s, "Object count adjusted");
@@ -1314,7 +1314,7 @@  static inline int free_consistency_checks(struct kmem_cache *s,
 		struct slab *slab, void *object, unsigned long addr)
 {
 	if (!check_valid_pointer(s, slab, object)) {
-		slab_err(s, slab_page(slab), "Invalid object pointer 0x%p", object);
+		slab_err(s, slab, "Invalid object pointer 0x%p", object);
 		return 0;
 	}
 
@@ -1328,7 +1328,7 @@  static inline int free_consistency_checks(struct kmem_cache *s,
 
 	if (unlikely(s != slab->slab_cache)) {
 		if (!slab_test_cache(slab)) {
-			slab_err(s, slab_page(slab), "Attempt to free object(0x%p) outside of slab",
+			slab_err(s, slab, "Attempt to free object(0x%p) outside of slab",
 				 object);
 		} else if (!slab->slab_cache) {
 			pr_err("SLUB <none>: no slab for object 0x%p.\n",
@@ -1384,7 +1384,7 @@  static noinline int free_debug_processing(
 
 out:
 	if (cnt != bulk_cnt)
-		slab_err(s, slab_page(slab), "Bulk freelist count(%d) invalid(%d)\n",
+		slab_err(s, slab, "Bulk freelist count(%d) invalid(%d)\n",
 			 bulk_cnt, cnt);
 
 	slab_unlock(slab_page(slab), &flags2);
@@ -4214,7 +4214,7 @@  static void list_slab_objects(struct kmem_cache *s, struct slab *slab,
 	unsigned long *map;
 	void *p;
 
-	slab_err(s, slab_page(slab), text, s->name);
+	slab_err(s, slab, text, s->name);
 	slab_lock(slab_page(slab), &flags);
 
 	map = get_map(s, slab_page(slab));