Skip to contentSkip to conversation

mm: Make zone_reclaim() return ZONE_RECLAIM_NOSCAN not zero

PATCH In review [email protected] 2 participants 2 messages Jun 26, 2015 – Jun 29, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: Make zone_reclaim() return ZONE_RECLAIM_NOSCAN not zero

From: "sh.yoon" <[email protected]>

When zone watermark is not ok in get_page_from_freelist(), we call zone_reclaim(). But !CONFIG_NUMA system`s zone_reclaim() just returns zero. Zero means ZONE_RECLAIM_SOME and check zone watermark again needlessly.

To avoid needless zone watermark check, change it as ZONE_RECLAIM_NOSCAN.

---
 include/linux/swap.h | 7 ++++++-
 mm/internal.h        | 5 -----
 2 files changed, 6 insertions(+), 6 deletions(-)
include/linux/swap.h +6 -1
index 3887472..e04e435 100644
@@ -332,6 +332,11 @@ extern int vm_swappiness;
 extern int remove_mapping(struct address_space *mapping, struct page *page);
 extern unsigned long vm_total_pages;
 
+#define ZONE_RECLAIM_NOSCAN	-2
+#define ZONE_RECLAIM_FULL	-1
+#define ZONE_RECLAIM_SOME	0
+#define ZONE_RECLAIM_SUCCESS	1
+
 #ifdef CONFIG_NUMA
 extern int zone_reclaim_mode;
 extern int sysctl_min_unmapped_ratio;
@@ -341,7 +346,7 @@ extern int zone_reclaim(struct zone *, gfp_t, unsigned int);
 #define zone_reclaim_mode 0
 static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
 {
-	return 0;
+	return ZONE_RECLAIM_NOSCAN;
 }
 #endif
 
mm/internal.h +0 -5
index a25e359..d8ec7f8 100644
@@ -397,11 +397,6 @@ static inline void mminit_validate_memmodel_limits(unsigned long *start_pfn,
 }
 #endif /* CONFIG_SPARSEMEM */
 
-#define ZONE_RECLAIM_NOSCAN	-2
-#define ZONE_RECLAIM_FULL	-1
-#define ZONE_RECLAIM_SOME	0
-#define ZONE_RECLAIM_SUCCESS	1
-
 extern int hwpoison_filter(struct page *p);
 
 extern u32 hwpoison_filter_dev_major;
Signature · 7 lines
2.1.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw
Quoted 5 lines · On Fri 26-06-15 11:39:08, [email protected] wrote:

From: "sh.yoon" <[email protected]>

When zone watermark is not ok in get_page_from_freelist(), we call zone_reclaim(). But !CONFIG_NUMA system`s zone_reclaim() just returns zero. Zero means ZONE_RECLAIM_SOME and check zone watermark again needlessly.

The return value might be indeed confusing, but

Quoted 1 line

To avoid needless zone watermark check, change it as ZONE_RECLAIM_NOSCAN.

this shouldn't happen because zone_reclaim_mode is always 0 for !CONFIG_NUMA so we do not even get to call zone_reclaim. So this part of the changelog is misleading.

Quoted 55 lines
---
 include/linux/swap.h | 7 ++++++-
 mm/internal.h        | 5 -----
 2 files changed, 6 insertions(+), 6 deletions(-)
include/linux/swap.h +6 -1
index 3887472..e04e435 100644
@@ -332,6 +332,11 @@ extern int vm_swappiness;
 extern int remove_mapping(struct address_space *mapping, struct page *page);
 extern unsigned long vm_total_pages;
 
+#define ZONE_RECLAIM_NOSCAN	-2
+#define ZONE_RECLAIM_FULL	-1
+#define ZONE_RECLAIM_SOME	0
+#define ZONE_RECLAIM_SUCCESS	1
+
 #ifdef CONFIG_NUMA
 extern int zone_reclaim_mode;
 extern int sysctl_min_unmapped_ratio;
@@ -341,7 +346,7 @@ extern int zone_reclaim(struct zone *, gfp_t, unsigned int);
 #define zone_reclaim_mode 0
 static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
 {
-	return 0;
+	return ZONE_RECLAIM_NOSCAN;
 }
 #endif
 
mm/internal.h +0 -5
index a25e359..d8ec7f8 100644
@@ -397,11 +397,6 @@ static inline void mminit_validate_memmodel_limits(unsigned long *start_pfn,
 }
 #endif /* CONFIG_SPARSEMEM */
 
-#define ZONE_RECLAIM_NOSCAN	-2
-#define ZONE_RECLAIM_FULL	-1
-#define ZONE_RECLAIM_SOME	0
-#define ZONE_RECLAIM_SUCCESS	1
-
 extern int hwpoison_filter(struct page *p);
 
 extern u32 hwpoison_filter_dev_major;
Signature · 7 lines
2.1.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Signature · 8 lines
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>