lkml.org 
[lkml]   [2021]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] mm/zbud: reuse unbuddied[0] as buddied in zbud_pool
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?

\
 
 \ /
  Last update: 2021-06-08 01:10    [W:0.073 / U:1.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site