linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Mika Penttilä" <mpenttil@redhat.com>
To: Yosry Ahmed <yosryahmed@google.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
	Nhat Pham <nphamcs@gmail.com>,
	Chengming Zhou <chengming.zhou@linux.dev>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	Barry Song <21cnbao@gmail.com>, Chris Li <chrisl@kernel.org>,
	Ryan Roberts <ryan.roberts@arm.com>,
	David Hildenbrand <david@redhat.com>,
	Matthew Wilcox <willy@infradead.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mm: zswap: handle incorrect attempts to load of large folios
Date: Sat, 8 Jun 2024 07:08:35 +0300	[thread overview]
Message-ID: <2821278f-bc94-c147-d0fe-8cc52dbdccb1@redhat.com> (raw)
In-Reply-To: <20240608023654.3513385-1-yosryahmed@google.com>

On 6/8/24 05:36, Yosry Ahmed wrote:
> diff --git a/mm/zswap.c b/mm/zswap.c
> index b9b35ef86d9be..ebb878d3e7865 100644
> --- a/mm/zswap.c
> +++ b/mm/zswap.c
> @@ -1557,6 +1557,26 @@ bool zswap_load(struct folio *folio)
>  
>  	VM_WARN_ON_ONCE(!folio_test_locked(folio));
>  
> +	/*
> +	 * Large folios should not be swapped in while zswap is being used, as
> +	 * they are not properly handled. Zswap does not properly load large
> +	 * folios, and a large folio may only be partially in zswap.
> +	 *
> +	 * If any of the subpages are in zswap, reading from disk would result
> +	 * in data corruption, so return true without marking the folio uptodate
> +	 * so that an IO error is emitted (e.g. do_swap_page() will sigfault).
> +	 *
> +	 * Otherwise, return false and read the folio from disk.
> +	 */
> +	if (folio_test_large(folio)) {
> +		if (xa_find(tree, &offset,
> +			    offset + folio_nr_pages(folio) - 1, XA_PRESENT)) {
> +			WARN_ON_ONCE(1);
> +			return true;
> +		}

How does that work? Should it be xa_find_after() to not always find
current entry?

And does it still mean those subsequent entries map to same folio?


--Mika




  parent reply	other threads:[~2024-06-08  4:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-08  2:36 Yosry Ahmed
2024-06-08  3:13 ` Barry Song
2024-06-10 17:42   ` Yosry Ahmed
2024-06-10 20:05     ` Barry Song
2024-06-10 20:11       ` Yosry Ahmed
2024-06-10 21:00         ` Barry Song
2024-06-10 21:11           ` Yosry Ahmed
2024-06-10 23:34             ` Barry Song
2024-06-10 23:41               ` Yosry Ahmed
2024-06-11  0:02                 ` Barry Song
2024-06-08  4:08 ` Mika Penttilä [this message]
2024-06-10 17:35   ` Yosry Ahmed
2024-06-11  4:14     ` Mika Penttilä
2024-06-11 15:47       ` Yosry Ahmed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2821278f-bc94-c147-d0fe-8cc52dbdccb1@redhat.com \
    --to=mpenttil@redhat.com \
    --cc=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=chengming.zhou@linux.dev \
    --cc=chrisl@kernel.org \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=ryan.roberts@arm.com \
    --cc=willy@infradead.org \
    --cc=yosryahmed@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox