[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZlAEDbOR6Ch-Y__C@casper.infradead.org>
Date: Fri, 24 May 2024 04:05:49 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Jung-JaeJoon <rgbi3307@...il.com>
Cc: "Liam R. Howlett" <Liam.Howlett@...cle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Peng Zhang <zhangpeng.00@...edance.com>,
maple-tree@...ts.infradead.org, linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Modified XArray entry bit flags as macro constants
On Fri, May 24, 2024 at 11:49:45AM +0900, Jung-JaeJoon wrote:
> From: Jung-JaeJoon <rgbi3307@...il.com>
>
> It would be better to modify the operation on the last two bits of the entry
> with a macro constant name rather than using a numeric constant.
>
> #define XA_VALUE_ENTRY 1UL
> #define XA_INTERNAL_ENTRY 2UL
> #define XA_POINTER_ENTRY 3UL
>
> In particular, in the xa_to_node() function, it is more consistent and efficient
> to perform a logical AND operation as shown below than a subtraction operation.
>
> - return (struct xa_node *)((unsigned long)entry - 2);
> + return (struct xa_node *)((unsigned long)entry & ~XA_INTERNAL_ENTRY);
>
> Additionally, it is better to modify the if condition below
> in the mas_store_root() function of lib/maple_tree.c to the xa_is_internal() inline function.
>
> - else if (((unsigned long) (entry) & 3) == 2)
> + else if (xa_is_internal(entry))
>
> And there is no reason to declare XA_CHECK_SCHED as an enum data type.
> -enum {
> - XA_CHECK_SCHED = 4096,
> -};
> +#define XA_CHECK_SCHED 4096
Thank you for your patch. I agree with none of this. Rejected.
Powered by blists - more mailing lists