All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gavin Shan <gshan@redhat.com>
To: linux-mm@kvack.org
Cc: alexander.duyck@gmail.com, david@redhat.com, mst@redhat.com,
	akpm@linux-foundation.org, anshuman.khandual@arm.com,
	catalin.marinas@arm.com, will@kernel.org, shan.gavin@gmail.com
Subject: [PATCH v3 3/4] mm/page_reporting: Allow driver to specify reporting order
Date: Wed, 23 Jun 2021 10:34:17 +0800	[thread overview]
Message-ID: <20210623023418.350616-4-gshan@redhat.com> (raw)
In-Reply-To: <20210623023418.350616-1-gshan@redhat.com>

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@redhat.com>
---
 include/linux/page_reporting.h | 3 +++
 mm/page_reporting.c            | 4 ++++
 2 files changed, 7 insertions(+)

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 293a8713ef7c..7c0c811948a7 100644
--- a/mm/page_reporting.c
+++ b/mm/page_reporting.c
@@ -328,6 +328,10 @@ int page_reporting_register(struct page_reporting_dev_info *prdev)
 		goto err_out;
 	}
 
+	/* Use the page reporting order if it's specified by driver */
+	page_reporting_order = prdev->order ?
+			       prdev->order : page_reporting_order;
+
 	/* initialize state and work structures */
 	atomic_set(&prdev->state, PAGE_REPORTING_IDLE);
 	INIT_DELAYED_WORK(&prdev->work, &page_reporting_process);
-- 
2.23.0



  parent reply	other threads:[~2021-06-23  0:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-23  2:34 [PATCH v3 0/4] mm/page_reporting: Make page reporting work on arm64 with 64KB page size Gavin Shan
2021-06-23  0:52 ` Alexander Duyck
2021-06-23  2:34 ` [PATCH v3 1/4] mm/page_reporting: Fix code style in __page_reporting_request() Gavin Shan
2021-06-23  2:34 ` [PATCH v3 2/4] mm/page_reporting: Export reporting order as module parameter Gavin Shan
2021-06-24 13:55   ` Alexander Duyck
2021-06-24 19:02     ` Michael S. Tsirkin
2021-06-25  1:54       ` Gavin Shan
2021-06-23  2:34 ` Gavin Shan [this message]
2021-06-23  2:34 ` [PATCH v3 4/4] virtio_balloon: Specify page reporting order if needed Gavin Shan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210623023418.350616-4-gshan@redhat.com \
    --to=gshan@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.duyck@gmail.com \
    --cc=anshuman.khandual@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=david@redhat.com \
    --cc=linux-mm@kvack.org \
    --cc=mst@redhat.com \
    --cc=shan.gavin@gmail.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.