* Re: [PATCH v3] mempolicy: Clarify what zone reclaim means
2025-08-05 20:50 [PATCH v3] mempolicy: Clarify what zone reclaim means Joshua Hahn
@ 2025-08-05 20:54 ` Zi Yan
2025-08-05 23:59 ` Byungchul Park
2025-08-06 0:55 ` Huang, Ying
2 siblings, 0 replies; 5+ messages in thread
From: Zi Yan @ 2025-08-05 20:54 UTC (permalink / raw)
To: Joshua Hahn
Cc: Andrew Morton, David Hildenbrand, SeongJae Park, Ying Huang,
Alistair Popple, Byungchul Park, Gregory Price, Matthew Brost,
Rakie Kim, linux-kernel, linux-mm, kernel-team
On 5 Aug 2025, at 16:50, Joshua Hahn wrote:
> The zone_reclaim_mode API controls the reclaim behavior when a node runs out of
> memory. Contrary to its user-facing name, it is internally referred to as
> "node_reclaim_mode".
>
> This can be confusing. But because we cannot change the name of the API since
> it has been in place since at least 2.6, let's try to be more explicit about
> what the behavior of this API is.
>
> Change the description to clarify what zone reclaim entails, and be explicit
> about the RECLAIM_ZONE bit, whose purpose has led to some confusion in the
> past already [1] [2].
>
> While at it, also soften the warning about changing these bits.
>
> [1] https://lore.kernel.org/linux-mm/1579005573-58923-1-git-send-email-alex.shi@linux.alibaba.com/
> [2] https://lore.kernel.org/linux-mm/20200626003459.D8E015CA@viggo.jf.intel.com/
>
> Acked-by: SeongJae Park <sj@kernel.org>
> Acked-by: David Hildenbrand <david@redhat.com>
> Reviewed-by: Huang Ying <ying.huang@linux.alibaba.com>
> Signed-off-by: Joshua Hahn <joshua.hahnjy@gmail.com>
> ---
> v2 --> v3:
> - Fixed typos
> - Softend wording from "never" --> "should not"
>
> include/uapi/linux/mempolicy.h | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
Acked-by: Zi Yan <ziy@nvidia.com>
Best Regards,
Yan, Zi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] mempolicy: Clarify what zone reclaim means
2025-08-05 20:50 [PATCH v3] mempolicy: Clarify what zone reclaim means Joshua Hahn
2025-08-05 20:54 ` Zi Yan
@ 2025-08-05 23:59 ` Byungchul Park
2025-08-06 0:55 ` Huang, Ying
2 siblings, 0 replies; 5+ messages in thread
From: Byungchul Park @ 2025-08-05 23:59 UTC (permalink / raw)
To: Joshua Hahn
Cc: Andrew Morton, David Hildenbrand, SeongJae Park, Ying Huang,
Alistair Popple, Gregory Price, Matthew Brost, Rakie Kim, Zi Yan,
linux-kernel, linux-mm, kernel-team, kernel_team
On Tue, Aug 05, 2025 at 01:50:47PM -0700, Joshua Hahn wrote:
> The zone_reclaim_mode API controls the reclaim behavior when a node runs out of
> memory. Contrary to its user-facing name, it is internally referred to as
> "node_reclaim_mode".
>
> This can be confusing. But because we cannot change the name of the API since
> it has been in place since at least 2.6, let's try to be more explicit about
> what the behavior of this API is.
>
> Change the description to clarify what zone reclaim entails, and be explicit
> about the RECLAIM_ZONE bit, whose purpose has led to some confusion in the
> past already [1] [2].
>
> While at it, also soften the warning about changing these bits.
>
> [1] https://lore.kernel.org/linux-mm/1579005573-58923-1-git-send-email-alex.shi@linux.alibaba.com/
> [2] https://lore.kernel.org/linux-mm/20200626003459.D8E015CA@viggo.jf.intel.com/
>
> Acked-by: SeongJae Park <sj@kernel.org>
> Acked-by: David Hildenbrand <david@redhat.com>
> Reviewed-by: Huang Ying <ying.huang@linux.alibaba.com>
> Signed-off-by: Joshua Hahn <joshua.hahnjy@gmail.com>
> ---
> v2 --> v3:
> - Fixed typos
> - Softend wording from "never" --> "should not"
>
> include/uapi/linux/mempolicy.h | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/include/uapi/linux/mempolicy.h b/include/uapi/linux/mempolicy.h
> index 1f9bb10d1a47..683c130782f0 100644
> --- a/include/uapi/linux/mempolicy.h
> +++ b/include/uapi/linux/mempolicy.h
> @@ -66,10 +66,16 @@ enum {
> #define MPOL_F_MORON (1 << 4) /* Migrate On protnone Reference On Node */
>
> /*
> + * Enabling zone reclaim means the page allocator will attempt to fulfill
> + * the allocation request on the current node by triggering reclaim and
> + * trying to shrink the current node.
> + * Fallback allocations on the next candidates in the zonelist are considered
> + * when reclaim fails to free up enough memory in the current node/zone.
I was confused too, at the beginning. Thanks for the explicit comment.
Acked-by: Byungchul Park <byungchul@sk.com>
Byungchul
> + *
> * These bit locations are exposed in the vm.zone_reclaim_mode sysctl
> - * ABI. New bits are OK, but existing bits can never change.
> + * ABI. New bits are OK, but existing bits should not be changed.
> */
> -#define RECLAIM_ZONE (1<<0) /* Run shrink_inactive_list on the zone */
> +#define RECLAIM_ZONE (1<<0) /* Enable zone reclaim */
> #define RECLAIM_WRITE (1<<1) /* Writeout pages during reclaim */
> #define RECLAIM_UNMAP (1<<2) /* Unmap pages during reclaim */
>
>
> base-commit: 6bcdbd62bd56e6d7383f9e06d9d148935b3c9b73
> --
> 2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] mempolicy: Clarify what zone reclaim means
2025-08-05 20:50 [PATCH v3] mempolicy: Clarify what zone reclaim means Joshua Hahn
2025-08-05 20:54 ` Zi Yan
2025-08-05 23:59 ` Byungchul Park
@ 2025-08-06 0:55 ` Huang, Ying
2025-08-06 13:43 ` Joshua Hahn
2 siblings, 1 reply; 5+ messages in thread
From: Huang, Ying @ 2025-08-06 0:55 UTC (permalink / raw)
To: Joshua Hahn
Cc: Andrew Morton, David Hildenbrand, SeongJae Park, Alistair Popple,
Byungchul Park, Gregory Price, Matthew Brost, Rakie Kim, Zi Yan,
linux-kernel, linux-mm, kernel-team
Joshua Hahn <joshua.hahnjy@gmail.com> writes:
> The zone_reclaim_mode API controls the reclaim behavior when a node runs out of
> memory. Contrary to its user-facing name, it is internally referred to as
> "node_reclaim_mode".
>
> This can be confusing. But because we cannot change the name of the API since
> it has been in place since at least 2.6, let's try to be more explicit about
> what the behavior of this API is.
>
> Change the description to clarify what zone reclaim entails, and be explicit
> about the RECLAIM_ZONE bit, whose purpose has led to some confusion in the
> past already [1] [2].
>
> While at it, also soften the warning about changing these bits.
>
> [1] https://lore.kernel.org/linux-mm/1579005573-58923-1-git-send-email-alex.shi@linux.alibaba.com/
> [2] https://lore.kernel.org/linux-mm/20200626003459.D8E015CA@viggo.jf.intel.com/
>
> Acked-by: SeongJae Park <sj@kernel.org>
> Acked-by: David Hildenbrand <david@redhat.com>
> Reviewed-by: Huang Ying <ying.huang@linux.alibaba.com>
> Signed-off-by: Joshua Hahn <joshua.hahnjy@gmail.com>
> ---
> v2 --> v3:
> - Fixed typos
> - Softend wording from "never" --> "should not"
>
> include/uapi/linux/mempolicy.h | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/include/uapi/linux/mempolicy.h b/include/uapi/linux/mempolicy.h
> index 1f9bb10d1a47..683c130782f0 100644
> --- a/include/uapi/linux/mempolicy.h
> +++ b/include/uapi/linux/mempolicy.h
> @@ -66,10 +66,16 @@ enum {
> #define MPOL_F_MORON (1 << 4) /* Migrate On protnone Reference On Node */
>
> /*
> + * Enabling zone reclaim means the page allocator will attempt to fulfill
> + * the allocation request on the current node by triggering reclaim and
> + * trying to shrink the current node.
> + * Fallback allocations on the next candidates in the zonelist are considered
> + * when reclaim fails to free up enough memory in the current node/zone.
> + *
> * These bit locations are exposed in the vm.zone_reclaim_mode sysctl
> - * ABI. New bits are OK, but existing bits can never change.
> + * ABI. New bits are OK, but existing bits should not be changed.
Should we avoid to call sysctl ABI here?
> */
> -#define RECLAIM_ZONE (1<<0) /* Run shrink_inactive_list on the zone */
> +#define RECLAIM_ZONE (1<<0) /* Enable zone reclaim */
> #define RECLAIM_WRITE (1<<1) /* Writeout pages during reclaim */
> #define RECLAIM_UNMAP (1<<2) /* Unmap pages during reclaim */
>
>
> base-commit: 6bcdbd62bd56e6d7383f9e06d9d148935b3c9b73
---
Best Regards,
Huang, Ying
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] mempolicy: Clarify what zone reclaim means
2025-08-06 0:55 ` Huang, Ying
@ 2025-08-06 13:43 ` Joshua Hahn
0 siblings, 0 replies; 5+ messages in thread
From: Joshua Hahn @ 2025-08-06 13:43 UTC (permalink / raw)
To: Huang, Ying, Andrew Morton
Cc: David Hildenbrand, SeongJae Park, Alistair Popple, Byungchul Park,
Gregory Price, Matthew Brost, Rakie Kim, Zi Yan, linux-kernel,
linux-mm, kernel-team
On Wed, 06 Aug 2025 08:55:42 +0800 "Huang, Ying" <ying.huang@linux.alibaba.com> wrote:
> Joshua Hahn <joshua.hahnjy@gmail.com> writes:
> >
> > /*
> > + * Enabling zone reclaim means the page allocator will attempt to fulfill
> > + * the allocation request on the current node by triggering reclaim and
> > + * trying to shrink the current node.
> > + * Fallback allocations on the next candidates in the zonelist are considered
> > + * when reclaim fails to free up enough memory in the current node/zone.
> > + *
> > * These bit locations are exposed in the vm.zone_reclaim_mode sysctl
> > - * ABI. New bits are OK, but existing bits can never change.
> > + * ABI. New bits are OK, but existing bits should not be changed.
>
> Should we avoid to call sysctl ABI here?
Hi Ying,
Makes sense to me as well!
Andrew -- I saw that you added this to mm-unstable yesterday, would you mind
folding the small fixlet below in with it? Please let me know if you would
rather that I send in a new version, whatever works best for you!
As always, thank you for your help : -) Have a great day!
Remove the reference to the vm.zone_reclaim_mode sysctl as an ABI.
Signed-off-by: Joshua Hahn <joshua.hahnjy@gmail.com>
diff --git a/include/uapi/linux/mempolicy.h b/include/uapi/linux/mempolicy.h
index 683c130782f0..8fbbe613611a 100644
--- a/include/uapi/linux/mempolicy.h
+++ b/include/uapi/linux/mempolicy.h
@@ -72,8 +72,8 @@ enum {
* Fallback allocations on the next candidates in the zonelist are considered
* when reclaim fails to free up enough memory in the current node/zone.
*
- * These bit locations are exposed in the vm.zone_reclaim_mode sysctl
- * ABI. New bits are OK, but existing bits should not be changed.
+ * These bit locations are exposed in the vm.zone_reclaim_mode sysctl.
+ * New bits are OK, but existing bits should not be changed.
*/
#define RECLAIM_ZONE (1<<0) /* Enable zone reclaim */
#define RECLAIM_WRITE (1<<1) /* Writeout pages during reclaim */
^ permalink raw reply related [flat|nested] 5+ messages in thread