Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] page_add_file_rmap(): remove BUG_ON()s

Remove two early-development BUG_ONs from page_add_file_rmap.

The pfn_valid test (originally useful for checking that nobody passed an
artificial struct page) comes too late, since we already have the struct
page.

The PageAnon test (useful when anon was first distinguished from file rmap)
prevents ->nopage implementations from reusing ->mapping, which would
otherwise be available.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Hugh Dickins and committed by
Linus Torvalds
85a6cd03 6218cf44

-3
-3
mm/rmap.c
··· 537 537 */ 538 538 void page_add_file_rmap(struct page *page) 539 539 { 540 - BUG_ON(PageAnon(page)); 541 - BUG_ON(!pfn_valid(page_to_pfn(page))); 542 - 543 540 if (atomic_inc_and_test(&page->_mapcount)) 544 541 __inc_page_state(nr_mapped); 545 542 }