From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,yuzhao@google.com,david@redhat.com,baolin.wang@linux.alibaba.com,yangge1116@126.com,akpm@linux-foundation.org
Subject: + mm-swap-take-folio-refcount-after-testing-the-lru-flag.patch added to mm-unstable branch
Date: Tue, 13 Aug 2024 13:15:25 -0700 [thread overview]
Message-ID: <20240813201526.3CBEEC32782@smtp.kernel.org> (raw)
The patch titled
Subject: mm/swap: take folio refcount after testing the LRU flag
has been added to the -mm mm-unstable branch. Its filename is
mm-swap-take-folio-refcount-after-testing-the-lru-flag.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-swap-take-folio-refcount-after-testing-the-lru-flag.patch
This patch will later appear in the mm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: yangge <yangge1116@126.com>
Subject: mm/swap: take folio refcount after testing the LRU flag
Date: Tue, 13 Aug 2024 17:52:23 +0800
Whoever passes a folio to __folio_batch_add_and_move() must hold a
reference, otherwise something else would already be messed up. If the
folio is referenced, it will not be freed elsewhere, so we can safely
clear the folio's lru flag. As discussed with David in [1], we should
take the reference after testing the LRU flag, not before.
Link: https://lore.kernel.org/lkml/d41865b4-d6fa-49ba-890a-921eefad27dd@redhat.com/ [1]
Link: https://lkml.kernel.org/r/1723542743-32179-1-git-send-email-yangge1116@126.com
Signed-off-by: yangge <yangge1116@126.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Yu Zhao <yuzhao@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/swap.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
--- a/mm/swap.c~mm-swap-take-folio-refcount-after-testing-the-lru-flag
+++ a/mm/swap.c
@@ -226,12 +226,10 @@ static void __folio_batch_add_and_move(s
{
unsigned long flags;
- folio_get(folio);
-
- if (on_lru && !folio_test_clear_lru(folio)) {
- folio_put(folio);
+ if (on_lru && !folio_test_clear_lru(folio))
return;
- }
+
+ folio_get(folio);
if (disable_irq)
local_lock_irqsave(&cpu_fbatches.lock_irq, flags);
_
Patches currently in -mm which might be from yangge1116@126.com are
mm-swap-take-folio-refcount-after-testing-the-lru-flag.patch
reply other threads:[~2024-08-13 20:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240813201526.3CBEEC32782@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@redhat.com \
--cc=mm-commits@vger.kernel.org \
--cc=yangge1116@126.com \
--cc=yuzhao@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.