Re: [PATCH] mm/vmstat: Fix a W=1 clang compiler warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux