* + mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix.patch added to mm-unstable branch
@ 2025-08-22 22:01 Andrew Morton
2025-08-22 22:37 ` Zi Yan
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2025-08-22 22:01 UTC (permalink / raw)
To: mm-commits, ziy, vgupta, lorenzo.stoakes, lkp, liuye, dev.jain,
david, chrisl, akpm, akpm
The patch titled
Subject: mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix
has been added to the -mm mm-unstable branch. Its filename is
mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix.patch
This patch will later appear in the mm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: Andrew Morton <akpm@linux-foundation.org>
Subject: mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix
Date: Fri Aug 22 02:54:15 PM PDT 2025
add system-wide PAGES_TO_KB/PAGES_FROM_KB to mm.h, remove arc private
versions
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lkml.kernel.org/r/202508230539.pnO97SIj-lkp@intel.com
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: Ye Liu <liuye@kylinos.cn>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Dev Jain <dev.jain@arm.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Chris Li <chrisl@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
arch/arc/include/asm/arcregs.h | 4 ++--
include/linux/mm.h | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
--- a/arch/arc/include/asm/arcregs.h~mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix
+++ a/arch/arc/include/asm/arcregs.h
@@ -146,13 +146,13 @@
#ifndef __ASSEMBLER__
+#include <linux/mm.h>
+
#include <soc/arc/arc_aux.h>
/* 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)
/*
--- a/include/linux/mm.h~mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix
+++ a/include/linux/mm.h
@@ -75,6 +75,8 @@ extern void * high_memory;
* PAGE_SHIFT is the shift for page size (e.g., 12 for 4KB pages)
* So (20 - PAGE_SHIFT) converts between pages and MB
*/
+#define PAGES_TO_KB(pages) ((pages) >> (10 - PAGE_SHIFT))
+#define KB_TO_PAGES(kb) ((kb) << (10 - PAGE_SHIFT))
#define PAGES_TO_MB(pages) ((pages) >> (20 - PAGE_SHIFT))
#define MB_TO_PAGES(mb) ((mb) << (20 - PAGE_SHIFT))
_
Patches currently in -mm which might be from akpm@linux-foundation.org are
mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix.patch
mm-damon-core-skip-needless-update-of-damon_attrs-in-damon_commit_ctx-fix.patch
mm-convert-core-mm-to-mm_flags_-accessors-fix.patch
memcg-optimize-exit-to-user-space-fix.patch
lib-sys_info-handle-sys_info_mask==0-case-fix.patch
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: + mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix.patch added to mm-unstable branch
2025-08-22 22:01 + mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix.patch added to mm-unstable branch Andrew Morton
@ 2025-08-22 22:37 ` Zi Yan
2025-08-23 1:48 ` Andrew Morton
2025-08-23 2:00 ` Andrew Morton
0 siblings, 2 replies; 5+ messages in thread
From: Zi Yan @ 2025-08-22 22:37 UTC (permalink / raw)
To: Andrew Morton
Cc: mm-commits, vgupta, lorenzo.stoakes, lkp, liuye, dev.jain, david,
chrisl
On 22 Aug 2025, at 18:01, Andrew Morton wrote:
> The patch titled
> Subject: mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix
> has been added to the -mm mm-unstable branch. Its filename is
> mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix.patch
>
> This patch will shortly appear at
> https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix.patch
>
> This patch will later appear in the mm-unstable branch at
> git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
>
> Before you just go and hit "reply", please:
> a) Consider who else should be cc'ed
> b) Prefer to cc a suitable mailing list as well
> c) Ideally: find the original patch on the mailing list and do a
> reply-to-all to that, adding suitable additional cc's
>
> *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
>
> The -mm tree is included into linux-next via the mm-everything
> branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> and is updated there every 2-3 working days
>
> ------------------------------------------------------
> From: Andrew Morton <akpm@linux-foundation.org>
> Subject: mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix
> Date: Fri Aug 22 02:54:15 PM PDT 2025
>
> add system-wide PAGES_TO_KB/PAGES_FROM_KB to mm.h, remove arc private
> versions
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lkml.kernel.org/r/202508230539.pnO97SIj-lkp@intel.com
> Cc: Vineet Gupta <vgupta@kernel.org>
> Cc: Ye Liu <liuye@kylinos.cn>
> Cc: Zi Yan <ziy@nvidia.com>
> Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> Cc: Dev Jain <dev.jain@arm.com>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Chris Li <chrisl@kernel.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> arch/arc/include/asm/arcregs.h | 4 ++--
> include/linux/mm.h | 2 ++
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> --- a/arch/arc/include/asm/arcregs.h~mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix
> +++ a/arch/arc/include/asm/arcregs.h
> @@ -146,13 +146,13 @@
>
> #ifndef __ASSEMBLER__
>
> +#include <linux/mm.h>
> +
> #include <soc/arc/arc_aux.h>
>
> /* 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)
>
>
> /*
> --- a/include/linux/mm.h~mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix
> +++ a/include/linux/mm.h
> @@ -75,6 +75,8 @@ extern void * high_memory;
> * PAGE_SHIFT is the shift for page size (e.g., 12 for 4KB pages)
> * So (20 - PAGE_SHIFT) converts between pages and MB
> */
> +#define PAGES_TO_KB(pages) ((pages) >> (10 - PAGE_SHIFT))
> +#define KB_TO_PAGES(kb) ((kb) << (10 - PAGE_SHIFT))
Left shift and right shift with a negative value. Aren't they undefined
behaviors?
> #define PAGES_TO_MB(pages) ((pages) >> (20 - PAGE_SHIFT))
> #define MB_TO_PAGES(mb) ((mb) << (20 - PAGE_SHIFT))
>
> _
>
> Patches currently in -mm which might be from akpm@linux-foundation.org are
>
> mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix.patch
> mm-damon-core-skip-needless-update-of-damon_attrs-in-damon_commit_ctx-fix.patch
> mm-convert-core-mm-to-mm_flags_-accessors-fix.patch
> memcg-optimize-exit-to-user-space-fix.patch
> lib-sys_info-handle-sys_info_mask==0-case-fix.patch
--
Best Regards,
Yan, Zi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: + mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix.patch added to mm-unstable branch
2025-08-22 22:37 ` Zi Yan
@ 2025-08-23 1:48 ` Andrew Morton
2025-08-23 2:00 ` Andrew Morton
1 sibling, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2025-08-23 1:48 UTC (permalink / raw)
To: Zi Yan
Cc: mm-commits, vgupta, lorenzo.stoakes, lkp, liuye, dev.jain, david,
chrisl
On Fri, 22 Aug 2025 18:37:45 -0400 Zi Yan <ziy@nvidia.com> wrote:
> > --- a/arch/arc/include/asm/arcregs.h~mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix
> > +++ a/arch/arc/include/asm/arcregs.h
> > @@ -146,13 +146,13 @@
> >
> > #ifndef __ASSEMBLER__
> >
> > +#include <linux/mm.h>
> > +
> > #include <soc/arc/arc_aux.h>
> >
> > /* 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)
> >
> >
> > /*
> > --- a/include/linux/mm.h~mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix
> > +++ a/include/linux/mm.h
> > @@ -75,6 +75,8 @@ extern void * high_memory;
> > * PAGE_SHIFT is the shift for page size (e.g., 12 for 4KB pages)
> > * So (20 - PAGE_SHIFT) converts between pages and MB
> > */
> > +#define PAGES_TO_KB(pages) ((pages) >> (10 - PAGE_SHIFT))
> > +#define KB_TO_PAGES(kb) ((kb) << (10 - PAGE_SHIFT))
>
> Left shift and right shift with a negative value. Aren't they undefined
> behaviors?
bah, thanks. This?
#define PAGES_TO_KB(pages) ((pages) << (PAGE_SHIFT - 10))
#define KB_TO_PAGES(kb) ((kb) >> (PAGE_SHIFT - 10))
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: + mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix.patch added to mm-unstable branch
2025-08-22 22:37 ` Zi Yan
2025-08-23 1:48 ` Andrew Morton
@ 2025-08-23 2:00 ` Andrew Morton
1 sibling, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2025-08-23 2:00 UTC (permalink / raw)
To: Zi Yan
Cc: mm-commits, vgupta, lorenzo.stoakes, lkp, liuye, dev.jain, david,
chrisl
On Fri, 22 Aug 2025 18:37:45 -0400 Zi Yan <ziy@nvidia.com> wrote:
> > +#define PAGES_TO_KB(pages) ((pages) >> (10 - PAGE_SHIFT))
> > +#define KB_TO_PAGES(kb) ((kb) << (10 - PAGE_SHIFT))
>
> Left shift and right shift with a negative value. Aren't they undefined
> behaviors?
Actually I just misread the bug report. I'll redo:
From: Andrew Morton <akpm@linux-foundation.org>
Subject: mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix
Date: Fri Aug 22 02:54:15 PM PDT 2025
remove arc's private PAGES_TO_MB, remove its unused PAGES_TO_KB
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lkml.kernel.org/r/202508230539.pnO97SIj-lkp@intel.com
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: Ye Liu <liuye@kylinos.cn>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Dev Jain <dev.jain@arm.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Chris Li <chrisl@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
arch/arc/include/asm/arcregs.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
--- a/arch/arc/include/asm/arcregs.h~mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix
+++ a/arch/arc/include/asm/arcregs.h
@@ -146,14 +146,13 @@
#ifndef __ASSEMBLER__
+#include <linux/mm.h>
+
#include <soc/arc/arc_aux.h>
/* 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)
-
/*
***************************************************************
_
^ permalink raw reply [flat|nested] 5+ messages in thread
* + mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix.patch added to mm-unstable branch
@ 2025-08-23 2:00 Andrew Morton
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2025-08-23 2:00 UTC (permalink / raw)
To: mm-commits, ziy, vgupta, lorenzo.stoakes, lkp, liuye, dev.jain,
david, chrisl, akpm, akpm
The patch titled
Subject: mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix
has been added to the -mm mm-unstable branch. Its filename is
mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix.patch
This patch will later appear in the mm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: Andrew Morton <akpm@linux-foundation.org>
Subject: mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix
Date: Fri Aug 22 02:54:15 PM PDT 2025
remove arc's private PAGES_TO_MB, remove its unused PAGES_TO_KB
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lkml.kernel.org/r/202508230539.pnO97SIj-lkp@intel.com
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: Ye Liu <liuye@kylinos.cn>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Dev Jain <dev.jain@arm.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Chris Li <chrisl@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
arch/arc/include/asm/arcregs.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
--- a/arch/arc/include/asm/arcregs.h~mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix
+++ a/arch/arc/include/asm/arcregs.h
@@ -146,14 +146,13 @@
#ifndef __ASSEMBLER__
+#include <linux/mm.h>
+
#include <soc/arc/arc_aux.h>
/* 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)
-
/*
***************************************************************
_
Patches currently in -mm which might be from akpm@linux-foundation.org are
mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix.patch
mm-damon-core-skip-needless-update-of-damon_attrs-in-damon_commit_ctx-fix.patch
mm-convert-core-mm-to-mm_flags_-accessors-fix.patch
memcg-optimize-exit-to-user-space-fix.patch
mm-page_table_check-reinstate-address-parameter-in-page_table_check_pud_set-fix.patch
lib-sys_info-handle-sys_info_mask==0-case-fix.patch
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-08-23 2:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-22 22:01 + mm-replace-20-page_shift-with-common-macros-for-pages-mb-conversion-fix.patch added to mm-unstable branch Andrew Morton
2025-08-22 22:37 ` Zi Yan
2025-08-23 1:48 ` Andrew Morton
2025-08-23 2:00 ` Andrew Morton
-- strict thread matches above, loose matches on Subject: below --
2025-08-23 2:00 Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.