Merge branch 'page-refs' (page ref overflow)
[linux-2.6-block.git] / include / linux / mm.h
index 7000ddd807e012279d062b18b75b9822dcd5ea44..6b10c21630f54bdd14ddd6efa1510777165ec558 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/page_ref.h>
 #include <linux/memremap.h>
 #include <linux/overflow.h>
+#include <linux/sizes.h>
 
 struct mempolicy;
 struct anon_vma;
@@ -1335,52 +1336,6 @@ static inline void clear_page_pfmemalloc(struct page *page)
        page->index = 0;
 }
 
-/*
- * Different kinds of faults, as returned by handle_mm_fault().
- * Used to decide whether a process gets delivered SIGBUS or
- * just gets major/minor fault counters bumped up.
- */
-
-#define VM_FAULT_OOM   0x0001
-#define VM_FAULT_SIGBUS        0x0002
-#define VM_FAULT_MAJOR 0x0004
-#define VM_FAULT_WRITE 0x0008  /* Special case for get_user_pages */
-#define VM_FAULT_HWPOISON 0x0010       /* Hit poisoned small page */
-#define VM_FAULT_HWPOISON_LARGE 0x0020  /* Hit poisoned large page. Index encoded in upper bits */
-#define VM_FAULT_SIGSEGV 0x0040
-
-#define VM_FAULT_NOPAGE        0x0100  /* ->fault installed the pte, not return page */
-#define VM_FAULT_LOCKED        0x0200  /* ->fault locked the returned page */
-#define VM_FAULT_RETRY 0x0400  /* ->fault blocked, must retry */
-#define VM_FAULT_FALLBACK 0x0800       /* huge page fault failed, fall back to small */
-#define VM_FAULT_DONE_COW   0x1000     /* ->fault has fully handled COW */
-#define VM_FAULT_NEEDDSYNC  0x2000     /* ->fault did not modify page tables
-                                        * and needs fsync() to complete (for
-                                        * synchronous page faults in DAX) */
-
-#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV | \
-                        VM_FAULT_HWPOISON | VM_FAULT_HWPOISON_LARGE | \
-                        VM_FAULT_FALLBACK)
-
-#define VM_FAULT_RESULT_TRACE \
-       { VM_FAULT_OOM,                 "OOM" }, \
-       { VM_FAULT_SIGBUS,              "SIGBUS" }, \
-       { VM_FAULT_MAJOR,               "MAJOR" }, \
-       { VM_FAULT_WRITE,               "WRITE" }, \
-       { VM_FAULT_HWPOISON,            "HWPOISON" }, \
-       { VM_FAULT_HWPOISON_LARGE,      "HWPOISON_LARGE" }, \
-       { VM_FAULT_SIGSEGV,             "SIGSEGV" }, \
-       { VM_FAULT_NOPAGE,              "NOPAGE" }, \
-       { VM_FAULT_LOCKED,              "LOCKED" }, \
-       { VM_FAULT_RETRY,               "RETRY" }, \
-       { VM_FAULT_FALLBACK,            "FALLBACK" }, \
-       { VM_FAULT_DONE_COW,            "DONE_COW" }, \
-       { VM_FAULT_NEEDDSYNC,           "NEEDDSYNC" }
-
-/* Encode hstate index for a hwpoisoned large page */
-#define VM_FAULT_SET_HINDEX(x) ((x) << 12)
-#define VM_FAULT_GET_HINDEX(x) (((x) >> 12) & 0xf)
-
 /*
  * Can be called by the pagefault handler when it gets a VM_FAULT_OOM.
  */
@@ -1549,7 +1504,8 @@ long get_user_pages_locked(unsigned long start, unsigned long nr_pages,
                    unsigned int gup_flags, struct page **pages, int *locked);
 long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages,
                    struct page **pages, unsigned int gup_flags);
-#ifdef CONFIG_FS_DAX
+
+#if defined(CONFIG_FS_DAX) || defined(CONFIG_CMA)
 long get_user_pages_longterm(unsigned long start, unsigned long nr_pages,
                            unsigned int gup_flags, struct page **pages,
                            struct vm_area_struct **vmas);
@@ -2460,8 +2416,7 @@ int __must_check write_one_page(struct page *page);
 void task_dirty_inc(struct task_struct *tsk);
 
 /* readahead.c */
-#define VM_MAX_READAHEAD       128     /* kbytes */
-#define VM_MIN_READAHEAD       16      /* kbytes (includes current page) */
+#define VM_READAHEAD_PAGES     (SZ_128K / PAGE_SIZE)
 
 int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
                        pgoff_t offset, unsigned long nr_to_read);