mm: vmscan: fix missing psi annotation for node_reclaim()

In a debugging session the other day, Rik noticed that node_reclaim()
was missing memstall annotations.  This means we'll miss pressure and
lost productivity resulting from reclaim on an overloaded local NUMA
node when vm.zone_reclaim_mode is enabled.

There haven't been any reports, but that's likely because
vm.zone_reclaim_mode hasn't been a commonly used feature recently, and
the intersection between such setups and psi users is probably nil.

But secondary memory such as CXL-connected DIMMS, persistent memory etc,
and the page demotion patches that handle them
(https://lore.kernel.org/lkml/20210401183216.443C4443@viggo.jf.intel.com/)
could soon make this a more common codepath again.

Link: https://lkml.kernel.org/r/20210818152457.35846-1-hannes@cmpxchg.org
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Reported-by: Rik van Riel <riel@surriel.com>
Reviewed-by: Shakeel Butt <shakeelb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Johannes Weiner 2021-08-19 19:04:27 -07:00 коммит произвёл Linus Torvalds
Родитель fcc00621d8
Коммит 57f29762cd
1 изменённых файлов: 3 добавлений и 0 удалений

Просмотреть файл

@ -4424,11 +4424,13 @@ static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned in
.may_swap = 1, .may_swap = 1,
.reclaim_idx = gfp_zone(gfp_mask), .reclaim_idx = gfp_zone(gfp_mask),
}; };
unsigned long pflags;
trace_mm_vmscan_node_reclaim_begin(pgdat->node_id, order, trace_mm_vmscan_node_reclaim_begin(pgdat->node_id, order,
sc.gfp_mask); sc.gfp_mask);
cond_resched(); cond_resched();
psi_memstall_enter(&pflags);
fs_reclaim_acquire(sc.gfp_mask); fs_reclaim_acquire(sc.gfp_mask);
/* /*
* We need to be able to allocate from the reserves for RECLAIM_UNMAP * We need to be able to allocate from the reserves for RECLAIM_UNMAP
@ -4453,6 +4455,7 @@ static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned in
current->flags &= ~PF_SWAPWRITE; current->flags &= ~PF_SWAPWRITE;
memalloc_noreclaim_restore(noreclaim_flag); memalloc_noreclaim_restore(noreclaim_flag);
fs_reclaim_release(sc.gfp_mask); fs_reclaim_release(sc.gfp_mask);
psi_memstall_leave(&pflags);
trace_mm_vmscan_node_reclaim_end(sc.nr_reclaimed); trace_mm_vmscan_node_reclaim_end(sc.nr_reclaimed);