lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210625042150.46964-4-gshan@redhat.com>
Date:   Fri, 25 Jun 2021 12:21:49 +0800
From:   Gavin Shan <gshan@...hat.com>
To:     linux-mm@...ck.org
Cc:     linux-kernel@...r.kernel.org, alexander.duyck@...il.com,
        david@...hat.com, mst@...hat.com, akpm@...ux-foundation.org,
        anshuman.khandual@....com, catalin.marinas@....com,
        will@...nel.org, shan.gavin@...il.com
Subject: [PATCH v5 3/4] mm/page_reporting: Allow driver to specify reporting

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.

Signed-off-by: Gavin Shan <gshan@...hat.com>
Reviewed-by: Alexander Duyck <alexanderduyck@...com>
---
v5: Restore @page_reporting_order to @pageblock_order when device
    is registered and minimal page reporting order isn't provided
---
 include/linux/page_reporting.h |  3 +++
 mm/page_reporting.c            | 11 ++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/include/linux/page_reporting.h b/include/linux/page_reporting.h
index 3b99e0ec24f2..fe648dfa3a7c 100644
--- a/include/linux/page_reporting.h
+++ b/include/linux/page_reporting.h
@@ -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 */
diff --git a/mm/page_reporting.c b/mm/page_reporting.c
index 133222234f25..077925cfcc06 100644
--- a/mm/page_reporting.c
+++ b/mm/page_reporting.c
@@ -319,6 +319,7 @@ DEFINE_STATIC_KEY_FALSE(page_reporting_enabled);
 
 int page_reporting_register(struct page_reporting_dev_info *prdev)
 {
+	unsigned int order;
 	int err = 0;
 
 	mutex_lock(&page_reporting_mutex);
@@ -329,9 +330,13 @@ int page_reporting_register(struct page_reporting_dev_info *prdev)
 		goto err_out;
 	}
 
-	/* Update the page reporting order with @pageblock_order */
-	if (page_reporting_order > pageblock_order)
-		page_reporting_order = pageblock_order;
+	/*
+	 * Update the page reporting order if it's specified by driver.
+	 * Otherwise, it falls back to @pageblock_order.
+	 */
+	order = prdev->order ? : pageblock_order;
+	if (page_reporting_order > order)
+		page_reporting_order = order;
 
 	/* initialize state and work structures */
 	atomic_set(&prdev->state, PAGE_REPORTING_IDLE);
-- 
2.23.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ