Re: [PATCH v2 1/9] mm: vmscan: add validation before spliting shmem large folio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 18, 2024 at 12:54 AM Baolin Wang
<baolin.wang@xxxxxxxxxxxxxxxxx> wrote:
>
> Add swap available space validation before spliting shmem large folio to
> avoid redundant split, since we can not write shmem folio to the swap device
> in this case.

We don't scan anon LRU unless we know we may be able to swap. Even if
there is swap space, we may still not be able to swap. See
can_reclaim_anon_pages().



> Signed-off-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>
> ---
>  mm/vmscan.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 1807e5d95dda..61465f92283f 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1237,6 +1237,14 @@ static unsigned int shrink_folio_list(struct list_head *folio_list,
>                         }
>                 } else if (folio_test_swapbacked(folio) &&
>                            folio_test_large(folio)) {
> +
> +                       /*
> +                        * Do not split shmem folio if no swap memory
> +                        * available.
> +                        */
> +                       if (!total_swap_pages)
> +                               goto activate_locked;
> +
>                         /* Split shmem folio */
>                         if (split_folio_to_list(folio, folio_list))
>                                 goto keep_locked;
> --
> 2.39.3
>
>





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux