mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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. [[email protected]: fix up includes] Signed-off-by: Sasha Levin <[email protected]> Cc: "Kirill A. Shutemov" <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
e3bba3c3c9
commit
309381feae
30 changed files with 181 additions and 170 deletions
|
|
@ -27,8 +27,8 @@ static inline void set_page_count(struct page *page, int v)
|
|||
*/
|
||||
static inline void set_page_refcounted(struct page *page)
|
||||
{
|
||||
VM_BUG_ON(PageTail(page));
|
||||
VM_BUG_ON(atomic_read(&page->_count));
|
||||
VM_BUG_ON_PAGE(PageTail(page), page);
|
||||
VM_BUG_ON_PAGE(atomic_read(&page->_count), page);
|
||||
set_page_count(page, 1);
|
||||
}
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ static inline void __get_page_tail_foll(struct page *page,
|
|||
* speculative page access (like in
|
||||
* page_cache_get_speculative()) on tail pages.
|
||||
*/
|
||||
VM_BUG_ON(atomic_read(&page->first_page->_count) <= 0);
|
||||
VM_BUG_ON_PAGE(atomic_read(&page->first_page->_count) <= 0, page);
|
||||
if (get_page_head)
|
||||
atomic_inc(&page->first_page->_count);
|
||||
get_huge_page_tail(page);
|
||||
|
|
@ -71,7 +71,7 @@ static inline void get_page_foll(struct page *page)
|
|||
* Getting a normal page or the head of a compound page
|
||||
* requires to already have an elevated page->_count.
|
||||
*/
|
||||
VM_BUG_ON(atomic_read(&page->_count) <= 0);
|
||||
VM_BUG_ON_PAGE(atomic_read(&page->_count) <= 0, page);
|
||||
atomic_inc(&page->_count);
|
||||
}
|
||||
}
|
||||
|
|
@ -173,7 +173,7 @@ static inline void munlock_vma_pages_all(struct vm_area_struct *vma)
|
|||
static inline int mlocked_vma_newpage(struct vm_area_struct *vma,
|
||||
struct page *page)
|
||||
{
|
||||
VM_BUG_ON(PageLRU(page));
|
||||
VM_BUG_ON_PAGE(PageLRU(page), page);
|
||||
|
||||
if (likely((vma->vm_flags & (VM_LOCKED | VM_SPECIAL)) != VM_LOCKED))
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue