Skip to content

Commit 9f849c6

Browse files
Gavin Shantorvalds
Gavin Shan
authored andcommitted
mm/page_reporting: allow driver to specify reporting order
The page reporting order (threshold) is sticky to @pageblock_order by default. The page reporting can never be triggered because the freeing page can't come up with a free area like that huge. The situation becomes worse when the system memory becomes heavily fragmented. For example, the following configurations are used on ARM64 when 64KB base page size is enabled. In this specific case, the page reporting won't be triggered until the freeing page comes up with a 512MB free area. That's hard to be met, especially when the system memory becomes heavily fragmented. PAGE_SIZE: 64KB HPAGE_SIZE: 512MB pageblock_order: 13 (512MB) MAX_ORDER: 14 This allows the drivers to specify the page reporting order when the page reporting device is registered. It falls back to @pageblock_order if it's not specified by the driver. The existing users (hv_balloon and virtio_balloon) don't specify it and @pageblock_order is still taken as their page reporting order. So this shouldn't introduce any functional changes. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Gavin Shan <[email protected]> Reviewed-by: Alexander Duyck <[email protected]> Cc: Anshuman Khandual <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: David Hildenbrand <[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 f58780a commit 9f849c6

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

include/linux/page_reporting.h

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ struct page_reporting_dev_info {
1818

1919
/* Current state of page reporting */
2020
atomic_t state;
21+
22+
/* Minimal order of page reporting */
23+
unsigned int order;
2124
};
2225

2326
/* Tear-down and bring-up for page reporting devices */

mm/page_reporting.c

+6
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,12 @@ int page_reporting_register(struct page_reporting_dev_info *prdev)
329329
goto err_out;
330330
}
331331

332+
/*
333+
* Update the page reporting order if it's specified by driver.
334+
* Otherwise, it falls back to @pageblock_order.
335+
*/
336+
page_reporting_order = prdev->order ? : pageblock_order;
337+
332338
/* initialize state and work structures */
333339
atomic_set(&prdev->state, PAGE_REPORTING_IDLE);
334340
INIT_DELAYED_WORK(&prdev->work, &page_reporting_process);

0 commit comments

Comments
 (0)