lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b9ff2df8-e9d5-9572-c1b0-03c3a0608fb5@huawei.com>
Date:   Tue, 8 Jun 2021 09:41:10 +0800
From:   Miaohe Lin <linmiaohe@...wei.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
CC:     <sjenning@...hat.com>, <ddstreet@...e.org>,
        <linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>
Subject: Re: [PATCH 1/2] mm/zbud: reuse unbuddied[0] as buddied in zbud_pool

On 2021/6/8 7:10, Andrew Morton wrote:
> On Sat, 5 Jun 2021 15:51:40 +0800 Miaohe Lin <linmiaohe@...wei.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!

> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ