lkml.org 
[lkml]   [2018]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 0/7] mm: pages for hugetlb's overcommit may be able to charge to memcg
From
Date
On 05/22/2018 06:04 AM, TSUKADA Koutaro wrote:
>
> I stared at the commit log of mm/hugetlb_cgroup.c, but it did not seem to
> have specially considered of surplus hugepages. Later, I will send a mail
> to hugetlb cgroup's committer to ask about surplus hugepages charge
> specifications.
>

I went back and looked at surplus huge page allocation. Previously, I made
a statement that the hugetlb controller accounts for surplus huge pages.
Turns out that may not be 100% correct.

Thanks to Michal, all surplus huge page allocation is performed via the
alloc_surplus_huge_page() routine. This will ultimately call into the
buddy allocator without any cgroup charges. Calls to alloc_surplus_huge_page
are made from:
- alloc_huge_page() when allocating a huge page to a mapping/file. In this
case, appropriate calls to the hugetlb controller are in place. So, any
limits are enforced here.
- gather_surplus_pages() when allocating and setting aside 'reserved' huge
pages. No accounting is performed here. Do note that in this case the
allocated huge pages are not assigned to the mapping/file. Even though
'reserved', they are deposited into the global pool and also counted as
'free'. When these reserved pages are ultimately used to populate a
file/mapping, the code path goes through alloc_huge_page() where appropriate
calls to the hugetlb controller are in place.

So, the bottom line is that surplus huge pages are not accounted for when
they are allocated as 'reserves'. It is not until these reserves are actually
used that accounting limits are checked. This 'seems' to align with general
allocation of huge pages within the pool. No accounting is done until they
are actually allocated to a mapping/file.

--
Mike Kravetz

\
 
 \ /
  Last update: 2018-05-22 22:29    [W:0.088 / U:7.816 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site