2020-12-22 08:11:24

by Liang Li

[permalink] [raw]
Subject: [RFC PATCH 0/3 updated] add support for free hugepage reporting

A typical usage of hugetlbfs it's to reserve amount of memory during
kernel booting, and the reserved pages are unlikely to return to the
buddy system. When application need hugepages, kernel will allocate
them from the reserved pool. when application terminates, huge pages
will return to the reserved pool and are kept in the free list for
hugetlb, these free pages will not return to buddy freelist unless
the size fo reserved pool is changed.
Free page reporting only supports buddy pages, it can't report the
free pages reserved for hugetlbfs. On the other hand, hugetlbfs
is a good choice for system with a huge amount of RAM, because it
can help to reduce the memory management overhead and improve system
performance.
This patch add the support for reporting hugepages in the free list
of hugetlb, it can be used by virtio_balloon driver for memory
overcommit and pre zero out free pages for speeding up memory
population and page fault handling.

Most of the code are 'copied' from free page reporting because they
are working in the same way. So the code can be refined to remove
the duplicated code. Since this is an RFC, I didn't do that.

For the virtio_balloon driver, changes for the virtio spec are needed.
Before that, I need the feedback of the comunity about this new feature.

This RFC is baed on my previous series:
'[RFC v2 PATCH 0/4] speed up page allocation for __GFP_ZERO'

Liang Li (3):
mm: support hugetlb free page reporting
virtio-balloon: add support for providing free huge page reports to
host
mm: support free hugepage pre zero out

drivers/virtio/virtio_balloon.c | 61 ++++++
include/linux/hugetlb.h | 3 +
include/linux/page_reporting.h | 5 +
include/uapi/linux/virtio_balloon.h | 1 +
mm/hugetlb.c | 29 +++
mm/page_prezero.c | 17 ++
mm/page_reporting.c | 287 ++++++++++++++++++++++++++++
mm/page_reporting.h | 34 ++++
8 files changed, 437 insertions(+)

Cc: Alexander Duyck <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Alex Williamson <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: Mike Kravetz <[email protected]>
Cc: Liang Li <[email protected]>
--
2.18.2