lkml.org 
[lkml]   [2023]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 02/24] mm/swapfile.c: add back some comment
    Date
    From: Kairui Song <kasong@tencent.com>

    Some useful comments were dropped in commit b56a2d8af914 ('mm: rid
    swapoff of quadratic complexity'), add them back.

    Signed-off-by: Kairui Song <kasong@tencent.com>
    ---
    mm/swapfile.c | 11 +++++++++++
    1 file changed, 11 insertions(+)

    diff --git a/mm/swapfile.c b/mm/swapfile.c
    index 4bc70f459164..756104ebd585 100644
    --- a/mm/swapfile.c
    +++ b/mm/swapfile.c
    @@ -1879,6 +1879,17 @@ static int unuse_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
    folio = page_folio(page);
    }
    if (!folio) {
    + /*
    + * The entry could have been freed, and will not
    + * be reused since swapoff() already disabled
    + * allocation from here, or alloc_page() failed.
    + *
    + * We don't hold lock here, so the swap entry could be
    + * SWAP_MAP_BAD (when the cluster is discarding).
    + * Instead of fail out, We can just skip the swap
    + * entry because swapoff will wait for discarding
    + * finish anyway.
    + */
    swp_count = READ_ONCE(si->swap_map[offset]);
    if (swp_count == 0 || swp_count == SWAP_MAP_BAD)
    continue;
    --
    2.42.0
    \
     
     \ /
      Last update: 2023-11-20 14:04    [W:4.032 / U:0.160 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site