2020-06-26 13:55:03

by Wei Yang

[permalink] [raw]
Subject: [RESEND Patch v2 0/4] mm/mremap: cleanup move_page_tables() a little

move_page_tables() tries to move page table by PMD or PTE.

The root reason is if it tries to move PMD, both old and new range should be
PMD aligned. But current code calculate old range and new range separately.
This leads to some redundant check and calculation.

This cleanup tries to consolidate the range check in one place to reduce some
extra range handling.

v2:
* remove 3rd patch which doesn't work on ARM platform. Thanks report and
test from Dmitry Osipenko

Wei Yang (4):
mm/mremap: format the check in move_normal_pmd() same as
move_huge_pmd()
mm/mremap: it is sure to have enough space when extent meets
requirement
mm/mremap: calculate extent in one place
mm/mremap: start addresses are properly aligned

include/linux/huge_mm.h | 2 +-
mm/huge_memory.c | 8 +-------
mm/mremap.c | 17 ++++++-----------
3 files changed, 8 insertions(+), 19 deletions(-)

--
2.20.1 (Apple Git-117)


2020-06-26 13:56:23

by Wei Yang

[permalink] [raw]
Subject: [RESEND Patch v2 1/4] mm/mremap: format the check in move_normal_pmd() same as move_huge_pmd()

No functional change, just improve the readability and prepare for
following cleanup.

Signed-off-by: Wei Yang <[email protected]>
Tested-by: Dmitry Osipenko <[email protected]>
---
mm/mremap.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/mremap.c b/mm/mremap.c
index 5dd572d57ca9..97bf9a2a8bd5 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -200,8 +200,9 @@ static bool move_normal_pmd(struct vm_area_struct *vma, unsigned long old_addr,
struct mm_struct *mm = vma->vm_mm;
pmd_t pmd;

- if ((old_addr & ~PMD_MASK) || (new_addr & ~PMD_MASK)
- || old_end - old_addr < PMD_SIZE)
+ if ((old_addr & ~PMD_MASK) ||
+ (new_addr & ~PMD_MASK) ||
+ old_end - old_addr < PMD_SIZE)
return false;

/*
--
2.20.1 (Apple Git-117)

2020-07-06 10:07:58

by Kirill A. Shutemov

[permalink] [raw]
Subject: Re: [RESEND Patch v2 1/4] mm/mremap: format the check in move_normal_pmd() same as move_huge_pmd()

On Fri, Jun 26, 2020 at 09:52:13PM +0800, Wei Yang wrote:
> No functional change, just improve the readability and prepare for
> following cleanup.

It's pretty much redundant. It doesn't provide any meaningful
readability improvement. Please drop the patch.

--
Kirill A. Shutemov

2020-07-06 10:09:52

by Kirill A. Shutemov

[permalink] [raw]
Subject: Re: [RESEND Patch v2 0/4] mm/mremap: cleanup move_page_tables() a little

On Fri, Jun 26, 2020 at 09:52:12PM +0800, Wei Yang wrote:
> move_page_tables() tries to move page table by PMD or PTE.
>
> The root reason is if it tries to move PMD, both old and new range should be
> PMD aligned. But current code calculate old range and new range separately.
> This leads to some redundant check and calculation.
>
> This cleanup tries to consolidate the range check in one place to reduce some
> extra range handling.

The patchet looks good to me. I have few nits, but nothing substantial.

Acked-by: Kirill A. Shutemov <[email protected]>

--
Kirill A. Shutemov

2020-07-06 22:07:49

by Wei Yang

[permalink] [raw]
Subject: Re: [RESEND Patch v2 0/4] mm/mremap: cleanup move_page_tables() a little

On Mon, Jul 06, 2020 at 01:08:19PM +0300, Kirill A. Shutemov wrote:
>On Fri, Jun 26, 2020 at 09:52:12PM +0800, Wei Yang wrote:
>> move_page_tables() tries to move page table by PMD or PTE.
>>
>> The root reason is if it tries to move PMD, both old and new range should be
>> PMD aligned. But current code calculate old range and new range separately.
>> This leads to some redundant check and calculation.
>>
>> This cleanup tries to consolidate the range check in one place to reduce some
>> extra range handling.
>
>The patchet looks good to me. I have few nits, but nothing substantial.
>
>Acked-by: Kirill A. Shutemov <[email protected]>
>

Hi, Kirill

Thanks for your review.

Andrew,

Do you want me to send another version or you would like to adjust it
directly?

>--
> Kirill A. Shutemov

--
Wei Yang
Help you, Help me

2020-07-06 23:06:53

by Andrew Morton

[permalink] [raw]
Subject: Re: [RESEND Patch v2 0/4] mm/mremap: cleanup move_page_tables() a little

On Mon, 6 Jul 2020 22:06:48 +0000 Wei Yang <[email protected]> wrote:

> >The patchet looks good to me. I have few nits, but nothing substantial.
> >
> >Acked-by: Kirill A. Shutemov <[email protected]>
> >
>
> Hi, Kirill
>
> Thanks for your review.
>
> Andrew,
>
> Do you want me to send another version or you would like to adjust it
> directly?

Please resend?