From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: kernel test robot <lkp@intel.com>, Ye Liu <ye.liu@linux.dev>,
David Hildenbrand <david@redhat.com>,
Davidlohr Bueso <dave@stgolabs.net>,
"Paul E. McKenney" <paulmck@kernel.org>,
Josh Triplett <josh@joshtriplett.org>,
Frederic Weisbecker <frederic@kernel.org>,
Neeraj Upadhyay <neeraj.upadhyay@kernel.org>,
Joel Fernandes <joelagnelf@nvidia.com>,
Boqun Feng <boqun.feng@gmail.com>,
Uladzislau Rezki <urezki@gmail.com>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
oe-kbuild-all@lists.linux.dev,
Linux Memory Management List <linux-mm@kvack.org>,
Ye Liu <liuye@kylinos.cn>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Vlastimil Babka <vbabka@suse.cz>, Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Steven Rostedt <rostedt@goodmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Lai Jiangshan <jiangshanlai@gmail.com>,
Zqiang <qiang.zhang@linux.dev>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>
Subject: Re: [PATCH] mm: Replace (20 - PAGE_SHIFT) with common macros for pages<->MB conversion
Date: Sun, 20 Jul 2025 09:59:55 +0100 [thread overview]
Message-ID: <3d459085-3b7f-4ba3-8197-832f7931bcc2@lucifer.local> (raw)
In-Reply-To: <20250719163807.068d4cb349c6a3395183167b@linux-foundation.org>
On Sat, Jul 19, 2025 at 04:38:07PM -0700, Andrew Morton wrote:
> On Sat, 19 Jul 2025 07:56:16 +0100 Lorenzo Stoakes <lorenzo.stoakes@oracle.com> wrote:
>
> > Ah yeah looks like this is already defined for arc only (!) in
> > arch/arc/include/asm/arcregs.h.
> >
> > Maybe pop in a #ifndef PAGES_TO_MB ? It seems to be equivalent.
>
> Well, those arc helpers
>
> /* Helpers */
> #define TO_KB(bytes) ((bytes) >> 10)
> #define TO_MB(bytes) (TO_KB(bytes) >> 10)
> #define PAGES_TO_KB(n_pages) ((n_pages) << (PAGE_SHIFT - 10))
> #define PAGES_TO_MB(n_pages) (PAGES_TO_KB(n_pages) >> 10)
>
> are simply in the wrong place.
>
> I was thinking move all four into mm.h (for the lack of a better
> place). Then someone can make a career out of hunting down all the code
> sites which can use them.
>
> eg,
>
> hp2:/usr/src/linux-6.16-rc5> fgrep -r ">> 10" . | wc -l
> 886
Yeah I agree for sure, this is misplaced, but maybe one for a follow up
patch?
There's more work to be done here, I already have an idea for a patch to
fix another similar case...
next prev parent reply other threads:[~2025-07-20 9:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-18 2:41 Ye Liu
2025-07-18 3:21 ` Andrew Morton
2025-07-18 7:27 ` David Hildenbrand
2025-07-18 9:42 ` Dev Jain
2025-07-18 9:46 ` Dev Jain
2025-07-18 9:49 ` Lorenzo Stoakes
2025-07-18 9:57 ` Lorenzo Stoakes
2025-07-18 14:30 ` Matthew Wilcox
2025-07-18 14:32 ` Zi Yan
2025-07-18 17:47 ` Chris Li
2025-07-18 20:06 ` kernel test robot
2025-07-19 6:56 ` Lorenzo Stoakes
2025-07-19 23:38 ` Andrew Morton
2025-07-20 8:59 ` Lorenzo Stoakes [this message]
2025-07-20 18:14 ` Andrew Morton
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=3d459085-3b7f-4ba3-8197-832f7931bcc2@lucifer.local \
--to=lorenzo.stoakes@oracle.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=boqun.feng@gmail.com \
--cc=bsegall@google.com \
--cc=dave@stgolabs.net \
--cc=david@redhat.com \
--cc=dietmar.eggemann@arm.com \
--cc=frederic@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=joelagnelf@nvidia.com \
--cc=josh@joshtriplett.org \
--cc=juri.lelli@redhat.com \
--cc=linux-mm@kvack.org \
--cc=liuye@kylinos.cn \
--cc=lkp@intel.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mgorman@suse.de \
--cc=mhocko@suse.com \
--cc=mingo@redhat.com \
--cc=neeraj.upadhyay@kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=qiang.zhang@linux.dev \
--cc=rostedt@goodmis.org \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=urezki@gmail.com \
--cc=vbabka@suse.cz \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=ye.liu@linux.dev \
/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