[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5c32a05e-da2e-84b8-3435-4cd5f8a1f0f9@oracle.com>
Date: Tue, 22 May 2018 13:28:30 -0700
From: Mike Kravetz <mike.kravetz@...cle.com>
To: TSUKADA Koutaro <tsukada@...ade.co.jp>
Cc: Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>,
Vladimir Davydov <vdavydov.dev@...il.com>,
Jonathan Corbet <corbet@....net>,
"Luis R. Rodriguez" <mcgrof@...nel.org>,
Kees Cook <keescook@...omium.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Roman Gushchin <guro@...com>,
David Rientjes <rientjes@...gle.com>,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>,
Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
Anshuman Khandual <khandual@...ux.vnet.ibm.com>,
Marc-Andre Lureau <marcandre.lureau@...hat.com>,
Punit Agrawal <punit.agrawal@....com>,
Dan Williams <dan.j.williams@...el.com>,
Vlastimil Babka <vbabka@...e.cz>, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org, cgroups@...r.kernel.org
Subject: Re: [PATCH v2 0/7] mm: pages for hugetlb's overcommit may be able to
charge to memcg
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
Powered by blists - more mailing lists