@@ -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;
}
@@ -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);
@@ -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;
}
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(-)