mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
mm, rmap: fix false positive VM_BUG() in page_add_file_rmap()
PageTransCompound() doesn't distinguish THP from from any other type of compound pages. This can lead to false-positive VM_BUG_ON() in page_add_file_rmap() if called on compound page from a driver[1]. I think we can exclude such cases by checking if the page belong to a mapping. The VM_BUG_ON_PAGE() is downgraded to VM_WARN_ON_ONCE(). This path should not cause any harm to non-THP page, but good to know if we step on anything else. [1] http://lkml.kernel.org/r/[email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Kirill A. Shutemov <[email protected]> Reported-by: Laura Abbott <[email protected]> Tested-by: Laura Abbott <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
6423aa8192
commit
c8efc390c1
1 changed files with 3 additions and 2 deletions
|
|
@ -1284,8 +1284,9 @@ void page_add_file_rmap(struct page *page, bool compound)
|
|||
VM_BUG_ON_PAGE(!PageSwapBacked(page), page);
|
||||
__inc_node_page_state(page, NR_SHMEM_PMDMAPPED);
|
||||
} else {
|
||||
if (PageTransCompound(page)) {
|
||||
VM_BUG_ON_PAGE(!PageLocked(page), page);
|
||||
if (PageTransCompound(page) && page_mapping(page)) {
|
||||
VM_WARN_ON_ONCE(!PageLocked(page));
|
||||
|
||||
SetPageDoubleMap(compound_head(page));
|
||||
if (PageMlocked(page))
|
||||
clear_page_mlock(compound_head(page));
|
||||
|
|
|
|||
Loading…
Reference in a new issue