diff mbox series

[v2] mm: skip less than check for MAX_NR_ZONES

Message ID 20240819112628.372883-1-alexs@kernel.org (mailing list archive)
State New
Headers show
Series [v2] mm: skip less than check for MAX_NR_ZONES | expand

Commit Message

alexs@kernel.org Aug. 19, 2024, 11:26 a.m. UTC
From: Alex Shi <alexs@kernel.org>

Remove unnecessary '<' check for ZONES_SHIFT assignment.

Signed-off-by: Alex Shi <alexs@kernel.org>
Cc: linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>
---
 include/linux/page-flags-layout.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andrew Morton Aug. 20, 2024, 4:40 a.m. UTC | #1
On Mon, 19 Aug 2024 19:26:28 +0800 alexs@kernel.org wrote:

> From: Alex Shi <alexs@kernel.org>
> 
> Remove unnecessary '<' check for ZONES_SHIFT assignment.
> 
> ...
>
> --- a/include/linux/page-flags-layout.h
> +++ b/include/linux/page-flags-layout.h
> @@ -14,7 +14,7 @@
>   */
>  #if MAX_NR_ZONES < 2
>  #define ZONES_SHIFT 0
> -#elif MAX_NR_ZONES <= 2
> +#elif MAX_NR_ZONES == 2
>  #define ZONES_SHIFT 1
>  #elif MAX_NR_ZONES <= 4
>  #define ZONES_SHIFT 2

mmm, why.  I think it looks more logical (and certainly more
consistent) the way things are now.
Alex Shi Aug. 20, 2024, 10:06 a.m. UTC | #2
On 8/20/24 12:40 PM, Andrew Morton wrote:
> On Mon, 19 Aug 2024 19:26:28 +0800 alexs@kernel.org wrote:
> 
>> From: Alex Shi <alexs@kernel.org>
>>
>> Remove unnecessary '<' check for ZONES_SHIFT assignment.
>>
>> ...
>>
>> --- a/include/linux/page-flags-layout.h
>> +++ b/include/linux/page-flags-layout.h
>> @@ -14,7 +14,7 @@
>>   */
>>  #if MAX_NR_ZONES < 2
>>  #define ZONES_SHIFT 0
>> -#elif MAX_NR_ZONES <= 2
>> +#elif MAX_NR_ZONES == 2
>>  #define ZONES_SHIFT 1
>>  #elif MAX_NR_ZONES <= 4
>>  #define ZONES_SHIFT 2
> 
> mmm, why.  I think it looks more logical (and certainly more
> consistent) the way things are now.
> 

Uh, then let's keep the current code if the logical looks better.

In fact, the logical is in preprocess, has nothing change in the final object file.

Thanks for comments!
diff mbox series

Patch

diff --git a/include/linux/page-flags-layout.h b/include/linux/page-flags-layout.h
index 7d79818dc065..7edc2b8a3414 100644
--- a/include/linux/page-flags-layout.h
+++ b/include/linux/page-flags-layout.h
@@ -14,7 +14,7 @@ 
  */
 #if MAX_NR_ZONES < 2
 #define ZONES_SHIFT 0
-#elif MAX_NR_ZONES <= 2
+#elif MAX_NR_ZONES == 2
 #define ZONES_SHIFT 1
 #elif MAX_NR_ZONES <= 4
 #define ZONES_SHIFT 2