]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
mm/page_reporting: allow driver to specify reporting order
authorGavin Shan <gshan@redhat.com>
Tue, 29 Jun 2021 02:35:22 +0000 (19:35 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 29 Jun 2021 17:53:47 +0000 (10:53 -0700)
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/20210625014710.42954-4-gshan@redhat.com
Signed-off-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/page_reporting.h
mm/page_reporting.c

index 3b99e0ec24f22548cb00e19e2baa8968f24fe880..fe648dfa3a7caef9ab262ad52d321362f4312ff4 100644 (file)
@@ -18,6 +18,9 @@ struct page_reporting_dev_info {
 
        /* Current state of page reporting */
        atomic_t state;
+
+       /* Minimal order of page reporting */
+       unsigned int order;
 };
 
 /* Tear-down and bring-up for page reporting devices */
index 34bf4d26c2c4623e31b3253a2b6340b0690df29f..382958eef8a928527026a8b88cfb1bcf1105c33a 100644 (file)
@@ -329,6 +329,12 @@ int page_reporting_register(struct page_reporting_dev_info *prdev)
                goto err_out;
        }
 
+       /*
+        * Update the page reporting order if it's specified by driver.
+        * Otherwise, it falls back to @pageblock_order.
+        */
+       page_reporting_order = prdev->order ? : pageblock_order;
+
        /* initialize state and work structures */
        atomic_set(&prdev->state, PAGE_REPORTING_IDLE);
        INIT_DELAYED_WORK(&prdev->work, &page_reporting_process);