Skip to content

Commit f58780a

Browse files
Gavin Shantorvalds
Gavin Shan
authored andcommitted
mm/page_reporting: export reporting order as module parameter
The macro PAGE_REPORTING_MIN_ORDER is defined as the page reporting threshold. It can't be adjusted at runtime. This introduces a variable (@page_reporting_order) to replace the marcro (PAGE_REPORTING_MIN_ORDER). MAX_ORDER is assigned to it initially, meaning the page reporting is disabled. It will be specified by driver if valid one is provided. Otherwise, it will fall back to @pageblock_order. It's also exported so that the page reporting order can be adjusted at runtime. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Gavin Shan <[email protected]> Suggested-by: David Hildenbrand <[email protected]> Reviewed-by: Alexander Duyck <[email protected]> Cc: Anshuman Khandual <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: "Michael S. Tsirkin" <[email protected]> Cc: Will Deacon <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 5631de5 commit f58780a

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3566,6 +3566,12 @@
35663566
off: turn off poisoning (default)
35673567
on: turn on poisoning
35683568

3569+
page_reporting.page_reporting_order=
3570+
[KNL] Minimal page reporting order
3571+
Format: <integer>
3572+
Adjust the minimal page reporting order. The page
3573+
reporting is disabled when it exceeds (MAX_ORDER-1).
3574+
35693575
panic= [KNL] Kernel behaviour on panic: delay <timeout>
35703576
timeout > 0: seconds before rebooting
35713577
timeout = 0: wait forever

mm/page_reporting.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@
44
#include <linux/page_reporting.h>
55
#include <linux/gfp.h>
66
#include <linux/export.h>
7+
#include <linux/module.h>
78
#include <linux/delay.h>
89
#include <linux/scatterlist.h>
910

1011
#include "page_reporting.h"
1112
#include "internal.h"
1213

14+
unsigned int page_reporting_order = MAX_ORDER;
15+
module_param(page_reporting_order, uint, 0644);
16+
MODULE_PARM_DESC(page_reporting_order, "Set page reporting order");
17+
1318
#define PAGE_REPORTING_DELAY (2 * HZ)
1419
static struct page_reporting_dev_info __rcu *pr_dev_info __read_mostly;
1520

@@ -229,7 +234,7 @@ page_reporting_process_zone(struct page_reporting_dev_info *prdev,
229234

230235
/* Generate minimum watermark to be able to guarantee progress */
231236
watermark = low_wmark_pages(zone) +
232-
(PAGE_REPORTING_CAPACITY << PAGE_REPORTING_MIN_ORDER);
237+
(PAGE_REPORTING_CAPACITY << page_reporting_order);
233238

234239
/*
235240
* Cancel request if insufficient free memory or if we failed
@@ -239,7 +244,7 @@ page_reporting_process_zone(struct page_reporting_dev_info *prdev,
239244
return err;
240245

241246
/* Process each free list starting from lowest order/mt */
242-
for (order = PAGE_REPORTING_MIN_ORDER; order < MAX_ORDER; order++) {
247+
for (order = page_reporting_order; order < MAX_ORDER; order++) {
243248
for (mt = 0; mt < MIGRATE_TYPES; mt++) {
244249
/* We do not pull pages from the isolate free list */
245250
if (is_migrate_isolate(mt))

mm/page_reporting.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@
1010
#include <linux/pgtable.h>
1111
#include <linux/scatterlist.h>
1212

13-
#define PAGE_REPORTING_MIN_ORDER pageblock_order
14-
1513
#ifdef CONFIG_PAGE_REPORTING
1614
DECLARE_STATIC_KEY_FALSE(page_reporting_enabled);
15+
extern unsigned int page_reporting_order;
1716
void __page_reporting_notify(void);
1817

1918
static inline bool page_reported(struct page *page)
@@ -38,7 +37,7 @@ static inline void page_reporting_notify_free(unsigned int order)
3837
return;
3938

4039
/* Determine if we have crossed reporting threshold */
41-
if (order < PAGE_REPORTING_MIN_ORDER)
40+
if (order < page_reporting_order)
4241
return;
4342

4443
/* This will add a few cycles, but should be called infrequently */

0 commit comments

Comments
 (0)