PAGE_REPORTING_ORDER_UNSPECIFIED is now set to zero. This means,
pages of order zero cannot be reported to a client/driver -- as zero
is used to signal a fallback to MAX_PAGE_ORDER.

Change PAGE_REPORTING_ORDER_UNSPECIFIED to (-1),
so that zero can be used as a valid order with which pages can
be reported.

Signed-off-by: Yuvraj Sakshith <[email protected]>
---
 include/linux/page_reporting.h | 2 +-
 mm/page_reporting.c            | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/linux/page_reporting.h b/include/linux/page_reporting.h
index d1886c657..9d4ca5c21 100644
--- a/include/linux/page_reporting.h
+++ b/include/linux/page_reporting.h
@@ -7,7 +7,7 @@
 
 /* This value should always be a power of 2, see page_reporting_cycle() */
 #define PAGE_REPORTING_CAPACITY                32
-#define PAGE_REPORTING_ORDER_UNSPECIFIED       0
+#define PAGE_REPORTING_ORDER_UNSPECIFIED       -1
 
 struct page_reporting_dev_info {
        /* function that alters pages to make them "reported" */
diff --git a/mm/page_reporting.c b/mm/page_reporting.c
index 51cd88faf..21c11b75e 100644
--- a/mm/page_reporting.c
+++ b/mm/page_reporting.c
@@ -25,7 +25,12 @@ static int page_order_update_notify(const char *val, const 
struct kernel_param *
 
 static const struct kernel_param_ops page_reporting_param_ops = {
        .set = &page_order_update_notify,
-       .get = &param_get_uint,
+       /*
+        * For the get op, use param_get_int instead of param_get_uint.
+        * This is to make sure that when unset the initialized value of
+        * -1 is shown correctly
+        */
+       .get = &param_get_int,
 };
 
 module_param_cb(page_reporting_order, &page_reporting_param_ops,
-- 
2.34.1


Reply via email to