linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/mlock: Use vma_lookup() instead of find_vma()
@ 2022-03-14 15:17 Miaohe Lin
  2022-03-14 16:16 ` Matthew Wilcox
  0 siblings, 1 reply; 5+ messages in thread
From: Miaohe Lin @ 2022-03-14 15:17 UTC (permalink / raw)
  To: akpm, hughd; +Cc: linux-mm, linux-kernel, linmiaohe

Using vma_lookup() verifies the start is contained in the found vma. This
results in easier to read the code.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/mlock.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/mlock.c b/mm/mlock.c
index efd2dd2943de..fefa9644d0f9 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -453,8 +453,8 @@ static int apply_vma_lock_flags(unsigned long start, size_t len,
 		return -EINVAL;
 	if (end == start)
 		return 0;
-	vma = find_vma(current->mm, start);
-	if (!vma || vma->vm_start > start)
+	vma = vma_lookup(current->mm, start);
+	if (!vma)
 		return -ENOMEM;
 
 	prev = vma->vm_prev;
-- 
2.23.0


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

* Re: [PATCH] mm/mlock: Use vma_lookup() instead of find_vma()
  2022-03-14 15:17 [PATCH] mm/mlock: Use vma_lookup() instead of find_vma() Miaohe Lin
@ 2022-03-14 16:16 ` Matthew Wilcox
  2022-03-15 12:24   ` Miaohe Lin
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew Wilcox @ 2022-03-14 16:16 UTC (permalink / raw)
  To: Miaohe Lin; +Cc: akpm, hughd, linux-mm, linux-kernel

On Mon, Mar 14, 2022 at 11:17:28PM +0800, Miaohe Lin wrote:
> Using vma_lookup() verifies the start is contained in the found vma. This
> results in easier to read the code.

This conflicts with the maple tree.

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

* Re: [PATCH] mm/mlock: Use vma_lookup() instead of find_vma()
  2022-03-14 16:16 ` Matthew Wilcox
@ 2022-03-15 12:24   ` Miaohe Lin
  2022-03-15 12:39     ` Matthew Wilcox
  0 siblings, 1 reply; 5+ messages in thread
From: Miaohe Lin @ 2022-03-15 12:24 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: akpm, hughd, linux-mm, linux-kernel

On 2022/3/15 0:16, Matthew Wilcox wrote:
> On Mon, Mar 14, 2022 at 11:17:28PM +0800, Miaohe Lin wrote:
>> Using vma_lookup() verifies the start is contained in the found vma. This
>> results in easier to read the code.
> 
> This conflicts with the maple tree.

IIUC, maple tree is the implementation detail of the vma and this patch
should not be conflict with it. But there might be some trival conflict.
Am I supposed to delay this patch until the maple tree's work is done?

Thanks.

> 
> .
> 


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

* Re: [PATCH] mm/mlock: Use vma_lookup() instead of find_vma()
  2022-03-15 12:24   ` Miaohe Lin
@ 2022-03-15 12:39     ` Matthew Wilcox
  2022-03-15 12:45       ` Miaohe Lin
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew Wilcox @ 2022-03-15 12:39 UTC (permalink / raw)
  To: Miaohe Lin; +Cc: akpm, hughd, linux-mm, linux-kernel

On Tue, Mar 15, 2022 at 08:24:04PM +0800, Miaohe Lin wrote:
> On 2022/3/15 0:16, Matthew Wilcox wrote:
> > On Mon, Mar 14, 2022 at 11:17:28PM +0800, Miaohe Lin wrote:
> >> Using vma_lookup() verifies the start is contained in the found vma. This
> >> results in easier to read the code.
> > 
> > This conflicts with the maple tree.
> 
> IIUC, maple tree is the implementation detail of the vma and this patch
> should not be conflict with it. But there might be some trival conflict.
> Am I supposed to delay this patch until the maple tree's work is done?

This function is rewritten as part of the maple tree patchset.
There's no point in merging it now, or later.

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

* Re: [PATCH] mm/mlock: Use vma_lookup() instead of find_vma()
  2022-03-15 12:39     ` Matthew Wilcox
@ 2022-03-15 12:45       ` Miaohe Lin
  0 siblings, 0 replies; 5+ messages in thread
From: Miaohe Lin @ 2022-03-15 12:45 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: akpm, hughd, linux-mm, linux-kernel

On 2022/3/15 20:39, Matthew Wilcox wrote:
> On Tue, Mar 15, 2022 at 08:24:04PM +0800, Miaohe Lin wrote:
>> On 2022/3/15 0:16, Matthew Wilcox wrote:
>>> On Mon, Mar 14, 2022 at 11:17:28PM +0800, Miaohe Lin wrote:
>>>> Using vma_lookup() verifies the start is contained in the found vma. This
>>>> results in easier to read the code.
>>>
>>> This conflicts with the maple tree.
>>
>> IIUC, maple tree is the implementation detail of the vma and this patch
>> should not be conflict with it. But there might be some trival conflict.
>> Am I supposed to delay this patch until the maple tree's work is done?
> 
> This function is rewritten as part of the maple tree patchset.
> There's no point in merging it now, or later.
> 

I see. Thanks for explanation.

> .
> 


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

end of thread, other threads:[~2022-03-15 12:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-14 15:17 [PATCH] mm/mlock: Use vma_lookup() instead of find_vma() Miaohe Lin
2022-03-14 16:16 ` Matthew Wilcox
2022-03-15 12:24   ` Miaohe Lin
2022-03-15 12:39     ` Matthew Wilcox
2022-03-15 12:45       ` Miaohe Lin

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