lkml.org 
[lkml]   [2011]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
SubjectRe: [GIT PULL] KVM updates for the 2.6.38 merge window
On Wed, Jan 12, 2011 at 12:33 PM, Rik van Riel <riel@redhat.com> wrote:
>
> Now that we have FAULT_FLAG_ALLOW_RETRY, the async
> pagefault patches can be a little smaller.

I suspect you do still want a new page flag, to say that
FAULT_FLAG_ALLOW_RETRY shouldn't actually wait for the page that it
allows retry for.

But even then, that flag should not be named "MINOR", it should be
about what the behaviour is actually all about ("NOWAIT_RETRY" or
whatever - it presumably would also cause us to not drop the
mmap_sem).

IOW, these days I suspect the patch _should_ look something like the attached.

Anyway, with this, you should be able to use

FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_RETRY_NOWAIT

to basically get a non-waiting page fault (and it will return the
VM_FAULT_RETRY error code if it failed).

NOTE! TOTALLY UNTESTED!

Linus
include/linux/mm.h | 1 +
mm/filemap.c | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 721f451..dc83565 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -145,6 +145,7 @@ extern pgprot_t protection_map[16];
#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */
#define FAULT_FLAG_MKWRITE 0x04 /* Fault was mkwrite of existing pte */
#define FAULT_FLAG_ALLOW_RETRY 0x08 /* Retry fault if blocking */
+#define FAULT_FLAG_RETRY_NOWAIT 0x10 /* Don't drop mmap_sem and wait when retrying */

/*
* This interface is used by x86 PAT code to identify a pfn mapping that is
diff --git a/mm/filemap.c b/mm/filemap.c
index ca38939..10eecf7 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -621,8 +621,10 @@ int __lock_page_or_retry(struct page *page, struct mm_struct *mm,
__lock_page(page);
return 1;
} else {
- up_read(&mm->mmap_sem);
- wait_on_page_locked(page);
+ if (!(flags & FAULT_FLAG_RETRY_NOWAIT)) {
+ up_read(&mm->mmap_sem);
+ wait_on_page_locked(page);
+ }
return 0;
}
}
\
 
 \ /
  Last update: 2011-01-12 21:57    [W:0.120 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site