aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mm.h
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2011-03-22 19:30:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-22 20:44:02 -0400
commit318b275fbca1ab9ec0862de71420e0e92c3d1aa7 (patch)
treeaa4984469443ed53b4e7fa23d3f91966e536a803 /include/linux/mm.h
parent5fda1bd5b8869574dad8e1f9f71e23bf0c186274 (diff)
mm: allow GUP to fail instead of waiting on a page
GUP user may want to try to acquire a reference to a page if it is already in memory, but not if IO, to bring it in, is needed. For example KVM may tell vcpu to schedule another guest process if current one is trying to access swapped out page. Meanwhile, the page will be swapped in and the guest process, that depends on it, will be able to run again. This patch adds FAULT_FLAG_RETRY_NOWAIT (suggested by Linus) and FOLL_NOWAIT follow_page flags. FAULT_FLAG_RETRY_NOWAIT, when used in conjunction with VM_FAULT_ALLOW_RETRY, indicates to handle_mm_fault that it shouldn't drop mmap_sem and wait on a page, but return VM_FAULT_RETRY instead. [akpm@linux-foundation.org: improve FOLL_NOWAIT comment] Signed-off-by: Gleb Natapov <gleb@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Hugh Dickins <hughd@google.com> Acked-by: Rik van Riel <riel@redhat.com> Cc: Michel Lespinasse <walken@google.com> Cc: Avi Kivity <avi@redhat.com> Cc: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r--include/linux/mm.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 1f82adc85352..901435e3a9a9 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -151,6 +151,7 @@ extern pgprot_t protection_map[16];
151#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */ 151#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */
152#define FAULT_FLAG_MKWRITE 0x04 /* Fault was mkwrite of existing pte */ 152#define FAULT_FLAG_MKWRITE 0x04 /* Fault was mkwrite of existing pte */
153#define FAULT_FLAG_ALLOW_RETRY 0x08 /* Retry fault if blocking */ 153#define FAULT_FLAG_ALLOW_RETRY 0x08 /* Retry fault if blocking */
154#define FAULT_FLAG_RETRY_NOWAIT 0x10 /* Don't drop mmap_sem and wait when retrying */
154 155
155/* 156/*
156 * This interface is used by x86 PAT code to identify a pfn mapping that is 157 * This interface is used by x86 PAT code to identify a pfn mapping that is
@@ -1545,6 +1546,8 @@ struct page *follow_page(struct vm_area_struct *, unsigned long address,
1545#define FOLL_GET 0x04 /* do get_page on page */ 1546#define FOLL_GET 0x04 /* do get_page on page */
1546#define FOLL_DUMP 0x08 /* give error on hole if it would be zero */ 1547#define FOLL_DUMP 0x08 /* give error on hole if it would be zero */
1547#define FOLL_FORCE 0x10 /* get_user_pages read/write w/o permission */ 1548#define FOLL_FORCE 0x10 /* get_user_pages read/write w/o permission */
1549#define FOLL_NOWAIT 0x20 /* if a disk transfer is needed, start the IO
1550 * and return without waiting upon it */
1548#define FOLL_MLOCK 0x40 /* mark page as mlocked */ 1551#define FOLL_MLOCK 0x40 /* mark page as mlocked */
1549#define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */ 1552#define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */
1550#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */ 1553#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */