Skip to content

Commit

Permalink
mm: skip swap readahead when process is exiting
Browse files Browse the repository at this point in the history
It's possible for a user fault to be triggered during task exit that
results in swap readahead, which is not useful. Skip swap readahead
if the current process is exiting.

Change-Id: I5fad20ebdcc616af732254705726d395eb118cbe
Signed-off-by: Tim Murray <timmurray@google.com>

I know swap is not used with my kernel.
Just picking for future references.

Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
Signed-off-by: Raphiel Rollerscaperers <rapherion@raphielgang.org>
Signed-off-by: DennySPB <dennyspb@gmail.com>
Signed-off-by: Chenyang Zhong <zhongcy95@gmail.com>
  • Loading branch information
Tim Murray authored and Hadenix committed Feb 2, 2024
1 parent 875569a commit 85bfddf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mm/swap_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,10 @@ struct page *swapin_readahead(swp_entry_t entry, gfp_t gfp_mask,
if (!mask)
goto skip;

/* If exiting, don't do swap readahead. */
if (current->flags & PF_EXITING)
goto skip;

/* Read a page_cluster sized and aligned cluster around offset. */
start_offset = offset & ~mask;
end_offset = offset | mask;
Expand Down

0 comments on commit 85bfddf

Please sign in to comment.