Skip to content

Commit 57f2976

Browse files
hnaztorvalds
authored andcommitted
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/[email protected]/) could soon make this a more common codepath again. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Johannes Weiner <[email protected]> Reported-by: Rik van Riel <[email protected]> Reviewed-by: Shakeel Butt <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent fcc0062 commit 57f2976

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

mm/vmscan.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4424,11 +4424,13 @@ static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned in
44244424
.may_swap = 1,
44254425
.reclaim_idx = gfp_zone(gfp_mask),
44264426
};
4427+
unsigned long pflags;
44274428

44284429
trace_mm_vmscan_node_reclaim_begin(pgdat->node_id, order,
44294430
sc.gfp_mask);
44304431

44314432
cond_resched();
4433+
psi_memstall_enter(&pflags);
44324434
fs_reclaim_acquire(sc.gfp_mask);
44334435
/*
44344436
* 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
44534455
current->flags &= ~PF_SWAPWRITE;
44544456
memalloc_noreclaim_restore(noreclaim_flag);
44554457
fs_reclaim_release(sc.gfp_mask);
4458+
psi_memstall_leave(&pflags);
44564459

44574460
trace_mm_vmscan_node_reclaim_end(sc.nr_reclaimed);
44584461

0 commit comments

Comments
 (0)