From: Al Viro <viro@ZenIV.linux.org.uk>
To: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Cc: Al Viro <viro@ftp.linux.org.uk>,
linux-arch@vger.kernel.org, torvalds@linux-foundation.org,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC][PATCHSET] mremap/mmap mess
Date: Tue, 8 Dec 2009 06:07:01 +0000 [thread overview]
Message-ID: <20091208060701.GM14381@ZenIV.linux.org.uk> (raw)
In-Reply-To: <Pine.LNX.4.64.0912071953490.24794@sister.anvils>
On Mon, Dec 07, 2009 at 08:05:05PM +0000, Hugh Dickins wrote:
> mm/nommu.c is all about duplicating stuff with variations:
> unsatisfactory, but no reason to go do it differently here.
> Yes, I'll want to revert the util.c mods, but you don't need
> to do so now.
OK... BTW, I think I see how to get rid of the worst of expand_stack()
mess. Note that conceptually the nastiest part is execve() - there
we have no task_struct matching the mm we are accessing. But let's
take a look at what execve() is doing:
* we create a new mm
* we create a kinda-sorta vma at STACK_TOP_MAX
* we push argv/envp into it via get_user_pages(), populating
page tables for new mm as we go
* we set personality
* we possibly relocate it down
And all of that - to avoid the limit on number of pages caused by fixed-sized
array in bprm.
First of all, that implictly assumes that this relocation downwards is
rare. And so it is on amd64 and alpha. However, sparc64 and ppc64
have nearly 100% 32bit userland. That got to hurt and if the situation
with s390 is anywhere near that, they *really* hurt - we have variable
depth of page table tree there and forcing it up is Not Nice(tm).
Why do we want user_get_pages(), anyway? It's not that we lacked an
easy way to do large arrays, especially since the use is purely sequential.
Even a linked list of vmalloc'ed pages would do just fine (i.e. start with
static array in bprm, keep the pointer to last filled entry + number of
entries left before the next allocation; use the last pointer in array
for finding the next page-sized chunk).
What do we lose if we go that way? Inserting all these pages into mm
at once shouldn't be slower. Memory overhead is not really an issue
(one page per 511 or 1023 pages of argv). Am I missing something?
The benefit, AFAICS, is that we get rid of the mess with forced high
address use, get *sane* get_user_pages() (we always have matching
task_struct with the right personality, so we can avoid massive PITA
for doing checks right) and we get unified mmu/nommu code in fs/exec.c
out of that.
If you see serious problems I've missed, please tell. Otherwise I'm
going to hack up a prototype and post it here...
next prev parent reply other threads:[~2009-12-08 6:06 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-05 19:08 [RFC][PATCHSET] mremap/mmap mess Al Viro
2009-12-05 19:08 ` Al Viro
2009-12-05 20:44 ` Linus Torvalds
2009-12-05 23:01 ` Al Viro
2009-12-05 23:58 ` Russell King
2009-12-06 17:22 ` Hugh Dickins
2009-12-06 18:00 ` Linus Torvalds
2009-12-07 3:58 ` Al Viro
2009-12-07 18:58 ` Hugh Dickins
2009-12-07 18:58 ` Hugh Dickins
2009-12-07 19:30 ` Al Viro
2009-12-07 20:05 ` Hugh Dickins
2009-12-07 20:05 ` Hugh Dickins
2009-12-08 6:07 ` Al Viro [this message]
2009-12-08 11:42 ` Hugh Dickins
2009-12-08 13:03 ` Hugh Dickins
2009-12-08 21:08 ` David Miller
2009-12-08 22:06 ` Al Viro
2009-12-09 11:43 ` Hugh Dickins
2009-12-09 12:21 ` Peter Zijlstra
2009-12-09 12:21 ` Peter Zijlstra
2009-12-09 13:12 ` Hugh Dickins
2009-12-09 13:37 ` Peter Zijlstra
2009-12-09 13:24 ` Al Viro
2009-12-09 13:39 ` Peter Zijlstra
2009-12-09 13:46 ` Al Viro
2009-12-09 14:36 ` Hugh Dickins
2009-12-09 15:12 ` Linus Torvalds
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=20091208060701.GM14381@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=akpm@linux-foundation.org \
--cc=hugh.dickins@tiscali.co.uk \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@ftp.linux.org.uk \
/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