From: Alexey Romanov <AVRomanov@sberdevices.ru>
To: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Minchan Kim <minchan@kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCHv2 1/3] zsmalloc: do not scan for allocated objects in empty zspage
Date: Mon, 26 Jun 2023 10:57:15 +0000 [thread overview]
Message-ID: <20230626105750.x7dxn7z4l6t4sicb@cab-wsm-0029881> (raw)
In-Reply-To: <20230624053120.643409-2-senozhatsky@chromium.org>
Hi,
On Sat, Jun 24, 2023 at 02:12:14PM +0900, Sergey Senozhatsky wrote:
> zspage migration can terminate as soon as it moves the last
> allocated object from the source zspage. Add a simple helper
> zspage_empty() that tests zspage ->inuse on each migration
> iteration.
>
> Suggested-by: Alexey Romanov <AVRomanov@sberdevices.ru>
> Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
> ---
> mm/zsmalloc.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> index 3f057970504e..5d60eaedc3b7 100644
> --- a/mm/zsmalloc.c
> +++ b/mm/zsmalloc.c
> @@ -1147,6 +1147,11 @@ static bool zspage_full(struct size_class *class, struct zspage *zspage)
> return get_zspage_inuse(zspage) == class->objs_per_zspage;
> }
>
> +static bool zspage_empty(struct zspage *zspage)
> +{
> + return get_zspage_inuse(zspage) == 0;
> +}
> +
> /**
> * zs_lookup_class_index() - Returns index of the zsmalloc &size_class
> * that hold objects of the provided size.
> @@ -1625,6 +1630,10 @@ static void migrate_zspage(struct zs_pool *pool, struct size_class *class,
> obj_idx++;
> record_obj(handle, free_obj);
> obj_free(class->size, used_obj);
> +
> + /* Stop if there are no more objects to migrate */
> + if (zspage_empty(get_zspage(s_page)))
> + break;
> }
>
> /* Remember last position in this iteration */
> --
> 2.41.0.162.gfafddb0af9-goog
>
not sure if I can keep this tag but,
Reviewed-by: Alexey Romanov <avromanov@sberdevices.ru>
--
Thank you,
Alexey
next prev parent reply other threads:[~2023-06-26 10:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-24 5:12 [PATCHv2 0/3] zsmalloc: small compaction improvements Sergey Senozhatsky
2023-06-24 5:12 ` [PATCHv2 1/3] zsmalloc: do not scan for allocated objects in empty zspage Sergey Senozhatsky
2023-06-26 10:57 ` Alexey Romanov [this message]
2023-07-01 10:39 ` Sergey Senozhatsky
2023-06-26 17:13 ` Minchan Kim
2023-06-24 5:12 ` [PATCHv2 2/3] zsmalloc: move migration destination zspage inuse check Sergey Senozhatsky
2023-06-26 17:13 ` Minchan Kim
2023-06-24 5:12 ` [PATCHv2 3/3] zsmalloc: remove zs_compact_control Sergey Senozhatsky
2023-06-25 6:10 ` Sergey Senozhatsky
2023-06-26 17:14 ` Minchan Kim
2023-07-01 11:06 ` Sergey Senozhatsky
2023-07-05 13:28 ` [PATCHv2 0/3] zsmalloc: small compaction improvements Sergey Senozhatsky
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=20230626105750.x7dxn7z4l6t4sicb@cab-wsm-0029881 \
--to=avromanov@sberdevices.ru \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=senozhatsky@chromium.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