Skip to contentSkip to conversation

rename is_mlocked_vma() to mlocked_vma_newpage()

PATCH In review Ying Han 5 participants 6 messages Apr 25, 2012 – Apr 26, 2012

Subsystems (4)
lore
Share & tools
lore

Ying Han

author
#0 lore raw

PATCH 1/1 rename is_mlocked_vma() to mlocked_vma_newpage()

Andrew pointed out that the is_mlocked_vma() is misnamed. A function with name like that would expect bool return and no side-effects.

Since it is called on the fault path for new page, rename it in this patch.

---
 mm/internal.h |    5 +++--
 mm/vmscan.c   |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
mm/internal.h +3 -2
index 2189af4..a935af3 100644
@@ -131,7 +131,8 @@ static inline void munlock_vma_pages_all(struct vm_area_struct *vma)
  * to determine if it's being mapped into a LOCKED vma.
  * If so, mark page as mlocked.
  */
-static inline int is_mlocked_vma(struct vm_area_struct *vma, struct page *page)
+static inline int mlock_vma_newpage(struct vm_area_struct *vma,
+				    struct page *page)
 {
 	VM_BUG_ON(PageLRU(page));
 
@@ -189,7 +190,7 @@ extern unsigned long vma_address(struct page *page,
 				 struct vm_area_struct *vma);
 #endif
 #else /* !CONFIG_MMU */
-static inline int is_mlocked_vma(struct vm_area_struct *v, struct page *p)
+static inline int mlock_vma_newpage(struct vm_area_struct *v, struct page *p)
 {
 	return 0;
 }
mm/vmscan.c +1 -1
index 1a51868..686c63e 100644
@@ -3531,7 +3531,7 @@ int page_evictable(struct page *page, struct vm_area_struct *vma)
 	if (mapping_unevictable(page_mapping(page)))
 		return 0;
 
-	if (PageMlocked(page) || (vma && is_mlocked_vma(vma, page)))
+	if (PageMlocked(page) || (vma && mlock_vma_newpage(vma, page)))
 		return 0;
 
 	return 1;
Signature · 8 lines
1.7.7.3

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Ying Han

Andrew pointed out that the is_mlocked_vma() is misnamed. A function with name like that would expect bool return and no side-effects.

Since it is called on the fault path for new page, rename it in this patch.

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Acked-by on v1 1/1
#2 lore raw
In reply to Ying Han
Quoted 7 lines · Ying Han

Andrew pointed out that the is_mlocked_vma() is misnamed. A function with name like that would expect bool return and no side-effects.

Since it is called on the fault path for new page, rename it in this patch.

Good.

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Acked-by on v1 1/1
#3 lore raw
In reply to Ying Han
Quoted 7 lines · Ying Han

Andrew pointed out that the is_mlocked_vma() is misnamed. A function with name like that would expect bool return and no side-effects.

Since it is called on the fault path for new page, rename it in this patch.

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Reviewed-by on v1 1/1
#4 lore raw
In reply to Ying Han
Quoted 7 lines · Ying Han

Andrew pointed out that the is_mlocked_vma() is misnamed. A function with name like that would expect bool return and no side-effects.

Since it is called on the fault path for new page, rename it in this patch.

Nitpick:

mlocked_vma_newpage is better?
It seems I am a paranoic about naming. :-)
Feel free to ignore if you don't want.

Quoted 41 lines
---
 mm/internal.h |    5 +++--
 mm/vmscan.c   |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
mm/internal.h +3 -2
index 2189af4..a935af3 100644
@@ -131,7 +131,8 @@ static inline void munlock_vma_pages_all(struct vm_area_struct *vma)
  * to determine if it's being mapped into a LOCKED vma.
  * If so, mark page as mlocked.
  */
-static inline int is_mlocked_vma(struct vm_area_struct *vma, struct page *page)
+static inline int mlock_vma_newpage(struct vm_area_struct *vma,
+				    struct page *page)
 {
 	VM_BUG_ON(PageLRU(page));
 
@@ -189,7 +190,7 @@ extern unsigned long vma_address(struct page *page,
 				 struct vm_area_struct *vma);
 #endif
 #else /* !CONFIG_MMU */
-static inline int is_mlocked_vma(struct vm_area_struct *v, struct page *p)
+static inline int mlock_vma_newpage(struct vm_area_struct *v, struct page *p)
 {
 	return 0;
 }
mm/vmscan.c +1 -1
index 1a51868..686c63e 100644
@@ -3531,7 +3531,7 @@ int page_evictable(struct page *page, struct vm_area_struct *vma)
 	if (mapping_unevictable(page_mapping(page)))
 		return 0;
 
-	if (PageMlocked(page) || (vma && is_mlocked_vma(vma, page)))
+	if (PageMlocked(page) || (vma && mlock_vma_newpage(vma, page)))
 		return 0;
 
 	return 1;
Signature · 9 lines
Kind regards,
Minchan Kim

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#5 lore raw
Quoted 12 lines · Minchan Kim
Quoted 7 lines · Ying Han

Andrew pointed out that the is_mlocked_vma() is misnamed. A function with name like that would expect bool return and no side-effects.

Since it is called on the fault path for new page, rename it in this patch.

Quoted 7 lines

Nitpick:

mlocked_vma_newpage is better?
It seems I am a paranoic about naming. :-)
Feel free to ignore if you don't want.

Thanks, at least I see it is inconsistant to the title.

I will post another one

--Ying

Quoted 43 lines
Quoted 43 lines

---
 mm/internal.h |    5 +++--
 mm/vmscan.c   |    2 +-

 2 files changed, 4 insertions(+), 3 deletions(-)
mm/internal.h +3 -2
index 2189af4..a935af3 100644
@@ -131,7 +131,8 @@ static inline void munlock_vma_pages_all(struct vm_area_struct *vma)
   * to determine if it's being mapped into a LOCKED vma.
   * If so, mark page as mlocked.
   */
-static inline int is_mlocked_vma(struct vm_area_struct *vma, struct page *page)
+static inline int mlock_vma_newpage(struct vm_area_struct *vma,
+                                 struct page *page)
  {
       VM_BUG_ON(PageLRU(page));
 
@@ -189,7 +190,7 @@ extern unsigned long vma_address(struct page *page,
                                struct vm_area_struct *vma);
  #endif
  #else /* !CONFIG_MMU */
-static inline int is_mlocked_vma(struct vm_area_struct *v, struct page *p)
+static inline int mlock_vma_newpage(struct vm_area_struct *v, struct page *p)
  {
       return 0;
  }
mm/vmscan.c +1 -1
index 1a51868..686c63e 100644
@@ -3531,7 +3531,7 @@ int page_evictable(struct page *page, struct vm_area_struct *vma)
       if (mapping_unevictable(page_mapping(page)))
               return 0;
 
-     if (PageMlocked(page) || (vma && is_mlocked_vma(vma, page)))
+     if (PageMlocked(page) || (vma && mlock_vma_newpage(vma, page)))
               return 0;
 
Quoted 7 lines

mm/vmscan.c int page_evictable(struct page *page, struct vm_area_struct *vma) · line 3537

Quoted 1 line
mm/vmscan.c +0 -0
       return 1;

--
Kind regards,
Minchan Kim

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>