From: Bart Van Assche <bvanassche@acm.org>
To: Vlastimil Babka <vbabka@suse.cz>,
Ivan Shapovalov <intelfx@intelfx.name>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
Pasha Tatashin <pasha.tatashin@soleen.com>,
David Rientjes <rientjes@google.com>,
David Hildenbrand <david@redhat.com>,
Joel Granados <joel.granados@kernel.org>,
Sourav Panda <souravpanda@google.com>,
Kaiyang Zhao <kaiyang2@cs.cmu.edu>,
Johannes Weiner <hannes@cmpxchg.org>,
Konstantin Khlebnikov <koct9i@gmail.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev
Subject: Re: [PATCH] mm/vmstat: Fix a W=1 clang compiler warning
Date: Wed, 29 Jan 2025 09:30:48 -0800 [thread overview]
Message-ID: <e7760176-8415-4f12-8579-b10111647525@acm.org> (raw)
In-Reply-To: <a4dc3313-b9b7-4075-b082-7232b3b7717b@suse.cz>
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.
next prev parent reply other threads:[~2025-01-29 17:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-12 21:31 Bart Van Assche
2024-12-13 2:24 ` Andrew Morton
2024-12-13 22:01 ` Bart Van Assche
2025-01-22 1:57 ` Ivan Shapovalov
2025-01-22 21:55 ` Bart Van Assche
2025-01-28 21:36 ` Bart Van Assche
2025-01-29 10:22 ` Vlastimil Babka
2025-01-29 17:30 ` Bart Van Assche [this message]
2025-01-29 22:46 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e7760176-8415-4f12-8579-b10111647525@acm.org \
--to=bvanassche@acm.org \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=intelfx@intelfx.name \
--cc=joel.granados@kernel.org \
--cc=justinstitt@google.com \
--cc=kaiyang2@cs.cmu.edu \
--cc=koct9i@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=pasha.tatashin@soleen.com \
--cc=rientjes@google.com \
--cc=souravpanda@google.com \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox