Re: [PATCH 5/5] mm/zswap: cleanup zswap_reclaim_entry()

From: Johannes Weiner
Date: Tue Dec 19 2023 - 23:30:46 EST


On Mon, Dec 18, 2023 at 12:52:40PM -0800, Yosry Ahmed wrote:
> --- a/mm/zswap.c
> +++ b/mm/zswap.c
> @@ -1458,15 +1458,14 @@ static int zswap_writeback_entry(struct
> zswap_entry *entry,
> page = __read_swap_cache_async(swpentry, GFP_KERNEL, mpol,
> NO_INTERLEAVE_INDEX, &page_was_allocated, true);
> if (!page) {
> - /*
> - * If we get here because the page is already in swapcache, a
> - * load may be happening concurrently. It is safe and okay to
> - * not free the entry. It is also okay to return !0.
> - */
> return -ENOMEM;
> }
>
> - /* Found an existing page, we raced with load/swapin */
> + /*
> + * Found an existing page, we raced with load/swapin. We generally
> + * writeback cold pages from zswap, and swapin means the page just
> + * became hot. Skip this page and let the caller find another one.
> + */
> if (!page_was_allocated) {
> put_page(page);
> return -EEXIST;

ACK, that looks good to me!

Thanks