[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1711142128170.2221@nanos>
Date: Tue, 14 Nov 2017 21:29:41 +0100 (CET)
From: Thomas Gleixner <tglx@...utronix.de>
To: "Kirill A. Shutemov" <kirill@...temov.name>
cc: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andy Lutomirski <luto@...capital.net>,
Nicholas Piggin <npiggin@...il.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCHv2 1/2] x86/mm: Do not allow non-MAP_FIXED mapping across
DEFAULT_MAP_WINDOW border
On Tue, 14 Nov 2017, Kirill A. Shutemov wrote:
> On Tue, Nov 14, 2017 at 05:01:50PM +0100, Thomas Gleixner wrote:
> > +bool mmap_address_hint_valid(unsigned long addr, unsigned long len)
> > +{
> > + if (TASK_SIZE - len < addr)
> > + return false;
> > +#if CONFIG_PGTABLE_LEVELS >= 5
> > + return (addr > DEFAULT_MAP_WINDOW) == (addr + len > DEFAULT_MAP_WINDOW);
>
> Is it micro optimization? I don't feel it necessary. It's not that hot
> codepath to care about few cycles. (And one more place to care about for
> boot-time switching.)
>
> If you think it's needed, maybe IS_ENABLED() instead?
You're right. It's can be unconditional, For page table levels < 5 its just
redundant as its covered by the TASK_SIZE check already.
Thanks,
tglx
Powered by blists - more mailing lists