linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rename is_mlocked_vma() to mlocked_vma_newpage()
@ 2012-04-25 17:45 Ying Han
  2012-04-25 18:05 ` Rik van Riel
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Ying Han @ 2012-04-25 17:45 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki, Rik van Riel, Andrew Morton; +Cc: linux-mm

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.

Signed-off-by: Ying Han <yinghan@google.com>
---
 mm/internal.h |    5 +++--
 mm/vmscan.c   |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/mm/internal.h b/mm/internal.h
index 2189af4..a935af3 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -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;
 }
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 1a51868..686c63e 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -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;
-- 
1.7.7.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  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:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] rename is_mlocked_vma() to mlocked_vma_newpage()
  2012-04-25 17:45 [PATCH] rename is_mlocked_vma() to mlocked_vma_newpage() Ying Han
@ 2012-04-25 18:05 ` Rik van Riel
  2012-04-25 18:54 ` KOSAKI Motohiro
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Rik van Riel @ 2012-04-25 18:05 UTC (permalink / raw)
  To: Ying Han; +Cc: KAMEZAWA Hiroyuki, Andrew Morton, linux-mm

On 04/25/2012 01:45 PM, Ying Han wrote:
> 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.
>
> Signed-off-by: Ying Han<yinghan@google.com>

Reviewed-by: Rik van Riel <riel@redhat.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  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:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] rename is_mlocked_vma() to mlocked_vma_newpage()
  2012-04-25 17:45 [PATCH] rename is_mlocked_vma() to mlocked_vma_newpage() Ying Han
  2012-04-25 18:05 ` Rik van Riel
@ 2012-04-25 18:54 ` KOSAKI Motohiro
  2012-04-26  0:03 ` KAMEZAWA Hiroyuki
  2012-04-26  5:17 ` Minchan Kim
  3 siblings, 0 replies; 6+ messages in thread
From: KOSAKI Motohiro @ 2012-04-25 18:54 UTC (permalink / raw)
  To: Ying Han
  Cc: KAMEZAWA Hiroyuki, Rik van Riel, Andrew Morton, linux-mm,
	kosaki.motohiro

(4/25/12 1:45 PM), Ying Han wrote:
> 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.
> 
> Signed-off-by: Ying Han<yinghan@google.com>

Good.
 Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  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:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] rename is_mlocked_vma() to mlocked_vma_newpage()
  2012-04-25 17:45 [PATCH] rename is_mlocked_vma() to mlocked_vma_newpage() Ying Han
  2012-04-25 18:05 ` Rik van Riel
  2012-04-25 18:54 ` KOSAKI Motohiro
@ 2012-04-26  0:03 ` KAMEZAWA Hiroyuki
  2012-04-26  5:17 ` Minchan Kim
  3 siblings, 0 replies; 6+ messages in thread
From: KAMEZAWA Hiroyuki @ 2012-04-26  0:03 UTC (permalink / raw)
  To: Ying Han; +Cc: Rik van Riel, Andrew Morton, linux-mm

(2012/04/26 2:45), Ying Han wrote:

> 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.
> 
> Signed-off-by: Ying Han <yinghan@google.com>


Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujtisu.com>


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  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:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] rename is_mlocked_vma() to mlocked_vma_newpage()
  2012-04-25 17:45 [PATCH] rename is_mlocked_vma() to mlocked_vma_newpage() Ying Han
                   ` (2 preceding siblings ...)
  2012-04-26  0:03 ` KAMEZAWA Hiroyuki
@ 2012-04-26  5:17 ` Minchan Kim
  2012-04-26 17:50   ` Ying Han
  3 siblings, 1 reply; 6+ messages in thread
From: Minchan Kim @ 2012-04-26  5:17 UTC (permalink / raw)
  To: Ying Han; +Cc: KAMEZAWA Hiroyuki, Rik van Riel, Andrew Morton, linux-mm

On 04/26/2012 02:45 AM, Ying Han wrote:

> 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.
> 
> Signed-off-by: Ying Han <yinghan@google.com>



Reviewed-by: Minchan Kim <minchan@kernel.org>

Nitpick:

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



> ---
>  mm/internal.h |    5 +++--
>  mm/vmscan.c   |    2 +-
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/internal.h b/mm/internal.h
> index 2189af4..a935af3 100644
> --- a/mm/internal.h
> +++ b/mm/internal.h
> @@ -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;
>  }
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 1a51868..686c63e 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -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;



-- 
Kind regards,
Minchan Kim

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  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:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] rename is_mlocked_vma() to mlocked_vma_newpage()
  2012-04-26  5:17 ` Minchan Kim
@ 2012-04-26 17:50   ` Ying Han
  0 siblings, 0 replies; 6+ messages in thread
From: Ying Han @ 2012-04-26 17:50 UTC (permalink / raw)
  To: Minchan Kim; +Cc: KAMEZAWA Hiroyuki, Rik van Riel, Andrew Morton, linux-mm

On Wed, Apr 25, 2012 at 10:17 PM, Minchan Kim <minchan@kernel.org> wrote:
> On 04/26/2012 02:45 AM, Ying Han wrote:
>
>> 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.
>>
>> Signed-off-by: Ying Han <yinghan@google.com>
>
>
>
> Reviewed-by: Minchan Kim <minchan@kernel.org>
>
> 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

>
>
>
>> ---
>>  mm/internal.h |    5 +++--
>>  mm/vmscan.c   |    2 +-
>>  2 files changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/mm/internal.h b/mm/internal.h
>> index 2189af4..a935af3 100644
>> --- a/mm/internal.h
>> +++ b/mm/internal.h
>> @@ -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;
>>  }
>> diff --git a/mm/vmscan.c b/mm/vmscan.c
>> index 1a51868..686c63e 100644
>> --- a/mm/vmscan.c
>> +++ b/mm/vmscan.c
>> @@ -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;
>
>
>
> --
> Kind regards,
> Minchan Kim

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  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:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-04-26 17:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-25 17:45 [PATCH] rename is_mlocked_vma() to mlocked_vma_newpage() Ying Han
2012-04-25 18:05 ` Rik van Riel
2012-04-25 18:54 ` KOSAKI Motohiro
2012-04-26  0:03 ` KAMEZAWA Hiroyuki
2012-04-26  5:17 ` Minchan Kim
2012-04-26 17:50   ` Ying Han

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).