From: Hugh Dickins <hughd@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>,
Hugh Dickins <hughd@google.com>, Baoquan He <bhe@redhat.com>,
Barry Song <21cnbao@gmail.com>, Chris Li <chrisl@kernel.org>,
David Rientjes <rientjes@google.com>,
Kairui Song <ryncsn@gmail.com>,
Kemeng Shi <shikemeng@huaweicloud.com>,
Shakeel Butt <shakeel.butt@linux.dev>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH mm-unstable] mm/shmem: writeout free swap if swap_writeout() reactivates fix
Date: Fri, 18 Jul 2025 17:56:52 -0700 (PDT) [thread overview]
Message-ID: <101a7d89-290c-545d-8a6d-b1174ed8b1e5@google.com> (raw)
In-Reply-To: <853a5211-cdab-4bdf-b0c4-8092dd943ff5@linux.alibaba.com>
Per Baolin: use shmem_recalc_inode() rather than open coding.
Signed-off-by: Hugh Dickins <hughd@google.com>
---
mm/shmem.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index 5a7ce4c8bad6..927ccc4a6002 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1692,9 +1692,7 @@ int shmem_writeout(struct folio *folio, struct swap_iocb **plug,
__GFP_HIGH | __GFP_NOMEMALLOC | __GFP_NOWARN);
/* Swap entry might be erased by racing shmem_free_swap() */
if (!error) {
- spin_lock(&info->lock);
- info->swapped -= nr_pages;
- spin_unlock(&info->lock);
+ shmem_recalc_inode(inode, 0, -nr_pages);
swap_free_nr(folio->swap, nr_pages);
}
--
2.43.0
next prev parent reply other threads:[~2025-07-19 0:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-16 8:05 [PATCH mm-new 1/2] mm/shmem: hold shmem_swaplist spinlock (not mutex) much less Hugh Dickins
2025-07-16 8:08 ` [PATCH mm-new 2/2] mm/shmem: writeout free swap if swap_writeout() reactivates Hugh Dickins
2025-07-17 9:44 ` Baolin Wang
2025-07-19 0:51 ` Hugh Dickins
2025-07-19 4:32 ` Baolin Wang
2025-07-19 0:56 ` Hugh Dickins [this message]
2025-07-20 7:07 ` David Rientjes
2025-07-17 8:46 ` [PATCH mm-new 1/2] mm/shmem: hold shmem_swaplist spinlock (not mutex) much less Baolin Wang
2025-07-20 7:07 ` David Rientjes
2025-07-21 17:54 ` 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=101a7d89-290c-545d-8a6d-b1174ed8b1e5@google.com \
--to=hughd@google.com \
--cc=21cnbao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=bhe@redhat.com \
--cc=chrisl@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=ryncsn@gmail.com \
--cc=shakeel.butt@linux.dev \
--cc=shikemeng@huaweicloud.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
all inboxes | Powered by JetHome®