linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: Andrew Morton <akpm@linux-foundation.org>
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: Tue, 8 Jun 2021 09:41:10 +0800	[thread overview]
Message-ID: <b9ff2df8-e9d5-9572-c1b0-03c3a0608fb5@huawei.com> (raw)
In-Reply-To: <20210607161010.94168ddc8128da6af1e45cea@linux-foundation.org>

On 2021/6/8 7:10, Andrew Morton wrote:
> 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?

It seems union is better and comment is necessary. Will try to do this.
Many thanks for your comment and reply!

> .
> 



  reply	other threads:[~2021-06-08  1:41 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
2021-06-08  1:41     ` Miaohe Lin [this message]
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=b9ff2df8-e9d5-9572-c1b0-03c3a0608fb5@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=ddstreet@ieee.org \
    --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