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 4/4] virtio_balloon: Specify page reporting order if needed
Date: Wed, 23 Jun 2021 10:34:18 +0800 [thread overview]
Message-ID: <20210623023418.350616-5-gshan@redhat.com> (raw)
In-Reply-To: <20210623023418.350616-1-gshan@redhat.com>
The page reporting won't be triggered if the freeing page can't come
up with a free area, whose size is equal or bigger than the threshold
(page reporting order). The default page reporting order, equal to
@pageblock_order, is too huge on some architectures to trigger page
reporting. One example is ARM64 when 64KB base page size is used.
PAGE_SIZE: 64KB
pageblock_order: 13 (512MB)
MAX_ORDER: 14
This specifies the page reporting order to 5 (2MB) for this specific
case so that page reporting can be triggered.
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
---
drivers/virtio/virtio_balloon.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 510e9318854d..47dce91f788c 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -993,6 +993,23 @@ static int virtballoon_probe(struct virtio_device *vdev)
goto out_unregister_oom;
}
+ /*
+ * The default page reporting order is @pageblock_order, which
+ * corresponds to 512MB in size on ARM64 when 64KB base page
+ * size is used. The page reporting won't be triggered if the
+ * freeing page can't come up with a free area like that huge.
+ * So we specify the page reporting order to 5, corresponding
+ * to 2MB. It helps to avoid THP splitting if 4KB base page
+ * size is used by host.
+ *
+ * Ideally, the page reporting order is selected based on the
+ * host's base page size. However, it needs more work to report
+ * that value. The hard-coded order would be fine currently.
+ */
+#if defined(CONFIG_ARM64) && defined(CONFIG_ARM64_64K_PAGES)
+ vb->pr_dev_info.order = 5;
+#endif
+
err = page_reporting_register(&vb->pr_dev_info);
if (err)
goto out_unregister_oom;
--
2.23.0
prev 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 ` [PATCH v3 3/4] mm/page_reporting: Allow driver to specify reporting order Gavin Shan
2021-06-23 2:34 ` Gavin Shan [this message]
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-5-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).