From: Greg KH <gregkh@linuxfoundation.org>
To: Charan Teja Kalla <quic_charante@quicinc.com>
Cc: akpm@linux-foundation.org, willy@infradead.org, vbabka@suse.cz,
dhowells@redhat.com, david@redhat.com, surenb@google.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
# see patch description <stable@vger.kernel.org>
Subject: Re: [PATCH] mm/huge_memory: fix swap entry values of tail pages of THP
Date: Tue, 13 Feb 2024 10:41:35 +0100 [thread overview]
Message-ID: <2024021309-predict-scrubber-d6f3@gregkh> (raw)
In-Reply-To: <1707814102-22682-1-git-send-email-quic_charante@quicinc.com>
On Tue, Feb 13, 2024 at 02:18:10PM +0530, Charan Teja Kalla wrote:
> An anon THP page is first added to swap cache before reclaiming it.
> Initially, each tail page contains the proper swap entry value(stored in
> ->private field) which is filled from add_to_swap_cache(). After
> migrating the THP page sitting on the swap cache, only the swap entry of
> the head page is filled(see folio_migrate_mapping()).
>
> Now when this page is tried to split(one case is when this page is again
> migrated, see migrate_pages()->try_split_thp()), the tail pages
> ->private is not stored with proper swap entry values. When this tail
> page is now try to be freed, as part of it delete_from_swap_cache() is
> called which operates on the wrong swap cache index and eventually
> replaces the wrong swap cache index with shadow/NULL value, frees the
> page.
>
> This leads to the state with a swap cache containing the freed page.
> This issue can manifest in many forms and the most common thing observed
> is the rcu stall during the swapin (see mapping_get_entry()).
>
> On the recent kernels, this issues is indirectly getting fixed with the
> series[1], to be specific[2].
Then why can we not take that series? Taking one-off patches almost
ALWAYS causes future problems, what are you going to do to prevent that
here (merge and logic problems).
> When tried to back port this series, it is observed many merge
> conflicts and also seems dependent on many other changes. As backporting
> to LTS branches is not a trivial one, the similar change from [2] is
> picked as a fix.
>
> [1] https://lore.kernel.org/all/20230821160849.531668-1-david@redhat.com/
> [2] https://lore.kernel.org/all/20230821160849.531668-5-david@redhat.com/
Again, please try to take the original series, ESPECIALLY for stuff in
-mm which is tricky and likely to blow up in odd ways in the future.
So I will not take this unless the -mm maintainers agree it really is
the only way forward.
thanks,
greg k-h
prev parent reply other threads:[~2024-02-13 9:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-13 8:48 [PATCH] mm/huge_memory: fix swap entry values of tail pages of THP Charan Teja Kalla
2024-02-13 8:54 ` Matthew Wilcox
2024-02-13 9:10 ` Charan Teja Kalla
2024-02-13 9:25 ` David Hildenbrand
2024-02-13 16:27 ` Charan Teja Kalla
2024-02-13 18:36 ` David Hildenbrand
2024-02-14 6:34 ` Charan Teja Kalla
2024-02-14 14:18 ` Matthew Wilcox
2024-02-14 14:34 ` David Hildenbrand
2024-02-27 14:11 ` David Hildenbrand
2024-02-27 14:52 ` Zi Yan
2024-02-27 15:01 ` David Hildenbrand
2024-02-27 15:20 ` Zi Yan
2024-02-27 16:15 ` Zi Yan
2024-02-28 15:36 ` Charan Teja Kalla
2024-03-04 10:48 ` Greg KH
2024-02-13 9:41 ` Greg KH [this message]
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=2024021309-predict-scrubber-d6f3@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=quic_charante@quicinc.com \
--cc=stable@vger.kernel.org \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).