From: Uladzislau Rezki <urezki@gmail.com>
To: Hongbo Li <lihongbo22@huawei.com>
Cc: akpm@linux-foundation.org, urezki@gmail.com, hch@infradead.org,
linux-mm@kvack.org
Subject: Re: [PATCH -next v2] mm: make use of the helper macro LIST_HEAD()
Date: Wed, 28 Aug 2024 11:22:37 +0200 [thread overview]
Message-ID: <Zs7sXbID8iVCx33g@pc636> (raw)
In-Reply-To: <20240828041216.1222582-1-lihongbo22@huawei.com>
On Wed, Aug 28, 2024 at 12:12:16PM +0800, Hongbo Li wrote:
> list_head can be initialized automatically with LIST_HEAD()
> instead of calling INIT_LIST_HEAD(). Here we can simplify
> the code.
>
> Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
>
> ---
> - v2:
> - Also adjust decay_list according to Uladzislau's suggestion.
>
> - v1: https://lore.kernel.org/linux-mm/20240827015724.620110-1-lihongbo22@huawei.com/T/
> ---
> mm/vmalloc.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 3f9b6bd707d2..6fc736f74ae7 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -2131,23 +2131,18 @@ reclaim_list_global(struct list_head *head)
> static void
> decay_va_pool_node(struct vmap_node *vn, bool full_decay)
> {
> + LIST_HEAD(decay_list);
> + struct rb_root decay_root = RB_ROOT;
> struct vmap_area *va, *nva;
> - struct list_head decay_list;
> - struct rb_root decay_root;
> unsigned long n_decay;
> int i;
>
> - decay_root = RB_ROOT;
> - INIT_LIST_HEAD(&decay_list);
> -
> for (i = 0; i < MAX_VA_SIZE_PAGES; i++) {
> - struct list_head tmp_list;
> + LIST_HEAD(tmp_list);
>
> if (list_empty(&vn->pool[i].head))
> continue;
>
> - INIT_LIST_HEAD(&tmp_list);
> -
> /* Detach the pool, so no-one can access it. */
> spin_lock(&vn->pool_lock);
> list_replace_init(&vn->pool[i].head, &tmp_list);
> --
> 2.34.1
>
Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
--
Uladzislau Rezki
prev parent reply other threads:[~2024-08-28 9:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-28 4:12 [PATCH -next v2] mm: make use of the helper macro LIST_HEAD() Hongbo Li
2024-08-28 9:22 ` Uladzislau Rezki [this message]
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=Zs7sXbID8iVCx33g@pc636 \
--to=urezki@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hch@infradead.org \
--cc=lihongbo22@huawei.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.