Skip to content

Commit 6d1e871

Browse files
ryncsn1Naim
authored andcommitted
mm/mglru: remove redundant swap constrained check upon isolation
Remove the swap-constrained early reject check upon isolation. This check is a micro optimization when swap IO is not allowed, so folios are rejected early. But it is redundant and overly broad since shrink_folio_list() already handles all these cases with proper granularity. Notably, this check wrongly rejected lazyfree folios, and it doesn't cover all rejection cases. shrink_folio_list() uses may_enter_fs(), which distinguishes non-SWP_FS_OPS devices from filesystem-backed swap and does all the checks after folio is locked, so flags like swap cache are stable. This check also covers dirty file folios, which are not a problem now since sort_folio() already bumps dirty file folios to the next generation, but causes trouble for unifying dirty folio writeback handling. And there should be no performance impact from removing it. We may have lost a micro optimization, but unblocked lazyfree reclaim for NOIO contexts, which is not a common case in the first place. Signed-off-by: Kairui Song <kasong@tencent.com> Reviewed-by: Axel Rasmussen <axelrasmussen@google.com>
1 parent 0e911d6 commit 6d1e871

1 file changed

Lines changed: 0 additions & 6 deletions

File tree

mm/vmscan.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4509,12 +4509,6 @@ static bool isolate_folio(struct lruvec *lruvec, struct folio *folio, struct sca
45094509
{
45104510
bool success;
45114511

4512-
/* swap constrained */
4513-
if (!(sc->gfp_mask & __GFP_IO) &&
4514-
(folio_test_dirty(folio) ||
4515-
(folio_test_anon(folio) && !folio_test_swapcache(folio))))
4516-
return false;
4517-
45184512
/* raced with release_pages() */
45194513
if (!folio_try_get(folio))
45204514
return false;

0 commit comments

Comments
 (0)