Skip to contentSkip to conversation

mm: use a irq-safe __mod_zone_page_state in mlocked_vma_newpage()

PATCH In review Jianyu Zhan 2 participants 2 messages May 9, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: use a irq-safe __mod_zone_page_state in mlocked_vma_newpage()

mlocked_vma_newpage() is only called in fault path by page_add_new_anon_rmap(), which is called on a *new* page. And such page is initially only visible via the pagetables, and the pte is locked while calling page_add_new_anon_rmap(), so we could use a irq-safe version of __mod_zone_page_state() here.

---
 mm/internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/internal.h +1 -1
index 07b6736..69079b1 100644
@@ -196,7 +196,7 @@ static inline int mlocked_vma_newpage(struct vm_area_struct *vma,
 		return 0;
 
 	if (!TestSetPageMlocked(page)) {
-		mod_zone_page_state(page_zone(page), NR_MLOCK,
+		__mod_zone_page_state(page_zone(page), NR_MLOCK,
 				    hpage_nr_pages(page));
 		count_vm_event(UNEVICTABLE_PGMLOCKED);
 	}
Signature · 7 lines
2.0.0-rc1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw
Quoted 5 lines · Jianyu Zhan

mlocked_vma_newpage() is only called in fault path by page_add_new_anon_rmap(), which is called on a *new* page. And such page is initially only visible via the pagetables, and the pte is locked while calling page_add_new_anon_rmap(), so we could use a irq-safe version of __mod_zone_page_state() here.

You are changing from the irq safe variant to __mod_zone_page_state which is *not* irq safe. Its legit to do so since presumably irqs are disabled anyways so you do not have to worry about irq safeness of __mod_zone_page_state.

Please update the description. Its a bit confusing right now.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>