mm: make faultaround produce old ptes
[cascardo/linux.git] / include / linux / mm.h
index 727f799..f223ac2 100644 (file)
@@ -447,14 +447,14 @@ unsigned long vmalloc_to_pfn(const void *addr);
  * On nommu, vmalloc/vfree wrap through kmalloc/kfree directly, so there
  * is no special casing required.
  */
-static inline int is_vmalloc_addr(const void *x)
+static inline bool is_vmalloc_addr(const void *x)
 {
 #ifdef CONFIG_MMU
        unsigned long addr = (unsigned long)x;
 
        return addr >= VMALLOC_START && addr < VMALLOC_END;
 #else
-       return 0;
+       return false;
 #endif
 }
 #ifdef CONFIG_MMU
@@ -475,8 +475,7 @@ static inline atomic_t *compound_mapcount_ptr(struct page *page)
 
 static inline int compound_mapcount(struct page *page)
 {
-       if (!PageCompound(page))
-               return 0;
+       VM_BUG_ON_PAGE(!PageCompound(page), page);
        page = compound_head(page);
        return atomic_read(compound_mapcount_ptr(page)) + 1;
 }
@@ -597,7 +596,7 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
 }
 
 void do_set_pte(struct vm_area_struct *vma, unsigned long address,
-               struct page *page, pte_t *pte, bool write, bool anon);
+               struct page *page, pte_t *pte, bool write, bool anon, bool old);
 #endif
 
 /*
@@ -734,7 +733,7 @@ static inline void get_page(struct page *page)
        page = compound_head(page);
        /*
         * Getting a normal page or the head of a compound page
-        * requires to already have an elevated page->_count.
+        * requires to already have an elevated page->_refcount.
         */
        VM_BUG_ON_PAGE(page_ref_count(page) <= 0, page);
        page_ref_inc(page);
@@ -850,10 +849,7 @@ extern int page_cpupid_xchg_last(struct page *page, int cpupid);
 
 static inline void page_cpupid_reset_last(struct page *page)
 {
-       int cpupid = (1 << LAST_CPUPID_SHIFT) - 1;
-
-       page->flags &= ~(LAST_CPUPID_MASK << LAST_CPUPID_PGSHIFT);
-       page->flags |= (cpupid & LAST_CPUPID_MASK) << LAST_CPUPID_PGSHIFT;
+       page->flags |= LAST_CPUPID_MASK << LAST_CPUPID_PGSHIFT;
 }
 #endif /* LAST_CPUPID_NOT_IN_PAGE_FLAGS */
 #else /* !CONFIG_NUMA_BALANCING */
@@ -1032,26 +1028,7 @@ static inline pgoff_t page_file_index(struct page *page)
        return page->index;
 }
 
-/*
- * Return true if this page is mapped into pagetables.
- * For compound page it returns true if any subpage of compound page is mapped.
- */
-static inline bool page_mapped(struct page *page)
-{
-       int i;
-       if (likely(!PageCompound(page)))
-               return atomic_read(&page->_mapcount) >= 0;
-       page = compound_head(page);
-       if (atomic_read(compound_mapcount_ptr(page)) >= 0)
-               return true;
-       if (PageHuge(page))
-               return false;
-       for (i = 0; i < hpage_nr_pages(page); i++) {
-               if (atomic_read(&page[i]._mapcount) >= 0)
-                       return true;
-       }
-       return false;
-}
+bool page_mapped(struct page *page);
 
 /*
  * Return true only if the page has been allocated with
@@ -1786,7 +1763,7 @@ extern void free_highmem_page(struct page *page);
 extern void adjust_managed_page_count(struct page *page, long count);
 extern void mem_init_print_info(const char *str);
 
-extern void reserve_bootmem_region(unsigned long start, unsigned long end);
+extern void reserve_bootmem_region(phys_addr_t start, phys_addr_t end);
 
 /* Free the reserved page into the buddy system, so it gets managed. */
 static inline void __free_reserved_page(struct page *page)