linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vitaly Wool <vitaly.wool@konsulko.com>
To: Miaohe Lin <linmiaohe@huawei.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Linux-MM <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 9/9] mm/z3fold: remove unneeded return value of z3fold_compact_page()
Date: Wed, 2 Mar 2022 09:40:49 +0100	[thread overview]
Message-ID: <CAM4kBBK_a_2d5f7=OF2euGacnGoKM-8oVu0uQ86cTMvuAtPuPA@mail.gmail.com> (raw)
In-Reply-To: <20220219092533.12596-10-linmiaohe@huawei.com>

On Sat, Feb 19, 2022 at 10:26 AM Miaohe Lin <linmiaohe@huawei.com> wrote:
>
> Remove the unneeded return value of z3fold_compact_page() as it's
> never checked.

It was a sort of hook for gathering extended compaction statistics in
future. Do you really gain a lot by removing this?

~Vitaly

> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>  mm/z3fold.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/mm/z3fold.c b/mm/z3fold.c
> index 83b5a3514427..db41b4227ec7 100644
> --- a/mm/z3fold.c
> +++ b/mm/z3fold.c
> @@ -746,18 +746,18 @@ static struct z3fold_header *compact_single_buddy(struct z3fold_header *zhdr)
>
>  #define BIG_CHUNK_GAP  3
>  /* Has to be called with lock held */
> -static int z3fold_compact_page(struct z3fold_header *zhdr)
> +static void z3fold_compact_page(struct z3fold_header *zhdr)
>  {
>         struct page *page = virt_to_page(zhdr);
>
>         if (test_bit(MIDDLE_CHUNK_MAPPED, &page->private))
> -               return 0; /* can't move middle chunk, it's used */
> +               return; /* can't move middle chunk, it's used */
>
>         if (unlikely(PageIsolated(page)))
> -               return 0;
> +               return;
>
>         if (zhdr->middle_chunks == 0)
> -               return 0; /* nothing to compact */
> +               return; /* nothing to compact */
>
>         if (zhdr->first_chunks == 0 && zhdr->last_chunks == 0) {
>                 /* move to the beginning */
> @@ -766,7 +766,7 @@ static int z3fold_compact_page(struct z3fold_header *zhdr)
>                 zhdr->middle_chunks = 0;
>                 zhdr->start_middle = 0;
>                 zhdr->first_num++;
> -               return 1;
> +               return;
>         }
>
>         /*
> @@ -778,7 +778,6 @@ static int z3fold_compact_page(struct z3fold_header *zhdr)
>                         BIG_CHUNK_GAP) {
>                 mchunk_memmove(zhdr, zhdr->first_chunks + ZHDR_CHUNKS);
>                 zhdr->start_middle = zhdr->first_chunks + ZHDR_CHUNKS;
> -               return 1;
>         } else if (zhdr->last_chunks != 0 && zhdr->first_chunks == 0 &&
>                    TOTAL_CHUNKS - (zhdr->last_chunks + zhdr->start_middle
>                                         + zhdr->middle_chunks) >=
> @@ -787,10 +786,7 @@ static int z3fold_compact_page(struct z3fold_header *zhdr)
>                         zhdr->middle_chunks;
>                 mchunk_memmove(zhdr, new_start);
>                 zhdr->start_middle = new_start;
> -               return 1;
>         }
> -
> -       return 0;
>  }
>
>  static void do_compact_page(struct z3fold_header *zhdr, bool locked)
> --
> 2.23.0
>

  parent reply	other threads:[~2022-03-02  8:41 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-19  9:25 [PATCH 0/9] A few cleanup patches for z3fold Miaohe Lin
2022-02-19  9:25 ` [PATCH 1/9] mm/z3fold: declare z3fold_mount with __init Miaohe Lin
2022-03-02  8:17   ` Vitaly Wool
2022-02-19  9:25 ` [PATCH 2/9] mm/z3fold: remove obsolete comment in z3fold_alloc Miaohe Lin
2022-03-02  8:18   ` Vitaly Wool
2022-02-19  9:25 ` [PATCH 3/9] mm/z3fold: minor clean up for z3fold_free Miaohe Lin
2022-03-02  8:21   ` Vitaly Wool
2022-02-19  9:25 ` [PATCH 4/9] mm/z3fold: remove unneeded page_mapcount_reset and ClearPagePrivate Miaohe Lin
2022-03-02  8:22   ` Vitaly Wool
2022-02-19  9:25 ` [PATCH 5/9] mm/z3fold: remove confusing local variable l reassignment Miaohe Lin
2022-03-02  8:24   ` Vitaly Wool
2022-02-19  9:25 ` [PATCH 6/9] mm/z3fold: move decrement of pool->pages_nr into __release_z3fold_page() Miaohe Lin
2022-02-19 16:33   ` David Laight
2022-02-21  2:53     ` Miaohe Lin
2022-02-21  5:17       ` David Laight
2022-02-21 11:37         ` Miaohe Lin
2022-03-02  8:31         ` Vitaly Wool
2022-03-02  9:12           ` David Laight
2022-03-02 10:19             ` Vitaly Wool
2022-03-03  2:27               ` Miaohe Lin
2022-02-19  9:25 ` [PATCH 7/9] mm/z3fold: remove redundant list_del_init of zhdr->buddy in z3fold_free Miaohe Lin
2022-03-02  8:38   ` Vitaly Wool
2022-02-19  9:25 ` [PATCH 8/9] mm/z3fold: remove unneeded PAGE_HEADLESS check in free_handle() Miaohe Lin
2022-02-19  9:25 ` [PATCH 9/9] mm/z3fold: remove unneeded return value of z3fold_compact_page() Miaohe Lin
2022-02-19 20:37   ` Souptick Joarder
2022-03-02  8:40   ` Vitaly Wool [this message]
2022-03-02  8:56     ` Miaohe Lin
2022-03-01 13:03 ` [PATCH 0/9] A few cleanup patches for z3fold Miaohe Lin
2022-03-01 17:36   ` Andrew Morton
2022-03-02  1:54     ` Miaohe Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAM4kBBK_a_2d5f7=OF2euGacnGoKM-8oVu0uQ86cTMvuAtPuPA@mail.gmail.com' \
    --to=vitaly.wool@konsulko.com \
    --cc=akpm@linux-foundation.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).