[PATCH 11/11] mm: Pass order to node_reclaim() in GFP flags

Matthew Wilcox
2019-05-07T04:06:38Z

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/trace/events/vmscan.h | 8 +++-----
mm/internal.h | 5 ++---
mm/page_alloc.c | 2 +-
mm/vmscan.c | 13 ++++++-------
4 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h
index fd8b468570c8..bc5a8a6f6e64 100644
--- a/include/trace/events/vmscan.h
+++ b/include/trace/events/vmscan.h
@@ -464,25 +464,23 @@ TRACE_EVENT(mm_vmscan_inactive_list_is_low,

TRACE_EVENT(mm_vmscan_node_reclaim_begin,

- TP_PROTO(int nid, int order, gfp_t gfp_flags),
+ TP_PROTO(int nid, gfp_t gfp_flags),

- TP_ARGS(nid, order, gfp_flags),
+ TP_ARGS(nid, gfp_flags),

TP_STRUCT__entry(
__field(int, nid)
- __field(int, order)
__field(gfp_t, gfp_flags)
),

TP_fast_assign(
__entry->nid = nid;
- __entry->order = order;
__entry->gfp_flags = gfp_flags;
),

TP_printk("nid=%d order=%d gfp_flags=%s",
__entry->nid,
- __entry->order,
+ gfp_order(__entry->gfp_flags),
show_gfp_flags(__entry->gfp_flags))
);

diff --git a/mm/internal.h b/mm/internal.h
index 9eeaf2b95166..353cefdc3f34 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -457,10 +457,9 @@ static inline void mminit_validate_memmodel_limits(unsigned long *start_pfn,
#define NODE_RECLAIM_SUCCESS 1

#ifdef CONFIG_NUMA
-extern int node_reclaim(struct pglist_data *, gfp_t, unsigned int);
+extern int node_reclaim(struct pglist_data *, gfp_t);
#else
-static inline int node_reclaim(struct pglist_data *pgdat, gfp_t mask,
- unsigned int order)
+static inline int node_reclaim(struct pglist_data *pgdat, gfp_t mask)
{
return NODE_RECLAIM_NOSCAN;
}
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 5ac2cbb105c3..6ea7bda90100 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3577,7 +3577,7 @@ get_page_from_freelist(gfp_t gfp_mask, int alloc_flags,
!zone_allows_reclaim(ac->preferred_zoneref->zone, zone))
continue;

- ret = node_reclaim(zone->zone_pgdat, gfp_mask, order);
+ ret = node_reclaim(zone->zone_pgdat, gfp_mask);
switch (ret) {
case NODE_RECLAIM_NOSCAN:
/* did not scan */
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 5d465bdaf225..171844a2a8c0 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -4148,17 +4148,17 @@ static unsigned long node_pagecache_reclaimable(struct pglist_data *pgdat)
/*
* Try to free up some pages from this node through reclaim.
*/
-static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned int order)
+static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask)
{
/* Minimum pages needed in order to stay on node */
- const unsigned long nr_pages = 1 << order;
+ const unsigned long nr_pages = 1UL << gfp_order(gfp_mask);
struct task_struct *p = current;
struct reclaim_state reclaim_state;
unsigned int noreclaim_flag;
struct scan_control sc = {
.nr_to_reclaim = max(nr_pages, SWAP_CLUSTER_MAX),
.gfp_mask = current_gfp_context(gfp_mask),
- .order = order,
+ .order = gfp_order(gfp_mask),
.priority = NODE_RECLAIM_PRIORITY,
.may_writepage = !!(node_reclaim_mode & RECLAIM_WRITE),
.may_unmap = !!(node_reclaim_mode & RECLAIM_UNMAP),
@@ -4166,8 +4166,7 @@ static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned in
.reclaim_idx = gfp_zone(gfp_mask),
};

- trace_mm_vmscan_node_reclaim_begin(pgdat->node_id, order,
- sc.gfp_mask);
+ trace_mm_vmscan_node_reclaim_begin(pgdat->node_id, sc.gfp_mask);

cond_resched();
fs_reclaim_acquire(sc.gfp_mask);
@@ -4201,7 +4200,7 @@ static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned in
return sc.nr_reclaimed >= nr_pages;
}

-int node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned int order)
+int node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask)
{
int ret;

@@ -4237,7 +4236,7 @@ int node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned int order)
if (test_and_set_bit(PGDAT_RECLAIM_LOCKED, &pgdat->flags))
return NODE_RECLAIM_NOSCAN;

- ret = __node_reclaim(pgdat, gfp_mask, order);
+ ret = __node_reclaim(pgdat, gfp_mask);
clear_bit(PGDAT_RECLAIM_LOCKED, &pgdat->flags);

if (!ret)
--
2.20.1