linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Miaohe Lin <linmiaohe@huawei.com>
Cc: <sjenning@redhat.com>, <ddstreet@ieee.org>,
	<linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>
Subject: Re: [PATCH 1/2] mm/zbud: reuse unbuddied[0] as buddied in zbud_pool
Date: Mon, 7 Jun 2021 16:10:10 -0700	[thread overview]
Message-ID: <20210607161010.94168ddc8128da6af1e45cea@linux-foundation.org> (raw)
In-Reply-To: <20210605075141.1359969-2-linmiaohe@huawei.com>

On Sat, 5 Jun 2021 15:51:40 +0800 Miaohe Lin <linmiaohe@huawei.com> wrote:

> Since commit 9d8c5b5284e4 ("mm: zbud: fix condition check on allocation
> size"), zbud_pool.unbuddied[0] is always unused. We can reuse it as buddied
> field to save some possible memory.
> 
> ...
>
> --- a/mm/zbud.c
> +++ b/mm/zbud.c
> @@ -96,7 +96,7 @@
>  struct zbud_pool {
>  	spinlock_t lock;
>  	struct list_head unbuddied[NCHUNKS];
> -	struct list_head buddied;
> +#define buddied unbuddied[0]
>  	struct list_head lru;
>  	u64 pages_nr;
>  	const struct zbud_ops *ops;

That looks a bit hacky.  Can we at least have a comment explaining
what's going on?

Would it be better to implement this with a union, rather than a #define?


  reply	other threads:[~2021-06-07 23:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-05  7:51 [PATCH 0/2] Cleanups for zbud Miaohe Lin
2021-06-05  7:51 ` [PATCH 1/2] mm/zbud: reuse unbuddied[0] as buddied in zbud_pool Miaohe Lin
2021-06-07 23:10   ` Andrew Morton [this message]
2021-06-08  1:41     ` Miaohe Lin
2021-06-05  7:51 ` [PATCH 2/2] mm/zbud: don't export any zbud API 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=20210607161010.94168ddc8128da6af1e45cea@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ddstreet@ieee.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sjenning@redhat.com \
    /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).