[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTi=-JRUFH08TYNhB7TyN=YscnNbqwtZ_BwcwKJPS@mail.gmail.com>
Date: Tue, 24 Aug 2010 10:51:12 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: "Luck, Tony" <tony.luck@...el.com>
Cc: linux-kernel@...r.kernel.org, linux-parisc@...r.kernel.org,
linux-ia64@...r.kernel.org
Subject: Re: [PATCH] guard page for stacks that grow upwards
Hmm. Looking at the patch a bit more..
On Tue, Aug 24, 2010 at 9:31 AM, Luck, Tony <tony.luck@...el.com> wrote:
>
> +#if defined(CONFIG_STACK_GROWSUP) || defined(CONFIG_IA64)
> + else if (vma->vm_flags & VM_GROWSUP) {
> + address = PAGE_ALIGN(address + 1);
> + if (address == vma->vm_end) {
So I react to two things:
- that "else" looks wrong. At least conceptually, both could happen -
the code should be entirely able to handle a segment that expands both
ways (which is something that ia64 could do: stack one way, register
spills etc other, all in just one happy vma). I guess we don't set it
up that way now, but the "else" just annoys my sense of aesthetics.
It's an extra four letters that don't add value - just takes it away.
- The "address = PAGE_ALIGN(address + 1);" thing is just ugly.
Wouldn't it be nicer to just move the earlier
address &= PAGE_MASK
back outside the conditionals (and keep the original conditional the
way it was - you only changed it for that bogus "else" case anyway),
and then do
if (address + PAGE_SIZE == vma->vm_end)
rather than have "PAGE_ALIGN(address + 1)" as yet another way of
aligning the address just right.
No?
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists