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 1/3] mm: check negative error of folio_isolate_lru() when failed to isolate a folio
Date: Tue, 14 Feb 2023 11:18:06 +0800 [thread overview]
Message-ID: <ef7059c8442b7e1ee5f406523b79d24d19b050b6.1676342827.git.baolin.wang@linux.alibaba.com> (raw)
In-Reply-To: <cover.1676342827.git.baolin.wang@linux.alibaba.com>
The folio_isolate_lru() will return a negative error if failed to isolate
a folio from its LRU list, thus better to check the negative error to
make the code more clear per Linus's suggestion[1].
No functional changes.
[1] https://lore.kernel.org/all/CAHk-=wiBrY+O-4=2mrbVyxR+hOqfdJ=Do6xoucfJ9_5az01L4Q@mail.gmail.com/
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
mm/damon/paddr.c | 2 +-
mm/gup.c | 2 +-
mm/khugepaged.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
index b4df9b9bcc0a..ebf3dd084af2 100644
--- a/mm/damon/paddr.c
+++ b/mm/damon/paddr.c
@@ -246,7 +246,7 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s)
folio_clear_referenced(folio);
folio_test_clear_young(folio);
- if (folio_isolate_lru(folio)) {
+ if (folio_isolate_lru(folio) < 0) {
folio_put(folio);
continue;
}
diff --git a/mm/gup.c b/mm/gup.c
index b0885f70579c..7fdddd43663c 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1939,7 +1939,7 @@ static unsigned long collect_longterm_unpinnable_pages(
drain_allow = false;
}
- if (folio_isolate_lru(folio))
+ if (folio_isolate_lru(folio) < 0)
continue;
list_add_tail(&folio->lru, movable_page_list);
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index a5d32231bfad..463dfca4b841 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -2047,7 +2047,7 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr,
goto out_unlock;
}
- if (folio_isolate_lru(folio)) {
+ if (folio_isolate_lru(folio) < 0) {
result = SCAN_DEL_PAGE_LRU;
goto out_unlock;
}
--
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 ` Baolin Wang [this message]
2023-02-14 3:18 ` [PATCH 2/3] mm: check negative error of isolate_lru_page() when failed to isolate a page Baolin Wang
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=ef7059c8442b7e1ee5f406523b79d24d19b050b6.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