aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slub.c
diff options
context:
space:
mode:
authorSasha Levin <sasha.levin@oracle.com>2014-01-23 18:52:54 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-23 19:36:50 -0500
commit309381feaee564281c3d9e90fbca8963bb7428ad (patch)
tree7e9f990c0cffcb8c5fc90deb1c7eac445c5ada0e /mm/slub.c
parente3bba3c3c90cd434c1ccb9e5dc704a96baf9541c (diff)
mm: dump page when hitting a VM_BUG_ON using VM_BUG_ON_PAGE
Most of the VM_BUG_ON assertions are performed on a page. Usually, when one of these assertions fails we'll get a BUG_ON with a call stack and the registers. I've recently noticed based on the requests to add a small piece of code that dumps the page to various VM_BUG_ON sites that the page dump is quite useful to people debugging issues in mm. This patch adds a VM_BUG_ON_PAGE(cond, page) which beyond doing what VM_BUG_ON() does, also dumps the page before executing the actual BUG_ON. [akpm@linux-foundation.org: fix up includes] Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Cc: "Kirill A. Shutemov" <kirill@shutemov.name> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/slub.c')
-rw-r--r--mm/slub.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/mm/slub.c b/mm/slub.c
index 545a170ebf9f..34bb8c65a2d8 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1559,7 +1559,7 @@ static inline void *acquire_slab(struct kmem_cache *s,
1559 new.freelist = freelist; 1559 new.freelist = freelist;
1560 } 1560 }
1561 1561
1562 VM_BUG_ON(new.frozen); 1562 VM_BUG_ON_PAGE(new.frozen, &new);
1563 new.frozen = 1; 1563 new.frozen = 1;
1564 1564
1565 if (!__cmpxchg_double_slab(s, page, 1565 if (!__cmpxchg_double_slab(s, page,
@@ -1812,7 +1812,7 @@ static void deactivate_slab(struct kmem_cache *s, struct page *page,
1812 set_freepointer(s, freelist, prior); 1812 set_freepointer(s, freelist, prior);
1813 new.counters = counters; 1813 new.counters = counters;
1814 new.inuse--; 1814 new.inuse--;
1815 VM_BUG_ON(!new.frozen); 1815 VM_BUG_ON_PAGE(!new.frozen, &new);
1816 1816
1817 } while (!__cmpxchg_double_slab(s, page, 1817 } while (!__cmpxchg_double_slab(s, page,
1818 prior, counters, 1818 prior, counters,
@@ -1840,7 +1840,7 @@ redo:
1840 1840
1841 old.freelist = page->freelist; 1841 old.freelist = page->freelist;
1842 old.counters = page->counters; 1842 old.counters = page->counters;
1843 VM_BUG_ON(!old.frozen); 1843 VM_BUG_ON_PAGE(!old.frozen, &old);
1844 1844
1845 /* Determine target state of the slab */ 1845 /* Determine target state of the slab */
1846 new.counters = old.counters; 1846 new.counters = old.counters;
@@ -1952,7 +1952,7 @@ static void unfreeze_partials(struct kmem_cache *s,
1952 1952
1953 old.freelist = page->freelist; 1953 old.freelist = page->freelist;
1954 old.counters = page->counters; 1954 old.counters = page->counters;
1955 VM_BUG_ON(!old.frozen); 1955 VM_BUG_ON_PAGE(!old.frozen, &old);
1956 1956
1957 new.counters = old.counters; 1957 new.counters = old.counters;
1958 new.freelist = old.freelist; 1958 new.freelist = old.freelist;
@@ -2225,7 +2225,7 @@ static inline void *get_freelist(struct kmem_cache *s, struct page *page)
2225 counters = page->counters; 2225 counters = page->counters;
2226 2226
2227 new.counters = counters; 2227 new.counters = counters;
2228 VM_BUG_ON(!new.frozen); 2228 VM_BUG_ON_PAGE(!new.frozen, &new);
2229 2229
2230 new.inuse = page->objects; 2230 new.inuse = page->objects;
2231 new.frozen = freelist != NULL; 2231 new.frozen = freelist != NULL;
@@ -2319,7 +2319,7 @@ load_freelist:
2319 * page is pointing to the page from which the objects are obtained. 2319 * page is pointing to the page from which the objects are obtained.
2320 * That page must be frozen for per cpu allocations to work. 2320 * That page must be frozen for per cpu allocations to work.
2321 */ 2321 */
2322 VM_BUG_ON(!c->page->frozen); 2322 VM_BUG_ON_PAGE(!c->page->frozen, c->page);
2323 c->freelist = get_freepointer(s, freelist); 2323 c->freelist = get_freepointer(s, freelist);
2324 c->tid = next_tid(c->tid); 2324 c->tid = next_tid(c->tid);
2325 local_irq_restore(flags); 2325 local_irq_restore(flags);