[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e7760176-8415-4f12-8579-b10111647525@acm.org>
Date: Wed, 29 Jan 2025 09:30:48 -0800
From: Bart Van Assche <bvanassche@....org>
To: Vlastimil Babka <vbabka@...e.cz>, Ivan Shapovalov <intelfx@...elfx.name>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>, Bill Wendling
<morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>,
Pasha Tatashin <pasha.tatashin@...een.com>,
David Rientjes <rientjes@...gle.com>, David Hildenbrand <david@...hat.com>,
Joel Granados <joel.granados@...nel.org>,
Sourav Panda <souravpanda@...gle.com>, Kaiyang Zhao <kaiyang2@...cmu.edu>,
Johannes Weiner <hannes@...xchg.org>,
Konstantin Khlebnikov <koct9i@...il.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH] mm/vmstat: Fix a W=1 clang compiler warning
On 1/29/25 2:22 AM, Vlastimil Babka wrote:
> On 1/28/25 22:36, Bart Van Assche wrote:
>> +#define NR_ZONE_LRU_BASE (1 * __NR_ZONE_LRU_BASE)
>> +#define NR_VM_ZONE_STAT_ITEMS (1 * __NR_VM_ZONE_STAT_ITEMS)
>
> Seems an acceptable approach, dunno if this multiply by one is any better
> than casting to int?
For enumeration types that are wider than an int, casting to an int
causes the highest bits to be lost. Multiplying by one doesn't have this
disadvantage. Please note that I don't have a strong opinion about this
and that casting to int would also work here.
>> +
>> enum zone_stat_item {
>> /* First 128 byte cacheline (assuming 64 bit words) */
>> NR_FREE_PAGES,
>> - NR_ZONE_LRU_BASE, /* Used only for compaction and reclaim retry */
>> + __NR_ZONE_LRU_BASE, /* Used only for compaction and reclaim retry */
>> NR_ZONE_INACTIVE_ANON = NR_ZONE_LRU_BASE,
>
> Should we rather use __NR_ZONE_LRU_BASE here?
Right, I will fix this and also a similar issue below.
Thanks,
Bart.
Powered by blists - more mailing lists