From: Minchan Kim <minchan@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Suren Baghdasaryan <surenb@google.com>,
Matthew Wilcox <willy@infradead.org>,
linux-mm <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
Michal Hocko <mhocko@suse.com>, SeongJae Park <sj@kernel.org>,
Minchan Kim <minchan@kernel.org>
Subject: [PATCH 2/3] mm: return boolean for deactivate_page
Date: Tue, 17 Jan 2023 15:16:31 -0800 [thread overview]
Message-ID: <20230117231632.2734737-2-minchan@kernel.org> (raw)
In-Reply-To: <20230117231632.2734737-1-minchan@kernel.org>
Returns true if the page was successfully deactivated. The return value will
be used for statistics in next patch.
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
include/linux/swap.h | 2 +-
mm/swap.c | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 0ada46b595cd..803e5fa4cd86 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -409,7 +409,7 @@ extern void lru_add_drain(void);
extern void lru_add_drain_cpu(int cpu);
extern void lru_add_drain_cpu_zone(struct zone *zone);
extern void lru_add_drain_all(void);
-extern void deactivate_page(struct page *page);
+extern bool deactivate_page(struct page *page);
extern void mark_page_lazyfree(struct page *page);
extern void swap_setup(void);
diff --git a/mm/swap.c b/mm/swap.c
index 955930f41d20..52532859c05b 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -725,9 +725,9 @@ void deactivate_file_folio(struct folio *folio)
*
* deactivate_page() moves @page to the inactive list if @page was on the active
* list and was not an unevictable page. This is done to accelerate the reclaim
- * of @page.
+ * of @page. If page was deactivated successfully, returns true.
*/
-void deactivate_page(struct page *page)
+bool deactivate_page(struct page *page)
{
struct folio *folio = page_folio(page);
@@ -740,7 +740,9 @@ void deactivate_page(struct page *page)
fbatch = this_cpu_ptr(&cpu_fbatches.lru_deactivate);
folio_batch_add_and_move(fbatch, folio, lru_deactivate_fn);
local_unlock(&cpu_fbatches.lock);
+ return true;
}
+ return false;
}
/**
--
2.39.0.314.g84b9a713c41-goog
next prev parent reply other threads:[~2023-01-17 23:16 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-17 23:16 [PATCH 1/3] mm: return the number of pages successfully paged out Minchan Kim
2023-01-17 23:16 ` Minchan Kim [this message]
2023-01-17 23:16 ` [PATCH 3/3] mm: add vmstat statistics for madvise_[cold|pageout] Minchan Kim
2023-01-18 9:11 ` Michal Hocko
2023-01-18 17:15 ` Minchan Kim
2023-01-18 17:27 ` Michal Hocko
2023-01-18 17:55 ` Minchan Kim
2023-01-18 21:13 ` Michal Hocko
2023-01-18 21:47 ` Minchan Kim
2023-01-17 23:53 ` [PATCH 1/3] mm: return the number of pages successfully paged out Andrew Morton
2023-01-18 0:35 ` Minchan Kim
2023-01-18 0:58 ` Matthew Wilcox
2023-01-18 1:49 ` Minchan Kim
2023-01-18 9:10 ` Michal Hocko
2023-01-18 17:09 ` Minchan Kim
2023-01-18 17:35 ` Michal Hocko
2023-01-18 18:07 ` Minchan Kim
2023-01-18 21:23 ` Michal Hocko
2023-01-18 22:27 ` Minchan Kim
2023-01-19 9:07 ` Michal Hocko
2023-01-19 21:15 ` Minchan Kim
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=20230117231632.2734737-2-minchan@kernel.org \
--to=minchan@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=sj@kernel.org \
--cc=surenb@google.com \
--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;
as well as URLs for NNTP newsgroup(s).