vmscan: return NODE_RECLAIM_NOSCAN in node_reclaim() when CONFIG_NUMA is n
Subsystems (3)
PATCH 1/1 vmscan: return NODE_RECLAIM_NOSCAN in node_reclaim() when CONFIG_NUMA is n
Commit fa5e084e43eb ("vmscan: do not unconditionally treat zones that fail zone_reclaim() as full") changed the return value of node_reclaim(). The original return value 0 means NODE_RECLAIM_SOME after this commit.
While the return value of node_reclaim() when CONFIG_NUMA is n is not changed. This will leads to call zone_watermark_ok() again.
This patch fix the return value by adjusting to NODE_RECLAIM_NOSCAN. Since it is not proper to include "mm/internal.h", just hard coded it.
---
This doesn't effect the system functionally. I am not sure we need to cc to stable tree?
--- include/linux/swap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/swap.h +1 -1
@@ -364,7 +364,7 @@ extern int node_reclaim(struct pglist_data *, gfp_t, unsigned int);static inline int node_reclaim (struct pglist_data *pgdat,gfp_t mask,unsigned int order) { -return 0 ; +return -2 ;/* NODE_RECLAIM_NOSCAN */ }#endif
Signature · 1 line
2.15.1
Quoted 9 lines · Wei Yang
Commit
fa5e084e43eb("vmscan: do not unconditionally treat zones that failzone_reclaim()as full") changed the return value ofnode_reclaim(). The original return value 0 meansNODE_RECLAIM_SOMEafter this commit.While the return value of
node_reclaim()whenCONFIG_NUMAis n is not changed. This will leads to callzone_watermark_ok()again.This patch fix the return value by adjusting to
NODE_RECLAIM_NOSCAN. Since it is not proper to include "mm/internal.h", just hard coded it.
Since the return value is defined in mm/internal.h that means no code outside mm/ can call node_reclaim (nor should it). So let's move both of node_reclaim's declarations to mm/internal.h instead of keeping them in linux/swap.h.
Quoted 8 lines · Matthew Wilcox
Quoted 7 lines · Wei Yang
Commit
fa5e084e43eb("vmscan: do not unconditionally treat zones that failzone_reclaim()as full") changed the return value ofnode_reclaim(). The original return value 0 meansNODE_RECLAIM_SOMEafter this commit.While the return value of
node_reclaim()whenCONFIG_NUMAis n is not changed. This will leads to callzone_watermark_ok()again.
Quoted 7 lines
Quoted 2 lines
This patch fix the return value by adjusting to
NODE_RECLAIM_NOSCAN. Since it is not proper to include "mm/internal.h", just hard coded it.Since the return value is defined in
mm/internal.hthat means no code outsidemm/can callnode_reclaim(nor should it). So let's move both of node_reclaim's declarations tomm/internal.hinstead of keeping them inlinux/swap.h.
That's reasonable, thanks.
Signature · 2 lines
Wei Yang Help you, Help me
PATCH v2 1/1 vmscan: return NODE_RECLAIM_NOSCAN in node_reclaim() when CONFIG_NUMA is n
In reply to Wei YangCommit fa5e084e43eb ("vmscan: do not unconditionally treat zones that fail zone_reclaim() as full") changed the return value of node_reclaim(). The original return value 0 means NODE_RECLAIM_SOME after this commit.
While the return value of node_reclaim() when CONFIG_NUMA is n is not changed. This will leads to call zone_watermark_ok() again.
This patch fix the return value by adjusting to NODE_RECLAIM_NOSCAN. Since node_reclaim() is only called in page_alloc.c, move it to mm/internal.h.
---
v2: move node_reclaim() to mm/internal.h
--- include/linux/swap.h | 6 ------ mm/internal.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 6 deletions(-)
include/linux/swap.h +0 -6
@@ -358,14 +358,8 @@ extern unsigned long vm_total_pages;extern int node_reclaim_mode;extern int sysctl_min_unmapped_ratio;extern int sysctl_min_slab_ratio; -extern int node_reclaim (struct pglist_data *,gfp_t ,unsigned int );#else #define node_reclaim_mode 0 -static inline int node_reclaim (struct pglist_data *pgdat,gfp_t mask, -unsigned int order) -{ -return 0 ; -}#endif extern int page_evictable (struct page *page);
mm/internal.h +10 -0
@@ -444,6 +444,16 @@ static inline void mminit_validate_memmodel_limits(unsigned long *start_pfn,#define NODE_RECLAIM_SOME 0#define NODE_RECLAIM_SUCCESS 1 +#ifdef CONFIG_NUMA +extern int node_reclaim (struct pglist_data *,gfp_t ,unsigned int ); +#else +static inline int node_reclaim (struct pglist_data *pgdat,gfp_t mask, +unsigned int order) +{ +return NODE_RECLAIM_NOSCAN ; +} +#endif +extern int hwpoison_filter (struct page *p);extern u32 hwpoison_filter_dev_major;
Signature · 1 line
2.15.1
Quoted 9 lines · Wei Yang
Commit
fa5e084e43eb("vmscan: do not unconditionally treat zones that failzone_reclaim()as full") changed the return value ofnode_reclaim(). The original return value 0 meansNODE_RECLAIM_SOMEafter this commit.While the return value of
node_reclaim()whenCONFIG_NUMAis n is not changed. This will leads to callzone_watermark_ok()again.This patch fix the return value by adjusting to
NODE_RECLAIM_NOSCAN. Sincenode_reclaim()is only called inpage_alloc.c, move it tomm/internal.h.
The issue should be cosmetic but the code consistency is definitely an improvement. Moving this from swap.h makes a lot of sense as well.
Quoted 1 line
Signed-off-by Wei Yang <[email protected]>
Quoted 49 lines
---
v2: movenode_reclaim()tomm/internal.h--- include/linux/swap.h | 6 ------ mm/internal.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 6 deletions(-)include/linux/swap.h +0
-6@@ -358,14 +358,8 @@ extern unsigned long vm_total_pages;extern int node_reclaim_mode;extern int sysctl_min_unmapped_ratio;extern int sysctl_min_slab_ratio; -extern int node_reclaim (struct pglist_data *,gfp_t ,unsigned int );#else #define node_reclaim_mode 0 -static inline int node_reclaim (struct pglist_data *pgdat,gfp_t mask, -unsigned int order) -{ -return 0 ; -}#endif extern int page_evictable (struct page *page);mm/internal.h +10
-0@@ -444,6 +444,16 @@ static inline void mminit_validate_memmodel_limits(unsigned long *start_pfn,#define NODE_RECLAIM_SOME 0#define NODE_RECLAIM_SUCCESS 1 +#ifdef CONFIG_NUMA +extern int node_reclaim (struct pglist_data *,gfp_t ,unsigned int ); +#else +static inline int node_reclaim (struct pglist_data *pgdat,gfp_t mask, +unsigned int order) +{ +return NODE_RECLAIM_NOSCAN ; +} +#endif +extern int hwpoison_filter (struct page *p);extern u32 hwpoison_filter_dev_major;Signature · 1 line
2.15.1
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 11 lines · Michal Hocko
Quoted 9 lines · Wei Yang
Commit
fa5e084e43eb("vmscan: do not unconditionally treat zones that failzone_reclaim()as full") changed the return value ofnode_reclaim(). The original return value 0 meansNODE_RECLAIM_SOMEafter this commit.While the return value of
node_reclaim()whenCONFIG_NUMAis n is not changed. This will leads to callzone_watermark_ok()again.This patch fix the return value by adjusting to
NODE_RECLAIM_NOSCAN. Sincenode_reclaim()is only called inpage_alloc.c, move it tomm/internal.h.
Quoted 6 lines
The issue should be cosmetic but the code consistency is definitely an improvement. Moving this from
swap.hmakes a lot of sense as well.Quoted 1 line
Signed-off-by Wei Yang <[email protected]>Acked-by Michal Hocko <[email protected]>
Thanks.
Quoted 54 lines
Quoted 50 lines
---
v2: movenode_reclaim()tomm/internal.h--- include/linux/swap.h | 6 ------ mm/internal.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 6 deletions(-)include/linux/swap.h +0
-6@@ -358,14 +358,8 @@ extern unsigned long vm_total_pages;extern int node_reclaim_mode;extern int sysctl_min_unmapped_ratio;extern int sysctl_min_slab_ratio; -extern int node_reclaim (struct pglist_data *,gfp_t ,unsigned int );#else #define node_reclaim_mode 0 -static inline int node_reclaim (struct pglist_data *pgdat,gfp_t mask, -unsigned int order) -{ -return 0 ; -}#endif extern int page_evictable (struct page *page);mm/internal.h +10
-0@@ -444,6 +444,16 @@ static inline void mminit_validate_memmodel_limits(unsigned long *start_pfn,#define NODE_RECLAIM_SOME 0#define NODE_RECLAIM_SUCCESS 1 +#ifdef CONFIG_NUMA +extern int node_reclaim (struct pglist_data *,gfp_t ,unsigned int ); +#else +static inline int node_reclaim (struct pglist_data *pgdat,gfp_t mask, +unsigned int order) +{ +return NODE_RECLAIM_NOSCAN ; +} +#endif +extern int hwpoison_filter (struct page *p);extern u32 hwpoison_filter_dev_major;Signature · 1 line
2.15.1Signature · 2 lines
Michal Hocko SUSE Labs
Signature · 2 lines
Wei Yang Help you, Help me
Quoted 11 lines · Wei Yang
Commit
fa5e084e43eb("vmscan: do not unconditionally treat zones that failzone_reclaim()as full") changed the return value ofnode_reclaim(). The original return value 0 meansNODE_RECLAIM_SOMEafter this commit.While the return value of
node_reclaim()whenCONFIG_NUMAis n is not changed. This will leads to callzone_watermark_ok()again.This patch fix the return value by adjusting to
NODE_RECLAIM_NOSCAN. Sincenode_reclaim()is only called inpage_alloc.c, move it tomm/internal.h.Signed-off-by Wei Yang <[email protected]>
Quoted 8 lines · Matthew Wilcox
Quoted 7 lines · Wei Yang
Commit
fa5e084e43eb("vmscan: do not unconditionally treat zones that failzone_reclaim()as full") changed the return value ofnode_reclaim(). The original return value 0 meansNODE_RECLAIM_SOMEafter this commit.While the return value of
node_reclaim()whenCONFIG_NUMAis n is not changed. This will leads to callzone_watermark_ok()again.
Quoted 6 lines
Quoted 4 lines
This patch fix the return value by adjusting to
NODE_RECLAIM_NOSCAN. Sincenode_reclaim()is only called inpage_alloc.c, move it tomm/internal.h.Signed-off-by Wei Yang <[email protected]>Reviewed-by Matthew Wilcox <[email protected]>
Thanks
Signature · 2 lines
Wei Yang Help you, Help me
Quoted 2 lines · Wei Yang
This patch fix the return value by adjusting to
NODE_RECLAIM_NOSCAN. Sincenode_reclaim()is only called inpage_alloc.c, move it tomm/internal.h.
linux/swap.h is included in quite a few places in the kernel, but let's see what's really used from it outside mm/
SWAP_FLAG* -- only used in mm/swapfile.c. Move to swapfile.c? current_is_kswapd() -- used by some drivers.
MAX_SWAPFILES* -- used by arch code.
union swap_header -- used by mtdswap.
struct reclaim_state -- used by fs/inode.c.
struct swap_extent -- embedded in swap_info_struct, which is used widely. struct swap_cluster_info -- ditto
struct vma_swap_readahead -- only used in swap_state.c. Move it there? nr_free_pages() -- used in fs/ and kernel/power/swap.c totalram_pages -- used widelytotalreserve_pages -- used widelyvm_swappiness -- used by sysctlvm_total_pages -- only used in mm -- move to mm/internal.h? node_reclaim_mode -- used by sysctlkswapd_run -- only used in mmkswapd_stop -- dittoswap_address_space -- only used in mmswapper_spaces -- likewise
SWAP_ADDRESS_SPACE* --likewise
I haven't covered all of the file, but there's definitely opportunity for some followup patches to shrink linux/swap.h.