From: Andrew Morton <akpm@linux-foundation.org>
To: akpm@linux-foundation.org, apopple@nvidia.com,
baolin.wang@linux.alibaba.com, linux-mm@kvack.org,
mm-commits@vger.kernel.org, shy828301@gmail.com,
torvalds@linux-foundation.org, willy@infradead.org
Subject: [patch 3/7] mm: migrate: simplify the file-backed pages validation when migrating its mapping
Date: Wed, 10 Nov 2021 20:32:37 -0800 [thread overview]
Message-ID: <20211111043237.NQd7m0u64%akpm@linux-foundation.org> (raw)
In-Reply-To: <20211110203204.37de96048c3279ab2da758a5@linux-foundation.org>
From: Baolin Wang <baolin.wang@linux.alibaba.com>
Subject: mm: migrate: simplify the file-backed pages validation when migrating its mapping
There is no need to validate the file-backed page's refcount before trying
to freeze the page's expected refcount, instead we can rely on the
folio_ref_freeze() to validate if the page has the expected refcount
before migrating its mapping.
Moreover we are always under the page lock when migrating the page
mapping, which means nowhere else can remove it from the page cache, so we
can remove the xas_load() validation under the i_pages lock.
Link: https://lkml.kernel.org/r/cover.1629447552.git.baolin.wang@linux.alibaba.com
Link: https://lkml.kernel.org/r/df4c129fd8e86a95dbc55f4663d77441cc0d3bd1.1629447552.git.baolin.wang@linux.alibaba.com
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Suggested-by: Matthew Wilcox <willy@infradead.org>
Cc: Yang Shi <shy828301@gmail.com>
Cc: Alistair Popple <apopple@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/migrate.c | 6 ------
1 file changed, 6 deletions(-)
--- a/mm/migrate.c~mm-migrate-simplify-the-file-backed-pages-validation-when-migrating-its-mapping
+++ a/mm/migrate.c
@@ -404,12 +404,6 @@ int folio_migrate_mapping(struct address
newzone = folio_zone(newfolio);
xas_lock_irq(&xas);
- if (folio_ref_count(folio) != expected_count ||
- xas_load(&xas) != folio) {
- xas_unlock_irq(&xas);
- return -EAGAIN;
- }
-
if (!folio_ref_freeze(folio, expected_count)) {
xas_unlock_irq(&xas);
return -EAGAIN;
_
next prev parent reply other threads:[~2021-11-11 4:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-11 4:32 incoming Andrew Morton
2021-11-11 4:32 ` [patch 1/7] mm/page_owner.c: modify the type of argument "order" in some functions Andrew Morton
2021-11-11 4:32 ` [patch 2/7] mm: allow only SLUB on PREEMPT_RT Andrew Morton
2021-11-11 4:32 ` Andrew Morton [this message]
2021-11-11 4:32 ` [patch 4/7] mm/migrate.c: remove MIGRATE_PFN_LOCKED Andrew Morton
2021-11-11 4:32 ` [patch 5/7] mm: unexport folio_memcg_{,un}lock Andrew Morton
2021-11-11 4:32 ` [patch 6/7] mm: unexport {,un}lock_page_memcg Andrew Morton
2021-11-11 4:32 ` [patch 7/7] kasan: add kasan mode messages when kasan init Andrew Morton
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=20211111043237.NQd7m0u64%akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=linux-mm@kvack.org \
--cc=mm-commits@vger.kernel.org \
--cc=shy828301@gmail.com \
--cc=torvalds@linux-foundation.org \
--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