From: Kairui Song <ryncsn@gmail.com>
To: YoungJun Park <youngjun.park@lge.com>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
Hugh Dickins <hughd@google.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Matthew Wilcox <willy@infradead.org>,
Kemeng Shi <shikemeng@huaweicloud.com>,
Chris Li <chrisl@kernel.org>, Nhat Pham <nphamcs@gmail.com>,
Baoquan He <bhe@redhat.com>, Barry Song <baohua@kernel.org>,
linux-kernel@vger.kernel.org, gunho.lee@lge.com,
taejoon.song@lge.com
Subject: Re: [PATCH v2 3/4] mm/shmem, swap: improve mthp swapin process
Date: Mon, 23 Jun 2025 02:48:45 +0800 [thread overview]
Message-ID: <CAMgjq7DWMPOy-1z0gCs6DcPo39e95rO10gQwLUtYcZhoqCOL9w@mail.gmail.com> (raw)
In-Reply-To: <aFUTdnPTT6m0GBX0@yjaykim-PowerEdge-T330>
On Fri, Jun 20, 2025 at 3:53 PM YoungJun Park <youngjun.park@lge.com> wrote:
> On Fri, Jun 20, 2025 at 01:55:37AM +0800, Kairui Song wrote:
> > + if (skip_swapcache) {
> > + swapcache_clear(si, folio->swap, folio_nr_pages(folio));
> > + folio->swap.val = 0;
> > }
> > + if (folio)
> > + folio_put(folio);
> > put_swap_device(si);
>
> I really appreciate the patch. great work!
Hi YoungJun,
Thanks for the suggestions.
>
> It's a rather trivial point, but I was wondering if the following change
> might make sense:
> ...
> if (skip_swapcache)
> swapcache_clear(si, folio->swap, folio_nr_pages(folio));
>
> put_swap_device(si);
>
> if (folio)
> folio_put(folio);
>
> return error;
> ...
>
> My intention here is to minimize the reference to si,
The si reference is only used to prevent swapoff from releasing the
underlying swap data structures, which is trivial as the overhead is
tiny, and releasing the folio first might help reduce memory pressure
(even more trivial though).
> and from what I understand, this folio has already been allocated and would
> soon disappear. Is it possible to to reduce the clear operation?
> (folio->swap.val = 0)
Right, that might be not needed, but leaving a dangling swap entry in
the folio->private seems not a very good practice to me, so while at,
I added this clearing (folio->private is always cleared for anon
swapin that bypass swap cache). The chance of a failed
"skip_swapcache" swapin is quite low here, so I think it should be OK.
> Just a small suggestion.
> Thank you again for your work!
Thanks for the review!
> Regards,
> Youngjun Park
>
next prev parent reply other threads:[~2025-06-22 18:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-19 17:55 [PATCH v2 0/4] mm/shmem, swap: bugfix and improvement of mTHP swap in Kairui Song
2025-06-19 17:55 ` [PATCH v2 1/4] mm/shmem, swap: improve cached mTHP handling and fix potential hung Kairui Song
2025-06-23 3:26 ` Baolin Wang
2025-06-23 3:35 ` Kairui Song
2025-06-23 3:37 ` Kairui Song
2025-06-23 3:38 ` Baolin Wang
2025-06-23 3:40 ` Kairui Song
2025-06-19 17:55 ` [PATCH v2 2/4] mm/shmem, swap: avoid redundant Xarray lookup during swapin Kairui Song
2025-06-20 3:34 ` Dev Jain
2025-06-21 4:27 ` Baolin Wang
2025-06-19 17:55 ` [PATCH v2 3/4] mm/shmem, swap: improve mthp swapin process Kairui Song
2025-06-20 7:53 ` YoungJun Park
2025-06-22 18:48 ` Kairui Song [this message]
2025-06-23 3:37 ` Baolin Wang
2025-06-23 3:39 ` Kairui Song
2025-06-19 17:55 ` [PATCH v2 4/4] mm/shmem, swap: avoid false positive swap cache lookup Kairui Song
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=CAMgjq7DWMPOy-1z0gCs6DcPo39e95rO10gQwLUtYcZhoqCOL9w@mail.gmail.com \
--to=ryncsn@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=bhe@redhat.com \
--cc=chrisl@kernel.org \
--cc=gunho.lee@lge.com \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=shikemeng@huaweicloud.com \
--cc=taejoon.song@lge.com \
--cc=willy@infradead.org \
--cc=youngjun.park@lge.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;
as well as URLs for NNTP newsgroup(s).