linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/hugetlb: use helper function range_in_vma() in page_table_shareable()
@ 2021-02-04 11:29 Miaohe Lin
  2021-02-04 21:37 ` Mike Kravetz
  0 siblings, 1 reply; 2+ messages in thread
From: Miaohe Lin @ 2021-02-04 11:29 UTC (permalink / raw)
  To: akpm, mike.kravetz; +Cc: linux-mm, linux-kernel, linmiaohe

We could use helper function range_in_vma() to check whether the vma is in
the desired range to simplify the code.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/hugetlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index cf82629319ed..442705be052a 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -5237,7 +5237,7 @@ static unsigned long page_table_shareable(struct vm_area_struct *svma,
 	 */
 	if (pmd_index(addr) != pmd_index(saddr) ||
 	    vm_flags != svm_flags ||
-	    sbase < svma->vm_start || svma->vm_end < s_end)
+	    !range_in_vma(svma, sbase, s_end))
 		return 0;
 
 	return saddr;
-- 
2.19.1


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

* Re: [PATCH] mm/hugetlb: use helper function range_in_vma() in page_table_shareable()
  2021-02-04 11:29 [PATCH] mm/hugetlb: use helper function range_in_vma() in page_table_shareable() Miaohe Lin
@ 2021-02-04 21:37 ` Mike Kravetz
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Kravetz @ 2021-02-04 21:37 UTC (permalink / raw)
  To: Miaohe Lin, akpm; +Cc: linux-mm, linux-kernel

On 2/4/21 3:29 AM, Miaohe Lin wrote:
> We could use helper function range_in_vma() to check whether the vma is in
> the desired range to simplify the code.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>  mm/hugetlb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks,

Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>

-- 
Mike Kravetz

> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index cf82629319ed..442705be052a 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -5237,7 +5237,7 @@ static unsigned long page_table_shareable(struct vm_area_struct *svma,
>  	 */
>  	if (pmd_index(addr) != pmd_index(saddr) ||
>  	    vm_flags != svm_flags ||
> -	    sbase < svma->vm_start || svma->vm_end < s_end)
> +	    !range_in_vma(svma, sbase, s_end))
>  		return 0;
>  
>  	return saddr;
> 

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

end of thread, other threads:[~2021-02-04 21:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04 11:29 [PATCH] mm/hugetlb: use helper function range_in_vma() in page_table_shareable() Miaohe Lin
2021-02-04 21:37 ` Mike Kravetz

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).