From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: akpm@linux-foundation.org
Cc: torvalds@linux-foundation.org, sj@kernel.org, hannes@cmpxchg.org,
mhocko@kernel.org, roman.gushchin@linux.dev, shakeelb@google.com,
muchun.song@linux.dev, baolin.wang@linux.alibaba.com,
damon@lists.linux.dev, cgroups@vger.kernel.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] mm: check negative error of isolate_lru_page() when failed to isolate a page
Date: Tue, 14 Feb 2023 11:18:07 +0800 [thread overview]
Message-ID: <fd5eff1f4f1225dd43748fa34c7e6c7c5f77f170.1676342827.git.baolin.wang@linux.alibaba.com> (raw)
In-Reply-To: <cover.1676342827.git.baolin.wang@linux.alibaba.com>
Better to check the negative error of isolate_lru_page() when failed to
isolate a page from its LRU, which makes the code more clear.
No functional changes.
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
mm/khugepaged.c | 2 +-
mm/memcontrol.c | 2 +-
mm/migrate.c | 4 ++--
mm/migrate_device.c | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 463dfca4b841..99a2d993b51c 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -659,7 +659,7 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma,
* Isolate the page to avoid collapsing an hugepage
* currently in use by the VM.
*/
- if (isolate_lru_page(page)) {
+ if (isolate_lru_page(page) < 0) {
unlock_page(page);
result = SCAN_DEL_PAGE_LRU;
goto out;
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 17335459d8dc..33cad66a4132 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -6226,7 +6226,7 @@ static int mem_cgroup_move_charge_pte_range(pmd_t *pmd,
*/
if (PageTransCompound(page))
goto put;
- if (!device && isolate_lru_page(page))
+ if (!device && isolate_lru_page(page) < 0)
goto put;
if (!mem_cgroup_move_account(page, false,
mc.from, mc.to)) {
diff --git a/mm/migrate.c b/mm/migrate.c
index ef68a1aff35c..eaae39564f86 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -2135,7 +2135,7 @@ static int add_page_for_migration(struct mm_struct *mm, unsigned long addr,
head = compound_head(page);
err = isolate_lru_page(head);
- if (err)
+ if (err < 0)
goto out_putpage;
err = 1;
@@ -2541,7 +2541,7 @@ static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page)
return 0;
}
- if (isolate_lru_page(page))
+ if (isolate_lru_page(page) < 0)
return 0;
mod_node_page_state(page_pgdat(page), NR_ISOLATED_ANON + page_is_file_lru(page),
diff --git a/mm/migrate_device.c b/mm/migrate_device.c
index 6c3740318a98..1ab56b5b7914 100644
--- a/mm/migrate_device.c
+++ b/mm/migrate_device.c
@@ -388,7 +388,7 @@ static unsigned long migrate_device_unmap(unsigned long *src_pfns,
allow_drain = false;
}
- if (isolate_lru_page(page)) {
+ if (isolate_lru_page(page) < 0) {
src_pfns[i] &= ~MIGRATE_PFN_MIGRATE;
restore++;
continue;
--
2.27.0
next prev parent reply other threads:[~2023-02-14 3:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-14 3:18 [PATCH 0/3] Some cleanups for page isolation Baolin Wang
2023-02-14 3:18 ` [PATCH 1/3] mm: check negative error of folio_isolate_lru() when failed to isolate a folio Baolin Wang
2023-02-14 3:18 ` Baolin Wang [this message]
2023-02-14 3:18 ` [PATCH 3/3] mm: mempolicy: check negative error of isolate_hugetlb() when failed to isolate a hugetlb Baolin Wang
2023-02-14 4:50 ` [PATCH 0/3] Some cleanups for page isolation Matthew Wilcox
2023-02-14 6:49 ` Baolin Wang
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=fd5eff1f4f1225dd43748fa34c7e6c7c5f77f170.1676342827.git.baolin.wang@linux.alibaba.com \
--to=baolin.wang@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=damon@lists.linux.dev \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shakeelb@google.com \
--cc=sj@kernel.org \
--cc=torvalds@linux-foundation.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