arch, mm: make kernel_page_present() always available
[linux-2.6-microblaze.git] / include / linux / mm.h
index db6ae4d..5ec7975 100644 (file)
@@ -557,8 +557,9 @@ enum page_entry_size {
 struct vm_operations_struct {
        void (*open)(struct vm_area_struct * area);
        void (*close)(struct vm_area_struct * area);
-       int (*split)(struct vm_area_struct * area, unsigned long addr);
-       int (*mremap)(struct vm_area_struct * area);
+       /* Called any time before splitting to check if it's allowed */
+       int (*may_split)(struct vm_area_struct *area, unsigned long addr);
+       int (*mremap)(struct vm_area_struct *area, unsigned long flags);
        vm_fault_t (*fault)(struct vm_fault *vmf);
        vm_fault_t (*huge_fault)(struct vm_fault *vmf,
                        enum page_entry_size pe_size);
@@ -1716,8 +1717,8 @@ extern int access_process_vm(struct task_struct *tsk, unsigned long addr,
                void *buf, int len, unsigned int gup_flags);
 extern int access_remote_vm(struct mm_struct *mm, unsigned long addr,
                void *buf, int len, unsigned int gup_flags);
-extern int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm,
-               unsigned long addr, void *buf, int len, unsigned int gup_flags);
+extern int __access_remote_vm(struct mm_struct *mm, unsigned long addr,
+                             void *buf, int len, unsigned int gup_flags);
 
 long get_user_pages_remote(struct mm_struct *mm,
                            unsigned long start, unsigned long nr_pages,
@@ -2203,7 +2204,7 @@ static inline bool pgtable_pte_page_ctor(struct page *page)
        if (!ptlock_init(page))
                return false;
        __SetPageTable(page);
-       inc_zone_page_state(page, NR_PAGETABLE);
+       inc_lruvec_page_state(page, NR_PAGETABLE);
        return true;
 }
 
@@ -2211,7 +2212,7 @@ static inline void pgtable_pte_page_dtor(struct page *page)
 {
        ptlock_free(page);
        __ClearPageTable(page);
-       dec_zone_page_state(page, NR_PAGETABLE);
+       dec_lruvec_page_state(page, NR_PAGETABLE);
 }
 
 #define pte_offset_map_lock(mm, pmd, address, ptlp)    \
@@ -2298,7 +2299,7 @@ static inline bool pgtable_pmd_page_ctor(struct page *page)
        if (!pmd_ptlock_init(page))
                return false;
        __SetPageTable(page);
-       inc_zone_page_state(page, NR_PAGETABLE);
+       inc_lruvec_page_state(page, NR_PAGETABLE);
        return true;
 }
 
@@ -2306,7 +2307,7 @@ static inline void pgtable_pmd_page_dtor(struct page *page)
 {
        pmd_ptlock_free(page);
        __ClearPageTable(page);
-       dec_zone_page_state(page, NR_PAGETABLE);
+       dec_lruvec_page_state(page, NR_PAGETABLE);
 }
 
 /*
@@ -2433,9 +2434,6 @@ static inline int early_pfn_to_nid(unsigned long pfn)
 #else
 /* please see mm/page_alloc.c */
 extern int __meminit early_pfn_to_nid(unsigned long pfn);
-/* there is a per-arch backend function. */
-extern int __meminit __early_pfn_to_nid(unsigned long pfn,
-                                       struct mminit_pfnnid_cache *state);
 #endif
 
 extern void set_dma_reserve(unsigned long new_dma_reserve);
@@ -2933,28 +2931,28 @@ static inline bool debug_pagealloc_enabled_static(void)
        return static_branch_unlikely(&_debug_pagealloc_enabled);
 }
 
-#if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_ARCH_HAS_SET_DIRECT_MAP)
-extern void __kernel_map_pages(struct page *page, int numpages, int enable);
-
+#ifdef CONFIG_DEBUG_PAGEALLOC
 /*
- * When called in DEBUG_PAGEALLOC context, the call should most likely be
- * guarded by debug_pagealloc_enabled() or debug_pagealloc_enabled_static()
+ * To support DEBUG_PAGEALLOC architecture must ensure that
+ * __kernel_map_pages() never fails
  */
-static inline void
-kernel_map_pages(struct page *page, int numpages, int enable)
-{
-       __kernel_map_pages(page, numpages, enable);
-}
-#ifdef CONFIG_HIBERNATION
-extern bool kernel_page_present(struct page *page);
-#endif /* CONFIG_HIBERNATION */
-#else  /* CONFIG_DEBUG_PAGEALLOC || CONFIG_ARCH_HAS_SET_DIRECT_MAP */
-static inline void
-kernel_map_pages(struct page *page, int numpages, int enable) {}
-#ifdef CONFIG_HIBERNATION
-static inline bool kernel_page_present(struct page *page) { return true; }
-#endif /* CONFIG_HIBERNATION */
-#endif /* CONFIG_DEBUG_PAGEALLOC || CONFIG_ARCH_HAS_SET_DIRECT_MAP */
+extern void __kernel_map_pages(struct page *page, int numpages, int enable);
+
+static inline void debug_pagealloc_map_pages(struct page *page, int numpages)
+{
+       if (debug_pagealloc_enabled_static())
+               __kernel_map_pages(page, numpages, 1);
+}
+
+static inline void debug_pagealloc_unmap_pages(struct page *page, int numpages)
+{
+       if (debug_pagealloc_enabled_static())
+               __kernel_map_pages(page, numpages, 0);
+}
+#else  /* CONFIG_DEBUG_PAGEALLOC */
+static inline void debug_pagealloc_map_pages(struct page *page, int numpages) {}
+static inline void debug_pagealloc_unmap_pages(struct page *page, int numpages) {}
+#endif /* CONFIG_DEBUG_PAGEALLOC */
 
 #ifdef __HAVE_ARCH_GATE_AREA
 extern struct vm_area_struct *get_gate_vma(struct mm_struct *mm);