[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5f354bf5-4ac8-d0e2-048c-0857c91a21e6@intel.com>
Date: Thu, 28 Feb 2019 11:00:17 -0800
From: Dave Hansen <dave.hansen@...el.com>
To: Steven Price <steven.price@....com>, linux-mm@...ck.org
Cc: Mark Rutland <Mark.Rutland@....com>, x86@...nel.org,
Arnd Bergmann <arnd@...db.de>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>,
Peter Zijlstra <peterz@...radead.org>,
Catalin Marinas <catalin.marinas@....com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Will Deacon <will.deacon@....com>,
linux-kernel@...r.kernel.org,
Jérôme Glisse <jglisse@...hat.com>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Andy Lutomirski <luto@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
James Morse <james.morse@....com>,
Thomas Gleixner <tglx@...utronix.de>,
linux-arm-kernel@...ts.infradead.org,
"Liang, Kan" <kan.liang@...ux.intel.com>
Subject: Re: [PATCH v3 27/34] mm: pagewalk: Add 'depth' parameter to pte_hole
On 2/28/19 3:28 AM, Steven Price wrote:
> static int get_level(unsigned long addr, unsigned long end)
> {
> /* Add 1 to account for ~0ULL */
> unsigned long size = (end - addr) + 1;
> if (size < PMD_SIZE)
> return 4;
> else if (size < PUD_SIZE)
> return 3;
> else if (size < P4D_SIZE)
> return 2;
> else if (size < PGD_SIZE)
> return 1;
> return 0;
> }
>
> There are two immediate problems with that:
>
> * The "+1" to deal with ~0ULL is fragile
>
> * PGD_SIZE isn't what you might expect, it's not defined for most
> architectures and arm64/x86 use it as the size of the PGD table.
> Although that's easy enough to fix up.
>
> Do you think a function like above would be preferable?
The question still stands of why we *need* the depth/level in the first
place. As I said, we obviously need it for printing out the "name" of
the level. Is that it?
> The other option would of course be to just drop the information from
> the debugfs file about at which level the holes are. But it can be
> useful information to see whether there are empty levels in the page
> table structure. Although this is an area where x86 and arm64 differ
> currently (x86 explicitly shows the gaps, arm64 doesn't), so if x86
> doesn't mind losing that functionality that would certainly simplify things!
I think I'd actually be OK with the holes just not showing up. I
actually find it kinda hard to read sometimes with the holes in there.
I'd be curious what others think though.
Powered by blists - more mailing lists