* [PATCH] mm/hugetlb: optimize minimum size (min_size) accounting
@ 2016-03-25 23:44 Mike Kravetz
2016-03-31 1:00 ` Naoya Horiguchi
0 siblings, 1 reply; 2+ messages in thread
From: Mike Kravetz @ 2016-03-25 23:44 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: Naoya Horiguchi, Hillf Danton, David Rientjes, Dave Hansen,
Kirill A. Shutemov, Andrew Morton, Paul Gortmaker, Mike Kravetz
It was observed that minimum size accounting associated with the
hugetlbfs min_size mount option may not perform optimally and as
expected. As huge pages/reservations are released from the filesystem
and given back to the global pools, they are reserved for subsequent
filesystem use as long as the subpool reserved count is less than
subpool minimum size. It does not take into account used pages
within the filesystem. The filesystem size limits are not exceeded
and this is technically not a bug. However, better behavior would
be to wait for the number of used pages/reservations associated with
the filesystem to drop below the minimum size before taking reservations
to satisfy minimum size.
An optimization is also made to the hugepage_subpool_get_pages()
routine which is called when pages/reservations are allocated. This
does not change behavior, but simply avoids the accounting if all
reservations have already been taken (subpool reserved count == 0).
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
---
mm/hugetlb.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 06058ea..b9bfcf1 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -144,7 +144,8 @@ static long hugepage_subpool_get_pages(struct hugepage_subpool *spool,
}
}
- if (spool->min_hpages != -1) { /* minimum size accounting */
+ /* minimum size accounting */
+ if (spool->min_hpages != -1 && spool->rsv_hpages) {
if (delta > spool->rsv_hpages) {
/*
* Asking for more reserves than those already taken on
@@ -182,7 +183,8 @@ static long hugepage_subpool_put_pages(struct hugepage_subpool *spool,
if (spool->max_hpages != -1) /* maximum size accounting */
spool->used_hpages -= delta;
- if (spool->min_hpages != -1) { /* minimum size accounting */
+ /* minimum size accounting */
+ if (spool->min_hpages != -1 && spool->used_hpages < spool->min_hpages) {
if (spool->rsv_hpages + delta <= spool->min_hpages)
ret = 0;
else
--
2.4.3
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/hugetlb: optimize minimum size (min_size) accounting
2016-03-25 23:44 [PATCH] mm/hugetlb: optimize minimum size (min_size) accounting Mike Kravetz
@ 2016-03-31 1:00 ` Naoya Horiguchi
0 siblings, 0 replies; 2+ messages in thread
From: Naoya Horiguchi @ 2016-03-31 1:00 UTC (permalink / raw)
To: Mike Kravetz
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Hillf Danton,
David Rientjes, Dave Hansen, Kirill A. Shutemov, Andrew Morton,
Paul Gortmaker
On Fri, Mar 25, 2016 at 04:44:58PM -0700, Mike Kravetz wrote:
> It was observed that minimum size accounting associated with the
> hugetlbfs min_size mount option may not perform optimally and as
> expected. As huge pages/reservations are released from the filesystem
> and given back to the global pools, they are reserved for subsequent
> filesystem use as long as the subpool reserved count is less than
> subpool minimum size. It does not take into account used pages
> within the filesystem. The filesystem size limits are not exceeded
> and this is technically not a bug. However, better behavior would
> be to wait for the number of used pages/reservations associated with
> the filesystem to drop below the minimum size before taking reservations
> to satisfy minimum size.
>
> An optimization is also made to the hugepage_subpool_get_pages()
> routine which is called when pages/reservations are allocated. This
> does not change behavior, but simply avoids the accounting if all
> reservations have already been taken (subpool reserved count == 0).
>
> Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Seems OK to me.
Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-31 1:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-25 23:44 [PATCH] mm/hugetlb: optimize minimum size (min_size) accounting Mike Kravetz
2016-03-31 1:00 ` Naoya Horiguchi
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).