mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
mm: use the light version __mod_zone_page_state in mlocked_vma_newpage()
mlocked_vma_newpage() is called with pte lock held(a spinlock), which implies preemtion disabled, and the vm stat counter is not modified from interrupt context, so we need not use an irq-safe mod_zone_page_state() here, using a light-weight version __mod_zone_page_state() would be OK. This patch also documents __mod_zone_page_state() and some of its callsites. The comment above __mod_zone_page_state() is from Hugh Dickins, and acked by Christoph. Most credits to Hugh and Christoph for the clarification on the usage of the __mod_zone_page_state(). [[email protected]: coding-style fixes] Suggested-by: Andrew Morton <[email protected]> Acked-by: Hugh Dickins <[email protected]> Signed-off-by: Jianyu Zhan <[email protected]> Reviewed-by: Christoph Lameter <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
e9ade56991
commit
bea04b0732
3 changed files with 20 additions and 2 deletions
11
mm/rmap.c
11
mm/rmap.c
|
|
@ -988,6 +988,12 @@ void do_page_add_anon_rmap(struct page *page,
|
|||
{
|
||||
int first = atomic_inc_and_test(&page->_mapcount);
|
||||
if (first) {
|
||||
/*
|
||||
* We use the irq-unsafe __{inc|mod}_zone_page_stat because
|
||||
* these counters are not modified in interrupt context, and
|
||||
* pte lock(a spinlock) is held, which implies preemption
|
||||
* disabled.
|
||||
*/
|
||||
if (PageTransHuge(page))
|
||||
__inc_zone_page_state(page,
|
||||
NR_ANON_TRANSPARENT_HUGEPAGES);
|
||||
|
|
@ -1079,6 +1085,11 @@ void page_remove_rmap(struct page *page)
|
|||
/*
|
||||
* Hugepages are not counted in NR_ANON_PAGES nor NR_FILE_MAPPED
|
||||
* and not charged by memcg for now.
|
||||
*
|
||||
* We use the irq-unsafe __{inc|mod}_zone_page_stat because
|
||||
* these counters are not modified in interrupt context, and
|
||||
* these counters are not modified in interrupt context, and
|
||||
* pte lock(a spinlock) is held, which implies preemption disabled.
|
||||
*/
|
||||
if (unlikely(PageHuge(page)))
|
||||
goto out;
|
||||
|
|
|
|||
Loading…
Reference in a new issue