From: Bijan Tabatabai <bijantabatab@micron.com>
This patch exposes get_il_weight() in mm/internal.h. This patch is to
allow other parts of the MM subsystem, such as DAMON, to make page
placement decisions based on the global interleave weights.
Signed-off-by: Bijan Tabatabai <bijantabatab@micron.com>
---
mm/internal.h | 6 ++++++
mm/mempolicy.c | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/mm/internal.h b/mm/internal.h
index 3823fb356d3b..b718ebe7cad5 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -1169,6 +1169,7 @@ extern int node_reclaim_mode;
extern int node_reclaim(struct pglist_data *, gfp_t, unsigned int);
extern int find_next_best_node(int node, nodemask_t *used_node_mask);
+extern u8 get_il_weight(int node);
#else
#define node_reclaim_mode 0
@@ -1181,6 +1182,11 @@ static inline int find_next_best_node(int node, nodemask_t *used_node_mask)
{
return NUMA_NO_NODE;
}
+
+static inline u8 get_il_weight(int node)
+{
+ return 1;
+}
#endif
static inline bool node_reclaim_enabled(void)
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 1ff7b2174eb7..b1713430ee9c 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -165,7 +165,7 @@ static unsigned int *node_bw_table;
*/
static DEFINE_MUTEX(wi_state_lock);
-static u8 get_il_weight(int node)
+u8 get_il_weight(int node)
{
struct weighted_interleave_state *state;
u8 weight = 1;
--
2.43.5
Bijan Tabatabai <bijan311@gmail.com> writes:
> From: Bijan Tabatabai <bijantabatab@micron.com>
>
> This patch exposes get_il_weight() in mm/internal.h. This patch is to
> allow other parts of the MM subsystem, such as DAMON, to make page
> placement decisions based on the global interleave weights.
>
> Signed-off-by: Bijan Tabatabai <bijantabatab@micron.com>
> ---
> mm/internal.h | 6 ++++++
> mm/mempolicy.c | 2 +-
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/mm/internal.h b/mm/internal.h
> index 3823fb356d3b..b718ebe7cad5 100644
> --- a/mm/internal.h
> +++ b/mm/internal.h
> @@ -1169,6 +1169,7 @@ extern int node_reclaim_mode;
>
> extern int node_reclaim(struct pglist_data *, gfp_t, unsigned int);
> extern int find_next_best_node(int node, nodemask_t *used_node_mask);
> +extern u8 get_il_weight(int node);
> #else
> #define node_reclaim_mode 0
>
> @@ -1181,6 +1182,11 @@ static inline int find_next_best_node(int node, nodemask_t *used_node_mask)
> {
> return NUMA_NO_NODE;
> }
> +
> +static inline u8 get_il_weight(int node)
> +{
> + return 1;
> +}
> #endif
>
> static inline bool node_reclaim_enabled(void)
> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> index 1ff7b2174eb7..b1713430ee9c 100644
> --- a/mm/mempolicy.c
> +++ b/mm/mempolicy.c
> @@ -165,7 +165,7 @@ static unsigned int *node_bw_table;
> */
> static DEFINE_MUTEX(wi_state_lock);
>
> -static u8 get_il_weight(int node)
> +u8 get_il_weight(int node)
> {
> struct weighted_interleave_state *state;
> u8 weight = 1;
I agree with David on the function naming and "extern". Otherwise, this
looks good to me, Thanks! Feel free to add my
Reviewed-by: Huang Ying <ying.huang@linux.alibaba.com>
in the future versions.
---
Best Regards,
Huang, Ying
On 20.06.25 20:04, Bijan Tabatabai wrote:
> From: Bijan Tabatabai <bijantabatab@micron.com>
>
> This patch exposes get_il_weight() in mm/internal.h. This patch is to
> allow other parts of the MM subsystem, such as DAMON, to make page
> placement decisions based on the global interleave weights.
>
> Signed-off-by: Bijan Tabatabai <bijantabatab@micron.com>
> ---
> mm/internal.h | 6 ++++++
> mm/mempolicy.c | 2 +-
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/mm/internal.h b/mm/internal.h
> index 3823fb356d3b..b718ebe7cad5 100644
> --- a/mm/internal.h
> +++ b/mm/internal.h
> @@ -1169,6 +1169,7 @@ extern int node_reclaim_mode;
>
> extern int node_reclaim(struct pglist_data *, gfp_t, unsigned int);
> extern int find_next_best_node(int node, nodemask_t *used_node_mask);
> +extern u8 get_il_weight(int node);
No new "extern". It's a blast from the past :)
> #else
> #define node_reclaim_mode 0
>
> @@ -1181,6 +1182,11 @@ static inline int find_next_best_node(int node, nodemask_t *used_node_mask)
> {
> return NUMA_NO_NODE;
> }
> +
> +static inline u8 get_il_weight(int node)
> +{
> + return 1;
> +}
> #endif
>
> static inline bool node_reclaim_enabled(void)
> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> index 1ff7b2174eb7..b1713430ee9c 100644
> --- a/mm/mempolicy.c
> +++ b/mm/mempolicy.c
> @@ -165,7 +165,7 @@ static unsigned int *node_bw_table;
> */
> static DEFINE_MUTEX(wi_state_lock);
>
> -static u8 get_il_weight(int node)
> +u8 get_il_weight(int node)
The function name is shockingly confusing when used outside this file.
Do we have some namespace to at least highlight what this is about?
node_interleave_weight() might be a lot clearer?
So maybe let's just rename it to something less confusing as we use it
from other files.
> {
> struct weighted_interleave_state *state;
> u8 weight = 1;
--
Cheers,
David / dhildenb
On Mon, Jun 23, 2025 at 09:14:34PM +0200, David Hildenbrand wrote: > > +u8 get_il_weight(int node) > > The function name is shockingly confusing when used outside this file. Do we > have some namespace to at least highlight what this is about? > > node_interleave_weight() might be a lot clearer? > this is fair and my fault as I didn't consider whether it'd ever be used outside mempolicy. So i agree it should be renamed or wrapped. ~Gregory
On Fri, Jun 20, 2025 at 01:04:57PM -0500, Bijan Tabatabai wrote: > From: Bijan Tabatabai <bijantabatab@micron.com> > > This patch exposes get_il_weight() in mm/internal.h. This patch is to > allow other parts of the MM subsystem, such as DAMON, to make page > placement decisions based on the global interleave weights. > > Signed-off-by: Bijan Tabatabai <bijantabatab@micron.com> Reviewed-by: Gregory Price <gourry@gourry.net>
© 2016 - 2026 Red Hat, Inc.