[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0bbda135-068a-45bd-afd6-3f5cdf4e570d@redhat.com>
Date: Mon, 8 Sep 2025 14:18:17 +0200
From: David Hildenbrand <david@...hat.com>
To: Kairui Song <kasong@...cent.com>, linux-mm@...ck.org
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Matthew Wilcox <willy@...radead.org>, Hugh Dickins <hughd@...gle.com>,
Chris Li <chrisl@...nel.org>, Barry Song <baohua@...nel.org>,
Baoquan He <bhe@...hat.com>, Nhat Pham <nphamcs@...il.com>,
Kemeng Shi <shikemeng@...weicloud.com>,
Baolin Wang <baolin.wang@...ux.alibaba.com>,
Ying Huang <ying.huang@...ux.alibaba.com>,
Johannes Weiner <hannes@...xchg.org>, Yosry Ahmed <yosryahmed@...gle.com>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, Zi Yan <ziy@...dia.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 05/15] mm, swap: always lock and check the swap cache
folio before use
>
> folio_lock(folio);
> + if (!folio_matches_swap_entry(folio, entry)) {
> + folio_unlock(folio);
> + folio_put(folio);
> + continue;
> + }
> +
I wonder if we should put that into unuse_pte() instead. It checks for
other types of races (like the page table entry getting modified) already.
--
Cheers
David / dhildenb
Powered by blists - more mailing lists