aboutsummaryrefslogtreecommitdiffstats
path: root/mm/internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'mm/internal.h')
-rw-r--r--mm/internal.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/mm/internal.h b/mm/internal.h
index 48e32f790571..1cfbf2e2bc9e 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -101,7 +101,10 @@ static inline int is_mlocked_vma(struct vm_area_struct *vma, struct page *page)
101 if (likely((vma->vm_flags & (VM_LOCKED | VM_SPECIAL)) != VM_LOCKED)) 101 if (likely((vma->vm_flags & (VM_LOCKED | VM_SPECIAL)) != VM_LOCKED))
102 return 0; 102 return 0;
103 103
104 SetPageMlocked(page); 104 if (!TestSetPageMlocked(page)) {
105 inc_zone_page_state(page, NR_MLOCK);
106 count_vm_event(UNEVICTABLE_PGMLOCKED);
107 }
105 return 1; 108 return 1;
106} 109}
107 110
@@ -128,12 +131,19 @@ static inline void clear_page_mlock(struct page *page)
128 131
129/* 132/*
130 * mlock_migrate_page - called only from migrate_page_copy() to 133 * mlock_migrate_page - called only from migrate_page_copy() to
131 * migrate the Mlocked page flag 134 * migrate the Mlocked page flag; update statistics.
132 */ 135 */
133static inline void mlock_migrate_page(struct page *newpage, struct page *page) 136static inline void mlock_migrate_page(struct page *newpage, struct page *page)
134{ 137{
135 if (TestClearPageMlocked(page)) 138 if (TestClearPageMlocked(page)) {
139 unsigned long flags;
140
141 local_irq_save(flags);
142 __dec_zone_page_state(page, NR_MLOCK);
136 SetPageMlocked(newpage); 143 SetPageMlocked(newpage);
144 __inc_zone_page_state(newpage, NR_MLOCK);
145 local_irq_restore(flags);
146 }
137} 147}
138 148
139 149