Re: [V4][PATCH 0/4]page fault retry with NOPAGE_RETRY

From: Linus Torvalds
Date: Mon Apr 13 2009 - 16:28:21 EST




On Mon, 13 Apr 2009, Linus Torvalds wrote:
>
> Well, have you tried the obvious optimization of _not_ doing the RETRY
> path when atomic_read(&mm->counter) == 1?
>
> After all, if it's not a threaded app, and it doesn't have a possibility
> of concurrent mmap/fault, then why release the lock?

Ok, so the counter is called 'mm_users', not 'counter'.

Anyway, I would try that in the arch patch, and just see what happens when
you change the

unsigned int fault_flags = FAULT_FLAG_RETRY;

into

unsigned int fault_flags;

..

fault_flags = atomic_read(&mm->mm_users) > 1 ? FAULT_FLAG_RETRY : 0;

where you should probably do that mm dereference only after checking that
you're not in atomic context or something like that (so move the
assignment down).

The reason I'd suggest doing it in the caller of handle_mm_fault() rather
than anywhere deeper in the call chain is that some callers _might_ really
want to get the retry semantics even if they are the only ones. Imagine,
for example, some kind of non-blocking "get_user_pages()" thing.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/