mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
mm: fold mlocked_vma_newpage() into its only call site
In previous commit(mm: use the light version __mod_zone_page_state in mlocked_vma_newpage()) a irq-unsafe __mod_zone_page_state is used. And as suggested by Andrew, to reduce the risks that new call sites incorrectly using mlocked_vma_newpage() without knowing they are adding racing, this patch folds mlocked_vma_newpage() into its only call site, page_add_new_anon_rmap, to make it open-cocded for people to know what is going on. [[email protected]: coding-style fixes] Signed-off-by: Jianyu Zhan <[email protected]> Suggested-by: Andrew Morton <[email protected]> Suggested-by: Hugh Dickins <[email protected]> Acked-by: Hugh Dickins <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
bea04b0732
commit
7ee07a44eb
2 changed files with 17 additions and 32 deletions
20
mm/rmap.c
20
mm/rmap.c
|
|
@ -1032,11 +1032,25 @@ void page_add_new_anon_rmap(struct page *page,
|
|||
__mod_zone_page_state(page_zone(page), NR_ANON_PAGES,
|
||||
hpage_nr_pages(page));
|
||||
__page_set_anon_rmap(page, vma, address, 1);
|
||||
if (!mlocked_vma_newpage(vma, page)) {
|
||||
|
||||
VM_BUG_ON_PAGE(PageLRU(page), page);
|
||||
if (likely((vma->vm_flags & (VM_LOCKED | VM_SPECIAL)) != VM_LOCKED)) {
|
||||
SetPageActive(page);
|
||||
lru_cache_add(page);
|
||||
} else
|
||||
add_page_to_unevictable_list(page);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TestSetPageMlocked(page)) {
|
||||
/*
|
||||
* We use the irq-unsafe __mod_zone_page_stat because this
|
||||
* counter is not modified from interrupt context, and the pte
|
||||
* lock is held(spinlock), which implies preemption disabled.
|
||||
*/
|
||||
__mod_zone_page_state(page_zone(page), NR_MLOCK,
|
||||
hpage_nr_pages(page));
|
||||
count_vm_event(UNEVICTABLE_PGMLOCKED);
|
||||
}
|
||||
add_page_to_unevictable_list(page);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue