Message ID | 20210710100329.49174-5-linmiaohe@huawei.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Cleanup and fixup for vmscan | expand |
On Sat 10-07-21 18:03:28, Miaohe Lin wrote: > We could add 'else' to remove the somewhat odd check_pending label to > make code core succinct. Yes, this makes the code easier to follow. The two modes of throttling depending on the fs reclaim mode is more obvious now. > Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> Acked-by: Michal Hocko <mhocko@suse.com> Thanks! > --- > mm/vmscan.c | 14 +++++--------- > 1 file changed, 5 insertions(+), 9 deletions(-) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index c580bef6b885..a74760c48bd8 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -3428,18 +3428,14 @@ static bool throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist, > * blocked waiting on the same lock. Instead, throttle for up to a > * second before continuing. > */ > - if (!(gfp_mask & __GFP_FS)) { > + if (!(gfp_mask & __GFP_FS)) > wait_event_interruptible_timeout(pgdat->pfmemalloc_wait, > allow_direct_reclaim(pgdat), HZ); > + else > + /* Throttle until kswapd wakes the process */ > + wait_event_killable(zone->zone_pgdat->pfmemalloc_wait, > + allow_direct_reclaim(pgdat)); > > - goto check_pending; > - } > - > - /* Throttle until kswapd wakes the process */ > - wait_event_killable(zone->zone_pgdat->pfmemalloc_wait, > - allow_direct_reclaim(pgdat)); > - > -check_pending: > if (fatal_signal_pending(current)) > return true; > > -- > 2.23.0
diff --git a/mm/vmscan.c b/mm/vmscan.c index c580bef6b885..a74760c48bd8 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3428,18 +3428,14 @@ static bool throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist, * blocked waiting on the same lock. Instead, throttle for up to a * second before continuing. */ - if (!(gfp_mask & __GFP_FS)) { + if (!(gfp_mask & __GFP_FS)) wait_event_interruptible_timeout(pgdat->pfmemalloc_wait, allow_direct_reclaim(pgdat), HZ); + else + /* Throttle until kswapd wakes the process */ + wait_event_killable(zone->zone_pgdat->pfmemalloc_wait, + allow_direct_reclaim(pgdat)); - goto check_pending; - } - - /* Throttle until kswapd wakes the process */ - wait_event_killable(zone->zone_pgdat->pfmemalloc_wait, - allow_direct_reclaim(pgdat)); - -check_pending: if (fatal_signal_pending(current)) return true;
We could add 'else' to remove the somewhat odd check_pending label to make code core succinct. Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> --- mm/vmscan.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)