From: Dave Hansen <dave@sr71.net>
To: Vlastimil Babka <vbabka@suse.cz>, linux-kernel@vger.kernel.org
Cc: hch@lst.de, akpm@linux-foundation.org, dan.j.williams@intel.com,
khandual@linux.vnet.ibm.com, linux-mm@kvack.org,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>
Subject: Re: [PATCH] proc: mm: export PTE sizes directly in smaps (v2)
Date: Mon, 28 Nov 2016 13:39:49 -0800 [thread overview]
Message-ID: <6262d9fa-8098-4e18-4129-932e5e4857cb@sr71.net> (raw)
In-Reply-To: <763d778a-2637-39e0-bcde-265055cf1c18@suse.cz>
... cc'ing the arm64 maintainers
On 11/28/2016 01:07 PM, Vlastimil Babka wrote:
> On 11/28/2016 05:52 PM, Dave Hansen wrote:
>> On 11/24/2016 06:22 AM, Vlastimil Babka wrote:
>>> On 11/17/2016 01:28 AM, Dave Hansen wrote:
>>>> @@ -702,11 +707,13 @@ static int smaps_hugetlb_range(pte_t *pt
>>>> }
>>>> if (page) {
>>>> int mapcount = page_mapcount(page);
>>>> + unsigned long hpage_size = huge_page_size(hstate_vma(vma));
>>>>
>>>> + mss->rss_pud += hpage_size;
>>>
>>> This hardcoded pud doesn't look right, doesn't the pmd/pud depend on
>>> hpage_size?
>>
>> Urg, nope. Thanks for noticing that! I think we'll need something
>> along the lines of:
>>
>> if (hpage_size == PUD_SIZE)
>> mss->rss_pud += PUD_SIZE;
>> else if (hpage_size == PMD_SIZE)
>> mss->rss_pmd += PMD_SIZE;
>
> Sounds better, although I wonder whether there are some weird arches
> supporting hugepage sizes that don't match page table levels. I recall
> that e.g. MIPS could do arbitrary size, but dunno if the kernel supports
> that...
arm64 seems to have pretty arbitrary sizes, and seems to be able to
build them out of multiple hardware PTE sizes. I think I can fix my
code to handle those:
if (hpage_size >= PGD_SIZE)
mss->rss_pgd += PGD_SIZE;
else if (hpage_size >= PUD_SIZE)
mss->rss_pud += PUD_SIZE;
else if (hpage_size >= PMD_SIZE)
mss->rss_pmd += PMD_SIZE;
else
mss->rss_pte += PAGE_SIZE;
But, I *think* that means that smaps_hugetlb_range() is *currently*
broken for these intermediate arm64 sizes. The code does:
if (mapcount >= 2)
mss->shared_hugetlb += hpage_size;
else
mss->private_hugetlb += hpage_size;
So I *think* if we may count a hugetlbfs arm64 CONT_PTES page multiple
times, and account hpage_size for *each* of the CONT_PTES. That would
artificially inflate the smaps output for those pages.
Will / Catalin, is there something I'm missing?
--
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>
next prev parent reply other threads:[~2016-11-28 21:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-17 0:28 Dave Hansen
2016-11-24 14:22 ` Vlastimil Babka
2016-11-28 16:52 ` Dave Hansen
2016-11-28 21:07 ` Vlastimil Babka
2016-11-28 21:39 ` Dave Hansen [this message]
2016-11-29 8:01 ` Vlastimil Babka
2016-11-29 15:07 ` Catalin Marinas
2016-11-25 4:00 ` Anshuman Khandual
2016-11-28 17:00 ` Dave Hansen
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=6262d9fa-8098-4e18-4129-932e5e4857cb@sr71.net \
--to=dave@sr71.net \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=dan.j.williams@intel.com \
--cc=hch@lst.de \
--cc=khandual@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=vbabka@suse.cz \
--cc=will.deacon@arm.com \
/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