Lines Matching refs:page
27 #include <linux/page-flags.h>
102 #include <asm/page.h>
155 * a zero page mapping on a read fault.
158 * related to the physical page in case of virtualization.
171 /* This function must be updated when the size of struct page grows above 80
178 static inline void _mm_zero_struct_page(struct page *page)
180 unsigned long *_pp = (void *)page;
182 /* Check that struct page is either 56, 64, 72, or 80 bytes */
183 BUILD_BUG_ON(sizeof(struct page) & MM_SEVEN);
184 BUILD_BUG_ON(sizeof(struct page) < MM_FIFTYSIX);
185 BUILD_BUG_ON(sizeof(struct page) > MM_EIGHTY);
187 switch (sizeof(struct page)) {
208 #define mm_zero_struct_page(pp) ((void)memset((pp), 0, sizeof(struct page)))
243 #define nth_page(page, n) pfn_to_page(page_to_pfn((page)) + (n))
245 /* to align the pointer to the (next) page boundary */
251 #define lru_to_page(head) (list_entry((head)->prev, struct page, lru))
292 #define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */
309 #define VM_SYNC 0x00800000 /* Synchronous page faults */
320 #define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */
383 #define VM_ARM64_BTI VM_ARCH_1 /* BTI guarded page, a.k.a. GP bit */
452 * low four bits) to a page protection mask..
471 * whether we would allow page faults to retry by specifying these two
474 * (a) ALLOW_RETRY and !TRIED: this means the page fault allows retry, and
477 * (b) ALLOW_RETRY and TRIED: this means the page fault allows retry, and
480 * (c) !ALLOW_RETRY and !TRIED: this means the page fault does not allow retry
483 * be used. Note that page faults can be allowed to retry for multiple times,
486 * signals before a retry to make sure the continuous page faults can still be
502 * arch-specific page fault handlers.
515 * Return: true if the page fault allows retry and this is the first
536 * MM layer fills up gfp_mask for page allocations but fault handler might
545 pgoff_t pgoff; /* Logical page offset based on vma */
554 struct page *cow_page; /* Page handler may use for COW fault */
555 struct page *page; /* ->fault handlers should return a
556 * page here, unless VM_FAULT_NOPAGE
562 * the 'address'. NULL if the page
566 * Protects pte page table if 'pte'
569 pgtable_t prealloc_pte; /* Pre-allocated pte page table.
573 * page table to avoid allocation from
578 /* page entry size for vm->huge_fault() */
588 * to the functions called when a no-page or a wp-page exception occurs.
600 /* notification that a previously read-only page is about to become
641 * page for @addr. This is useful if the default behavior
642 * (using pte_page()) would not find the correct page.
644 struct page *(*find_special_page)(struct vm_area_struct *vma, unsigned long addr);
727 * Methods to modify the page usage count.
729 * What counts for a page usage:
730 * - cache mapping (page->mapping)
731 * - private data (page->private)
732 * - page mapped in a task's page tables, each mapping
735 * Also, many kernel routines increase the page count before a critical
736 * routine so they can be sure the page doesn't go away from under them.
740 * Drop a ref, return true if the refcount fell to zero (the page has no users)
742 static inline int put_page_testzero(struct page *page)
744 VM_BUG_ON_PAGE(page_ref_count(page) == 0, page);
745 return page_ref_dec_and_test(page);
749 * Try to grab a ref unless the page has a refcount of zero, return false if
754 static inline int get_page_unless_zero(struct page *page)
756 return page_ref_add_unless(page, 1, 0);
770 struct page *vmalloc_to_page(const void *addr);
832 static inline int head_compound_mapcount(struct page *head)
838 * Mapcount of compound page as a whole, does not include mapped sub-pages.
842 static inline int compound_mapcount(struct page *page)
844 VM_BUG_ON_PAGE(!PageCompound(page), page);
845 page = compound_head(page);
846 return head_compound_mapcount(page);
850 * The atomic page->_mapcount, starts from -1: so that transitions
854 static inline void page_mapcount_reset(struct page *page)
856 atomic_set(&(page)->_mapcount, -1);
859 int __page_mapcount(struct page *page);
862 * Mapcount of 0-order page; when compound sub-page, includes
867 * They use this place in struct page differently.
869 static inline int page_mapcount(struct page *page)
871 if (unlikely(PageCompound(page))) {
872 return __page_mapcount(page);
874 return atomic_read(&page->_mapcount) + 1;
878 int total_mapcount(struct page *page);
879 int page_trans_huge_mapcount(struct page *page, int *total_mapcount);
881 static inline int total_mapcount(struct page *page)
883 return page_mapcount(page);
885 static inline int page_trans_huge_mapcount(struct page *page, int *total_mapcount)
887 int mapcount = page_mapcount(page);
895 static inline struct page *virt_to_head_page(const void *x)
897 struct page *page = virt_to_page(x);
899 return compound_head(page);
902 void __put_page(struct page *page);
906 void split_page(struct page *page, unsigned int order);
911 * These are _only_ valid on the head of a compound page.
913 typedef void compound_page_dtor(struct page *);
929 static inline void set_compound_page_dtor(struct page *page, enum compound_dtor_id compound_dtor)
931 VM_BUG_ON_PAGE(compound_dtor >= NR_COMPOUND_DTORS, page);
932 page[1].compound_dtor = compound_dtor;
935 static inline void destroy_compound_page(struct page *page)
937 VM_BUG_ON_PAGE(page[1].compound_dtor >= NR_COMPOUND_DTORS, page);
938 compound_page_dtors[page[1].compound_dtor](page);
941 static inline unsigned int compound_order(struct page *page)
943 if (!PageHead(page)) {
946 return page[1].compound_order;
949 static inline bool hpage_pincount_available(struct page *page)
952 * Can the page->hpage_pinned_refcount field be used? That field is in
953 * the 3rd page of the compound page, so the smallest (2-page) compound
956 page = compound_head(page);
957 return PageCompound(page) && compound_order(page) > 1;
960 static inline int head_compound_pincount(struct page *head)
965 static inline int compound_pincount(struct page *page)
967 VM_BUG_ON_PAGE(!hpage_pincount_available(page), page);
968 page = compound_head(page);
969 return head_compound_pincount(page);
972 static inline void set_compound_order(struct page *page, unsigned int order)
974 page[1].compound_order = order;
975 page[1].compound_nr = 1U << order;
978 /* Returns the number of pages in this potentially compound page. */
979 static inline unsigned long compound_nr(struct page *page)
981 if (!PageHead(page)) {
984 return page[1].compound_nr;
987 /* Returns the number of bytes in this potentially compound page. */
988 static inline unsigned long page_size(struct page *page)
990 return PAGE_SIZE << compound_order(page);
993 /* Returns the number of bits needed for the number of bytes in a page */
994 static inline unsigned int page_shift(struct page *page)
996 return PAGE_SHIFT + compound_order(page);
999 void free_compound_page(struct page *page);
1016 vm_fault_t alloc_set_pte(struct vm_fault *vmf, struct page *page);
1022 * Multiple processes may "see" the same page. E.g. for untouched
1023 * mappings of /dev/null, all processes see the same page full of
1027 * For the non-reserved pages, page_count(page) denotes a reference count.
1028 * page_count() == 0 means the page is free. page->lru is then used for
1030 * page_count() > 0 means the page has been allocated.
1034 * page, and the fields in 'struct page' are the responsibility of mm/slab.c
1038 * A page may be used by anyone else who does a __get_free_page().
1040 * be used through the normal accessor functions. The top bits of page->flags
1041 * and page->virtual store page management information, but all other fields
1043 * page is the responsibility of the one who allocated it, and those who have
1050 * A pagecache page contains an opaque `private' member, which belongs to the
1051 * page's address_space. Usually, this is the address of a circular list of
1052 * the page's disk buffers. PG_private must be set to tell the VM to call
1055 * A page may belong to an inode's memory mapping. In this case, page->mapping
1056 * is the pointer to the inode, and page->index is the file offset of the page,
1061 * case PG_swapcache is set, and page->private is an offset into the swapcache.
1064 * reference to the page. Setting PG_private should also increment the
1065 * refcount. The each user mapping also has a reference to the page.
1122 static inline enum zone_type page_zonenum(const struct page *page)
1124 ASSERT_EXCLUSIVE_BITS(page->flags, ZONES_MASK << ZONES_PGSHIFT);
1125 return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK;
1129 static inline bool is_zone_device_page(const struct page *page)
1131 return page_zonenum(page) == ZONE_DEVICE;
1135 static inline bool is_zone_device_page(const struct page *page)
1142 void free_devmap_managed_page(struct page *page);
1145 static inline bool page_is_devmap_managed(struct page *page)
1150 if (!is_zone_device_page(page)) {
1153 switch (page->pgmap->type) {
1163 void put_devmap_managed_page(struct page *page);
1166 static inline bool page_is_devmap_managed(struct page *page)
1171 static inline void put_devmap_managed_page(struct page *page)
1176 static inline bool is_device_private_page(const struct page *page)
1178 return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) && IS_ENABLED(CONFIG_DEVICE_PRIVATE) && is_zone_device_page(page) &&
1179 page->pgmap->type == MEMORY_DEVICE_PRIVATE;
1182 static inline bool is_pci_p2pdma_page(const struct page *page)
1184 return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) && IS_ENABLED(CONFIG_PCI_P2PDMA) && is_zone_device_page(page) &&
1185 page->pgmap->type == MEMORY_DEVICE_PCI_P2PDMA;
1189 #define page_ref_zero_or_close_to_overflow(page) ((unsigned int)page_ref_count(page) + 127u <= 127u)
1191 static inline void get_page(struct page *page)
1193 page = compound_head(page);
1195 * Getting a normal page or the head of a compound page
1196 * requires to already have an elevated page->_refcount.
1198 VM_BUG_ON_PAGE(page_ref_zero_or_close_to_overflow(page), page);
1199 page_ref_inc(page);
1202 bool __must_check try_grab_page(struct page *page, unsigned int flags);
1204 static inline __must_check bool try_get_page(struct page *page)
1206 page = compound_head(page);
1207 if (WARN_ON_ONCE(page_ref_count(page) <= 0)) {
1210 page_ref_inc(page);
1214 static inline void put_page(struct page *page)
1216 page = compound_head(page);
1219 * 2 to 1, when refcount reach one it means the page is free and we
1223 if (page_is_devmap_managed(page)) {
1224 put_devmap_managed_page(page);
1228 if (put_page_testzero(page)) {
1229 __put_page(page);
1235 * the page's refcount so that two separate items are tracked: the original page
1237 * made against the page. ("gup-pinned" is another term for the latter).
1245 * By making GUP_PIN_COUNTING_BIAS a power of two, debugging of page reference
1247 * simpler, due to the fact that adding an even power of two to the page
1256 * applications that don't have huge page reference counts, this won't be an
1261 * get_user_pages and page_mkclean and other calls that race to set up page
1266 void unpin_user_page(struct page *page);
1267 void unpin_user_pages_dirty_lock(struct page **pages, unsigned long npages, bool make_dirty);
1268 void unpin_user_pages(struct page **pages, unsigned long npages);
1271 * page_maybe_dma_pinned() - report if a page is pinned for DMA.
1273 * This function checks if a page has been pinned via a call to
1279 * GUP_PIN_COUNTING_BIAS worth of normal page references".
1281 * False positives are OK, because: a) it's unlikely for a page to get that many
1286 * more tracking data available: the 3rd struct page in the compound page is
1292 * @page: pointer to page to be queried.
1293 * @Return: True, if it is likely that the page has been "dma-pinned".
1294 * False, if the page is definitely not dma-pinned.
1296 static inline bool page_maybe_dma_pinned(struct page *page)
1298 if (hpage_pincount_available(page)) {
1299 return compound_pincount(page) > 0;
1310 return ((unsigned int)page_ref_count(compound_head(page))) >= GUP_PIN_COUNTING_BIAS;
1321 * node id available in page flags.
1325 static inline int page_zone_id(struct page *page)
1327 return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK;
1331 extern int page_to_nid(const struct page *page);
1333 static inline int page_to_nid(const struct page *page)
1335 struct page *p = (struct page *)page;
1379 static inline int page_cpupid_xchg_last(struct page *page, int cpupid)
1381 return xchg(&page->_last_cpupid, cpupid & LAST_CPUPID_MASK);
1384 static inline int page_cpupid_last(struct page *page)
1386 return page->_last_cpupid;
1388 static inline void page_cpupid_reset_last(struct page *page)
1390 page->_last_cpupid = -1 & LAST_CPUPID_MASK;
1393 static inline int page_cpupid_last(struct page *page)
1395 return (page->flags >> LAST_CPUPID_PGSHIFT) & LAST_CPUPID_MASK;
1398 extern int page_cpupid_xchg_last(struct page *page, int cpupid);
1400 static inline void page_cpupid_reset_last(struct page *page)
1402 page->flags |= LAST_CPUPID_MASK << LAST_CPUPID_PGSHIFT;
1406 static inline int page_cpupid_xchg_last(struct page *page, int cpupid)
1408 return page_to_nid(page); /* XXX */
1411 static inline int page_cpupid_last(struct page *page)
1413 return page_to_nid(page); /* XXX */
1441 static inline void page_cpupid_reset_last(struct page *page)
1454 * KASAN per-page tags are stored xor'ed with 0xff. This allows to avoid
1459 static inline u8 page_kasan_tag(const struct page *page)
1463 tag = (page->flags >> KASAN_TAG_PGSHIFT) & KASAN_TAG_MASK;
1469 static inline void page_kasan_tag_set(struct page *page, u8 tag)
1472 page->flags &= ~(KASAN_TAG_MASK << KASAN_TAG_PGSHIFT);
1473 page->flags |= (tag & KASAN_TAG_MASK) << KASAN_TAG_PGSHIFT;
1476 static inline void page_kasan_tag_reset(struct page *page)
1478 page_kasan_tag_set(page, 0xff);
1481 static inline u8 page_kasan_tag(const struct page *page)
1486 static inline void page_kasan_tag_set(struct page *page, u8 tag)
1489 static inline void page_kasan_tag_reset(struct page *page)
1494 static inline struct zone *page_zone(const struct page *page)
1496 return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)];
1499 static inline pg_data_t *page_pgdat(const struct page *page)
1501 return NODE_DATA(page_to_nid(page));
1505 static inline void set_page_section(struct page *page, unsigned long section)
1507 page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT);
1508 page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT;
1511 static inline unsigned long page_to_section(const struct page *page)
1513 return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
1517 static inline void set_page_zone(struct page *page, enum zone_type zone)
1519 page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT);
1520 page->flags |= (zone & ZONES_MASK) << ZONES_PGSHIFT;
1523 static inline void set_page_node(struct page *page, unsigned long node)
1525 page->flags &= ~(NODES_MASK << NODES_PGSHIFT);
1526 page->flags |= (node & NODES_MASK) << NODES_PGSHIFT;
1529 static inline void set_page_links(struct page *page, enum zone_type zone, unsigned long node, unsigned long pfn)
1531 set_page_zone(page, zone);
1532 set_page_node(page, node);
1534 set_page_section(page, pfn_to_section_nr(pfn));
1539 static inline struct mem_cgroup *page_memcg(struct page *page)
1541 return page->mem_cgroup;
1543 static inline struct mem_cgroup *page_memcg_rcu(struct page *page)
1546 return READ_ONCE(page->mem_cgroup);
1549 static inline struct mem_cgroup *page_memcg(struct page *page)
1553 static inline struct mem_cgroup *page_memcg_rcu(struct page *page)
1565 static __always_inline void *lowmem_page_address(const struct page *page)
1567 return page_to_virt(page);
1575 static inline void *page_address(const struct page *page)
1577 return page->virtual;
1579 static inline void set_page_address(struct page *page, void *address)
1581 page->virtual = address;
1589 void *page_address(const struct page *page);
1590 void set_page_address(struct page *page, void *virtual);
1595 #define page_address(page) lowmem_page_address(page)
1596 #define set_page_address(page, address) \
1604 extern void *page_rmapping(struct page *page);
1605 extern struct anon_vma *page_anon_vma(struct page *page);
1606 extern struct address_space *page_mapping(struct page *page);
1608 extern struct address_space *__page_file_mapping(struct page *);
1610 static inline struct address_space *page_file_mapping(struct page *page)
1612 if (unlikely(PageSwapCache(page))) {
1613 return __page_file_mapping(page);
1616 return page->mapping;
1619 extern pgoff_t __page_file_index(struct page *page);
1622 * Return the pagecache index of the passed page. Regular pagecache pages
1625 static inline pgoff_t page_index(struct page *page)
1627 if (unlikely(PageSwapCache(page))) {
1628 return __page_file_index(page);
1630 return page->index;
1633 bool page_mapped(struct page *page);
1634 struct address_space *page_mapping(struct page *page);
1635 struct address_space *page_mapping_file(struct page *page);
1638 * Return true only if the page has been allocated with
1642 static inline bool page_is_pfmemalloc(struct page *page)
1646 * a pfmemalloc page.
1648 return page->index == -1UL;
1652 * Only to be called by the page allocator on a freshly allocated
1653 * page.
1655 static inline void set_page_pfmemalloc(struct page *page)
1657 page->index = -1UL;
1660 static inline void clear_page_pfmemalloc(struct page *page)
1662 page->index = 0;
1671 #define offset_in_thp(page, p) ((unsigned long)(p) & (thp_size(page) - 1))
1696 struct address_space *check_mapping; /* Check page->mapping if set */
1697 pgoff_t first_index; /* Lowest page->index to unmap */
1698 pgoff_t last_index; /* Highest page->index to unmap */
1699 struct page *single_page; /* Locked page to be unmapped */
1702 struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, pte_t pte);
1703 struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr, pmd_t pmd);
1726 int truncate_inode_page(struct address_space *mapping, struct page *page);
1727 int generic_error_remove_page(struct address_space *mapping, struct page *page);
1728 int invalidate_inode_page(struct page *page);
1734 void unmap_mapping_page(struct page *page);
1752 static inline void unmap_mapping_page(struct page *page)
1776 struct page **pages, struct vm_area_struct **vmas, int *locked);
1778 struct page **pages, struct vm_area_struct **vmas, int *locked);
1779 long get_user_pages(unsigned long start, unsigned long nr_pages, unsigned int gup_flags, struct page **pages,
1781 long pin_user_pages(unsigned long start, unsigned long nr_pages, unsigned int gup_flags, struct page **pages,
1783 long get_user_pages_locked(unsigned long start, unsigned long nr_pages, unsigned int gup_flags, struct page **pages,
1785 long pin_user_pages_locked(unsigned long start, unsigned long nr_pages, unsigned int gup_flags, struct page **pages,
1787 long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages, struct page **pages, unsigned int gup_flags);
1788 long pin_user_pages_unlocked(unsigned long start, unsigned long nr_pages, struct page **pages, unsigned int gup_flags);
1790 int get_user_pages_fast(unsigned long start, int nr_pages, unsigned int gup_flags, struct page **pages);
1791 int pin_user_pages_fast(unsigned long start, int nr_pages, unsigned int gup_flags, struct page **pages);
1801 bool got_ref; /* Did we pin pages by getting page ref? */
1820 static inline struct page **frame_vector_pages(struct frame_vector *vec)
1828 return (struct page **)(vec->ptrs);
1840 int get_kernel_pages(const struct kvec *iov, int nr_pages, int write, struct page **pages);
1841 int get_kernel_page(unsigned long start, int write, struct page **pages);
1842 struct page *get_dump_page(unsigned long addr);
1844 extern int try_to_release_page(struct page *page, gfp_t gfp_mask);
1845 extern void do_invalidatepage(struct page *page, unsigned int offset, unsigned int length);
1847 void __set_page_dirty(struct page *, struct address_space *, int warn);
1848 int __set_page_dirty_nobuffers(struct page *page);
1849 int __set_page_dirty_no_writeback(struct page *page);
1850 int redirty_page_for_writepage(struct writeback_control *wbc, struct page *page);
1851 void account_page_dirtied(struct page *page, struct address_space *mapping);
1852 void account_page_cleaned(struct page *page, struct address_space *mapping, struct bdi_writeback *wb);
1853 int set_page_dirty(struct page *page);
1854 int set_page_dirty_lock(struct page *page);
1855 void __cancel_dirty_page(struct page *page);
1856 static inline void cancel_dirty_page(struct page *page)
1859 if (PageDirty(page)) {
1860 __cancel_dirty_page(page);
1863 int clear_page_dirty_for_io(struct page *page);
1894 int get_user_pages_fast_only(unsigned long start, int nr_pages, unsigned int gup_flags, struct page **pages);
1895 int pin_user_pages_fast_only(unsigned long start, int nr_pages, unsigned int gup_flags, struct page **pages);
1897 static inline bool get_user_page_fast_only(unsigned long addr, unsigned int gup_flags, struct page **pagep)
1954 /* Optimized variant when page is already known not to be PageAnon */
1955 static inline int mm_counter_file(struct page *page)
1957 if (PageSwapBacked(page)) {
1963 static inline int mm_counter(struct page *page)
1965 if (PageAnon(page)) {
1968 return mm_counter_file(page);
2187 extern bool ptlock_alloc(struct page *page);
2188 extern void ptlock_free(struct page *page);
2190 static inline spinlock_t *ptlock_ptr(struct page *page)
2192 return page->ptl;
2199 static inline bool ptlock_alloc(struct page *page)
2204 static inline void ptlock_free(struct page *page)
2208 static inline spinlock_t *ptlock_ptr(struct page *page)
2210 return &page->ptl;
2219 static inline bool ptlock_init(struct page *page)
2222 * prep_new_page() initialize page->private (and therefore page->ptl)
2225 * It can happen if arch try to use slab for page table allocation:
2226 * slab code uses page->slab_cache, which share storage with page->ptl.
2228 VM_BUG_ON_PAGE(*(unsigned long *)&page->ptl, page);
2229 if (!ptlock_alloc(page)) {
2232 spin_lock_init(ptlock_ptr(page));
2247 static inline bool ptlock_init(struct page *page)
2251 static inline void ptlock_free(struct page *page)
2262 static inline bool pgtable_pte_page_ctor(struct page *page)
2264 if (!ptlock_init(page)) {
2267 __SetPageTable(page);
2268 inc_zone_page_state(page, NR_PAGETABLE);
2272 static inline void pgtable_pte_page_dtor(struct page *page)
2274 ptlock_free(page);
2275 __ClearPageTable(page);
2276 dec_zone_page_state(page, NR_PAGETABLE);
2306 static struct page *pmd_to_page(pmd_t *pmd)
2317 static inline bool pmd_ptlock_init(struct page *page)
2320 page->pmd_huge_pte = NULL;
2322 return ptlock_init(page);
2325 static inline void pmd_ptlock_free(struct page *page)
2328 VM_BUG_ON_PAGE(page->pmd_huge_pte, page);
2330 ptlock_free(page);
2342 static inline bool pmd_ptlock_init(struct page *page)
2346 static inline void pmd_ptlock_free(struct page *page)
2361 static inline bool pgtable_pmd_page_ctor(struct page *page)
2363 if (!pmd_ptlock_init(page)) {
2366 __SetPageTable(page);
2367 inc_zone_page_state(page, NR_PAGETABLE);
2371 static inline void pgtable_pmd_page_dtor(struct page *page)
2373 pmd_ptlock_free(page);
2374 __ClearPageTable(page);
2375 dec_zone_page_state(page, NR_PAGETABLE);
2411 * Free a highmem page into the buddy system, adjusting totalhigh_pages
2414 extern void free_highmem_page(struct page *page);
2417 extern void adjust_managed_page_count(struct page *page, long count);
2422 /* Free the reserved page into the buddy system, so it gets managed. */
2423 static inline void __free_reserved_page(struct page *page)
2425 ClearPageReserved(page);
2426 init_page_count(page);
2427 __free_page(page);
2430 static inline void free_reserved_page(struct page *page)
2432 __free_reserved_page(page);
2433 adjust_managed_page_count(page, 1);
2436 static inline void mark_page_reserved(struct page *page)
2438 SetPageReserved(page);
2439 adjust_managed_page_count(page, -1);
2470 * An architecture is expected to register range of page frames backed by
2606 struct page **pages);
2663 /* mm/page-writeback.c */
2664 int __must_check write_one_page(struct page *page);
2764 int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *);
2765 int vm_insert_pages(struct vm_area_struct *vma, unsigned long addr, struct page **pages, unsigned long *num);
2766 int vm_map_pages(struct vm_area_struct *vma, struct page **pages, unsigned long num);
2767 int vm_map_pages_zero(struct vm_area_struct *vma, struct page **pages, unsigned long num);
2775 static inline vm_fault_t vmf_insert_page(struct vm_area_struct *vma, unsigned long addr, struct page *page)
2777 int err = vm_insert_page(vma, addr, page);
2803 struct page *follow_page(struct vm_area_struct *vma, unsigned long address, unsigned int foll_flags);
2806 #define FOLL_TOUCH 0x02 /* mark page accessed */
2807 #define FOLL_GET 0x04 /* do get_page on page */
2813 #define FOLL_POPULATE 0x40 /* fault in page */
2815 #define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */
2816 #define FOLL_NUMA 0x200 /* force NUMA hinting page fault */
2817 #define FOLL_MIGRATION 0x400 /* wait for page to replace migration entry */
2832 * FOLL_LONGTERM indicates that the page will be held for an indefinite time
2840 * pin, delaying writeback, bounce buffer page writeback, etc. As FS DAX was
2852 * that region. And so, CMA attempts to migrate the page before pinning, when
2855 * FOLL_PIN indicates that a special kind of tracking (not just page->_refcount,
2857 * anything that gets a page reference and then touches page data (for example,
2906 extern void kernel_poison_pages(struct page *page, int numpages, int enable);
2916 static inline void _kernel_poison_pages(struct page *page, int nunmpages)
2919 static inline void kernel_poison_pages(struct page *page, int numpages, int enable)
2976 extern void __kernel_map_pages(struct page *page, int numpages, int enable);
2982 static inline void kernel_map_pages(struct page *page, int numpages, int enable)
2984 __kernel_map_pages(page, numpages, enable);
2987 extern bool kernel_page_present(struct page *page);
2990 static inline void kernel_map_pages(struct page *page, int numpages, int enable)
2994 static inline bool kernel_page_present(struct page *page)
3046 struct page *__populate_section_memmap(unsigned long pfn, unsigned long nr_pages, int nid, struct vmem_altmap *altmap);
3062 void register_page_bootmem_memmap(unsigned long section_nr, struct page *map, unsigned long nr_pages);
3076 extern void shake_page(struct page *p, int access);
3117 extern void clear_huge_page(struct page *page, unsigned long addr_hint, unsigned int pages_per_huge_page);
3118 extern void copy_user_huge_page(struct page *dst, struct page *src, unsigned long addr_hint, struct vm_area_struct *vma,
3120 extern long copy_huge_page_from_user(struct page *dst_page, const void __user *usr_src,
3124 * vma_is_special_huge - Are transhuge page-table entries considered special?
3127 * Whether transhuge page-table entries are considered "special" following
3130 * Return: true if transhuge page-table entries should be considered special,
3154 static inline bool page_is_guard(struct page *page)
3160 return PageGuard(page);
3171 static inline bool page_is_guard(struct page *page)
3185 extern int memcmp_pages(struct page *page1, struct page *page2);
3187 static inline int pages_identical(struct page *page1, struct page *page2)