diff mbox series

[2/6] mm/vmscan: use node_is_toptier helper in node_reclaim

Message ID 20220416053902.68517-3-dave@stgolabs.net (mailing list archive)
State New
Headers show
Series mm: proactive reclaim and memory tiering topics | expand

Commit Message

Davidlohr Bueso April 16, 2022, 5:38 a.m. UTC
We have helpers for a reason.

Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
---
 mm/vmscan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Adam Manzanares April 25, 2022, 10:32 p.m. UTC | #1
On Fri, Apr 15, 2022 at 10:38:58PM -0700, Davidlohr Bueso wrote:
> We have helpers for a reason.
> 
> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
> ---
>  mm/vmscan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 1678802e03e7..cb583fcbf5bf 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -4750,7 +4750,7 @@ int node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned int order)
>  	 * over remote processors and spread off node memory allocations
>  	 * as wide as possible.
>  	 */
> -	if (node_state(pgdat->node_id, N_CPU) && pgdat->node_id != numa_node_id())
> +	if (node_is_toptier(pgdat->node_id) && pgdat->node_id != numa_node_id())
>  		return NODE_RECLAIM_NOSCAN;
>  
>  	if (test_and_set_bit(PGDAT_RECLAIM_LOCKED, &pgdat->flags))
> -- 
> 2.26.2
>


Looks good.

Reviewed by: Adam Manzanares <a.manzanares@samsung.com>
David Rientjes May 4, 2022, 4:33 a.m. UTC | #2
On Fri, 15 Apr 2022, Davidlohr Bueso wrote:

> We have helpers for a reason.
> 
> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>

Acked-by: David Rientjes <rientjes@google.com>
Jagdish Gediya May 4, 2022, 7:26 a.m. UTC | #3
On Fri, Apr 15, 2022 at 10:38:58PM -0700, Davidlohr Bueso wrote:
> We have helpers for a reason.
> 
> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
> ---
>  mm/vmscan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 1678802e03e7..cb583fcbf5bf 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -4750,7 +4750,7 @@ int node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned int order)
>  	 * over remote processors and spread off node memory allocations
>  	 * as wide as possible.
>  	 */
> -	if (node_state(pgdat->node_id, N_CPU) && pgdat->node_id != numa_node_id())
> +	if (node_is_toptier(pgdat->node_id) && pgdat->node_id != numa_node_id())
Currently node_is_toptier returns all N_CPU node as toptier but N_CPU
node will not stay necessarily top tier as per discussions on below
thread.

https://lore.kernel.org/linux-mm/CAAPL-u9sVx94ACSuCVN8V0tKp+AMxiY89cro0japtyB=xNfNBw@mail.gmail.com/

node_is_toptier() definition can change based on the discussion in above
thread.
>  		return NODE_RECLAIM_NOSCAN;
>  
>  	if (test_and_set_bit(PGDAT_RECLAIM_LOCKED, &pgdat->flags))
> -- 
> 2.26.2
> 
>
Aneesh Kumar K.V May 31, 2022, 11:50 a.m. UTC | #4
Davidlohr Bueso <dave@stgolabs.net> writes:

> We have helpers for a reason.
>
> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
> ---
>  mm/vmscan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 1678802e03e7..cb583fcbf5bf 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -4750,7 +4750,7 @@ int node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned int order)
>  	 * over remote processors and spread off node memory allocations
>  	 * as wide as possible.
>  	 */
> -	if (node_state(pgdat->node_id, N_CPU) && pgdat->node_id != numa_node_id())
> +	if (node_is_toptier(pgdat->node_id) && pgdat->node_id != numa_node_id())
>  		return NODE_RECLAIM_NOSCAN;
>  
>  	if (test_and_set_bit(PGDAT_RECLAIM_LOCKED, &pgdat->flags))


Are we really looking at the top tier in a tiered memory hierarchy here?
The comment seems to suggest we are looking at local NUMA node?


-aneesh
Huang, Ying June 1, 2022, 6:12 a.m. UTC | #5
On Tue, 2022-05-31 at 17:20 +0530, Aneesh Kumar K.V wrote:
> Davidlohr Bueso <dave@stgolabs.net> writes:
> 
> > We have helpers for a reason.
> > 
> > Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
> > ---
> >  mm/vmscan.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > index 1678802e03e7..cb583fcbf5bf 100644
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> > @@ -4750,7 +4750,7 @@ int node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned int order)
> >  	 * over remote processors and spread off node memory allocations
> >  	 * as wide as possible.
> >  	 */
> > -	if (node_state(pgdat->node_id, N_CPU) && pgdat->node_id != numa_node_id())
> > +	if (node_is_toptier(pgdat->node_id) && pgdat->node_id != numa_node_id())
> >  		return NODE_RECLAIM_NOSCAN;
> >  
> > 
> >  	if (test_and_set_bit(PGDAT_RECLAIM_LOCKED, &pgdat->flags))
> 
> 
> Are we really looking at the top tier in a tiered memory hierarchy here?
> The comment seems to suggest we are looking at local NUMA node?

The code change itself is correct.  But it is an implementation details
that node_is_toptier() == node_state(, N_CPU).  And after we supporting
more memory tiers (like GPU, HBM), we will change the implementation of
node_is_toptier() soon.   So I think that it's better to keep the
original code.

Best Regards,
Huang, Ying
diff mbox series

Patch

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 1678802e03e7..cb583fcbf5bf 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -4750,7 +4750,7 @@  int node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned int order)
 	 * over remote processors and spread off node memory allocations
 	 * as wide as possible.
 	 */
-	if (node_state(pgdat->node_id, N_CPU) && pgdat->node_id != numa_node_id())
+	if (node_is_toptier(pgdat->node_id) && pgdat->node_id != numa_node_id())
 		return NODE_RECLAIM_NOSCAN;
 
 	if (test_and_set_bit(PGDAT_RECLAIM_LOCKED, &pgdat->flags))