[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240512193657.79298-4-sj@kernel.org>
Date: Sun, 12 May 2024 12:36:54 -0700
From: SeongJae Park <sj@...nel.org>
To:
Cc: SeongJae Park <sj@...nel.org>,
damon@...ts.linux.dev,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: [RFC IDEA v2 3/6] mm/page_reporting: implement a function for reporting specific pfn range
Implement a function for reporting pages of specific pfn range, for
non-free pages reporting use case. The use case will be implemented by
following commits.
Signed-off-by: SeongJae Park <sj@...nel.org>
---
mm/page_reporting.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/mm/page_reporting.c b/mm/page_reporting.c
index e4c428e61d8c..e14f2e979f16 100644
--- a/mm/page_reporting.c
+++ b/mm/page_reporting.c
@@ -349,6 +349,33 @@ static void page_reporting_process(struct work_struct *work)
static DEFINE_MUTEX(page_reporting_mutex);
DEFINE_STATIC_KEY_FALSE(page_reporting_enabled);
+#ifdef CONFIG_ACMA
+
+int page_report(unsigned long pfn, unsigned long nr_pages)
+{
+ struct page_reporting_dev_info *prdev;
+ struct scatterlist sgl;
+ int err;
+
+ rcu_read_lock();
+
+ prdev = rcu_dereference(pr_dev_info);
+ if (!prdev || !prdev->report) {
+ rcu_read_unlock();
+ return -ENOENT;
+ }
+
+ sg_init_table(&sgl, 1);
+ sg_set_page(&sgl, NULL, nr_pages << PAGE_SHIFT, 0);
+ sgl.dma_address = PFN_PHYS(pfn);
+
+ err = prdev->report(prdev, sgl, 1);
+ rcu_read_unlock();
+ return err;
+}
+
+#endif
+
int page_reporting_register(struct page_reporting_dev_info *prdev)
{
int err = 0;
--
2.39.2
Powered by blists - more mailing lists