From: Chris Li <chrisl@kernel.org>
To: Youngjun Park <youngjun.park@lge.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, Kemeng Shi <shikemeng@huaweicloud.com>,
Kairui Song <kasong@tencent.com>, Nhat Pham <nphamcs@gmail.com>,
Baoquan He <bhe@redhat.com>, Barry Song <baohua@kernel.org>
Subject: Re: [PATCH v2 3/5] mm, swap: Remove redundant comment for read_swap_cache_async
Date: Tue, 4 Nov 2025 22:03:19 -0800 [thread overview]
Message-ID: <CACePvbXO8oSH+-igG1pNFueB5JdoDOadV0n9DNN++iMWgCDiPA@mail.gmail.com> (raw)
In-Reply-To: <20251031065011.40863-4-youngjun.park@lge.com>
On Thu, Oct 30, 2025 at 11:54 PM Youngjun Park <youngjun.park@lge.com> wrote:
>
> The function now manages get/put_swap_device() internally, making the
> comment explaining this behavior to callers unnecessary.
This commit message is not precise. The previous comment explaining
this behavior is not just unnecessary. The comment is plain wrong. It
does not match the code. __read_swap_cache_async() does not internally
call get/put_swap_device() any more. So this comment regarding
get/put_swap_device should move to __read_swap_cache_async(), the
caller of __read_swap_cache_async() needs to manage the
get/put_swap_device() or by other means not to race with swap off.
>
> Signed-off-by: Youngjun Park <youngjun.park@lge.com>
>
> diff --git a/mm/swap_state.c b/mm/swap_state.c
> index b13e9c4baa90..d20d238109f9 100644
> --- a/mm/swap_state.c
> +++ b/mm/swap_state.c
> @@ -509,10 +509,6 @@ struct folio *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask,
> * and reading the disk if it is not already cached.
> * A failure return means that either the page allocation failed or that
> * the swap entry is no longer in use.
> - *
> - * get/put_swap_device() aren't needed to call this function, because
> - * __read_swap_cache_async() call them and swap_read_folio() holds the
> - * swap cache folio lock.
I don't think we should simply delete this comment. We can delete from
this function but please add a comment to __read_swap_cache_async()
regarding the caller's responsibility.
Chris
next prev parent reply other threads:[~2025-11-05 6:03 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-31 6:50 [PATCH v2 0/5] mm: swap: small fixes and comment cleanups Youngjun Park
2025-10-31 6:50 ` [PATCH v2 1/5] mm, swap: Fix memory leak in setup_clusters() error path Youngjun Park
2025-11-01 0:01 ` Baoquan He
2025-11-05 4:30 ` Chris Li
2025-10-31 6:50 ` [PATCH v2 2/5] mm, swap: Use SWP_SOLIDSTATE to determine if swap is rotational Youngjun Park
2025-11-01 0:02 ` Baoquan He
2025-11-05 4:30 ` Chris Li
2025-10-31 6:50 ` [PATCH v2 3/5] mm, swap: Remove redundant comment for read_swap_cache_async Youngjun Park
2025-11-01 0:02 ` Baoquan He
2025-11-05 6:03 ` Chris Li [this message]
2025-11-05 7:58 ` Chris Li
2025-11-05 9:27 ` YoungJun Park
2025-11-06 0:29 ` Andrew Morton
2025-11-20 5:00 ` Chris Li
2025-11-20 16:54 ` Andrew Morton
2025-11-20 18:34 ` Chris Li
2025-10-31 6:50 ` [PATCH v2 4/5] mm: swap: change swap_alloc_slow() to void Youngjun Park
2025-11-01 0:03 ` Baoquan He
2025-11-05 6:04 ` Chris Li
2025-10-31 6:50 ` [PATCH v2 5/5] mm: swap: remove scan_swap_map_slots() references from comments Youngjun Park
2025-11-01 0:03 ` Baoquan He
2025-11-05 6:50 ` Chris Li
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=CACePvbXO8oSH+-igG1pNFueB5JdoDOadV0n9DNN++iMWgCDiPA@mail.gmail.com \
--to=chrisl@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=bhe@redhat.com \
--cc=kasong@tencent.com \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=shikemeng@huaweicloud.com \
--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