2022-06-11 09:23:48

by Miaohe Lin

[permalink] [raw]
Subject: [PATCH 6/7] mm/khugepaged: remove unneeded return value of khugepaged_add_pte_mapped_thp()

The return value of khugepaged_add_pte_mapped_thp() is always 0 and also
ignored. Remove it to clean up the code.

Signed-off-by: Miaohe Lin <[email protected]>
---
mm/khugepaged.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 142e26e4bdbf..ee0a719c8be9 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -1372,7 +1372,7 @@ static void collect_mm_slot(struct mm_slot *mm_slot)
* Notify khugepaged that given addr of the mm is pte-mapped THP. Then
* khugepaged should try to collapse the page table.
*/
-static int khugepaged_add_pte_mapped_thp(struct mm_struct *mm,
+static void khugepaged_add_pte_mapped_thp(struct mm_struct *mm,
unsigned long addr)
{
struct mm_slot *mm_slot;
@@ -1384,7 +1384,6 @@ static int khugepaged_add_pte_mapped_thp(struct mm_struct *mm,
if (likely(mm_slot && mm_slot->nr_pte_mapped_thp < MAX_PTE_MAPPED_THP))
mm_slot->pte_mapped_thp[mm_slot->nr_pte_mapped_thp++] = addr;
spin_unlock(&khugepaged_mm_lock);
- return 0;
}

static void collapse_and_free_pmd(struct mm_struct *mm, struct vm_area_struct *vma,
--
2.23.0


2022-06-15 00:31:00

by Zach O'Keefe

[permalink] [raw]
Subject: Re: [PATCH 6/7] mm/khugepaged: remove unneeded return value of khugepaged_add_pte_mapped_thp()

On 11 Jun 16:47, Miaohe Lin wrote:
> The return value of khugepaged_add_pte_mapped_thp() is always 0 and also
> ignored. Remove it to clean up the code.
>
> Signed-off-by: Miaohe Lin <[email protected]>
> ---
> mm/khugepaged.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> index 142e26e4bdbf..ee0a719c8be9 100644
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
> @@ -1372,7 +1372,7 @@ static void collect_mm_slot(struct mm_slot *mm_slot)
> * Notify khugepaged that given addr of the mm is pte-mapped THP. Then
> * khugepaged should try to collapse the page table.
> */
> -static int khugepaged_add_pte_mapped_thp(struct mm_struct *mm,
> +static void khugepaged_add_pte_mapped_thp(struct mm_struct *mm,
> unsigned long addr)

Since this is a cleanup, should keep the second param aligned with opening
bracket to satisfy checkpatch.

Otherwise can add Reviewed-by: Zach O'Keefe <[email protected]>

> {
> struct mm_slot *mm_slot;
> @@ -1384,7 +1384,6 @@ static int khugepaged_add_pte_mapped_thp(struct mm_struct *mm,
> if (likely(mm_slot && mm_slot->nr_pte_mapped_thp < MAX_PTE_MAPPED_THP))
> mm_slot->pte_mapped_thp[mm_slot->nr_pte_mapped_thp++] = addr;
> spin_unlock(&khugepaged_mm_lock);
> - return 0;
> }
>
> static void collapse_and_free_pmd(struct mm_struct *mm, struct vm_area_struct *vma,
> --
> 2.23.0
>
>

2022-06-15 22:12:38

by Yang Shi

[permalink] [raw]
Subject: Re: [PATCH 6/7] mm/khugepaged: remove unneeded return value of khugepaged_add_pte_mapped_thp()

On Sat, Jun 11, 2022 at 1:47 AM Miaohe Lin <[email protected]> wrote:
>
> The return value of khugepaged_add_pte_mapped_thp() is always 0 and also
> ignored. Remove it to clean up the code.
>
> Signed-off-by: Miaohe Lin <[email protected]>

Reviewed-by: Yang Shi <[email protected]>

> ---
> mm/khugepaged.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> index 142e26e4bdbf..ee0a719c8be9 100644
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
> @@ -1372,7 +1372,7 @@ static void collect_mm_slot(struct mm_slot *mm_slot)
> * Notify khugepaged that given addr of the mm is pte-mapped THP. Then
> * khugepaged should try to collapse the page table.
> */
> -static int khugepaged_add_pte_mapped_thp(struct mm_struct *mm,
> +static void khugepaged_add_pte_mapped_thp(struct mm_struct *mm,
> unsigned long addr)
> {
> struct mm_slot *mm_slot;
> @@ -1384,7 +1384,6 @@ static int khugepaged_add_pte_mapped_thp(struct mm_struct *mm,
> if (likely(mm_slot && mm_slot->nr_pte_mapped_thp < MAX_PTE_MAPPED_THP))
> mm_slot->pte_mapped_thp[mm_slot->nr_pte_mapped_thp++] = addr;
> spin_unlock(&khugepaged_mm_lock);
> - return 0;
> }
>
> static void collapse_and_free_pmd(struct mm_struct *mm, struct vm_area_struct *vma,
> --
> 2.23.0
>
>