internal.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. /* internal.h: mm/ internal definitions
  2. *
  3. * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
  4. * Copyright (C) 2021 XiaoMi, Inc.
  5. * Written by David Howells (dhowells@redhat.com)
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version
  10. * 2 of the License, or (at your option) any later version.
  11. */
  12. #ifndef __MM_INTERNAL_H
  13. #define __MM_INTERNAL_H
  14. #include <linux/fs.h>
  15. #include <linux/mm.h>
  16. #include <linux/pagemap.h>
  17. #include <linux/tracepoint-defs.h>
  18. /*
  19. * The set of flags that only affect watermark checking and reclaim
  20. * behaviour. This is used by the MM to obey the caller constraints
  21. * about IO, FS and watermark checking while ignoring placement
  22. * hints such as HIGHMEM usage.
  23. */
  24. #define GFP_RECLAIM_MASK (__GFP_RECLAIM|__GFP_HIGH|__GFP_IO|__GFP_FS|\
  25. __GFP_NOWARN|__GFP_RETRY_MAYFAIL|__GFP_NOFAIL|\
  26. __GFP_NORETRY|__GFP_MEMALLOC|__GFP_NOMEMALLOC|\
  27. __GFP_ATOMIC)
  28. /* The GFP flags allowed during early boot */
  29. #define GFP_BOOT_MASK (__GFP_BITS_MASK & ~(__GFP_RECLAIM|__GFP_IO|__GFP_FS))
  30. /* Control allocation cpuset and node placement constraints */
  31. #define GFP_CONSTRAINT_MASK (__GFP_HARDWALL|__GFP_THISNODE)
  32. /* Do not use these with a slab allocator */
  33. #define GFP_SLAB_BUG_MASK (__GFP_DMA32|__GFP_HIGHMEM|~__GFP_BITS_MASK)
  34. void page_writeback_init(void);
  35. int do_swap_page(struct vm_fault *vmf);
  36. #ifdef CONFIG_SPECULATIVE_PAGE_FAULT
  37. extern struct vm_area_struct *get_vma(struct mm_struct *mm,
  38. unsigned long addr);
  39. extern void put_vma(struct vm_area_struct *vma);
  40. static inline bool vma_has_changed(struct vm_fault *vmf)
  41. {
  42. int ret = RB_EMPTY_NODE(&vmf->vma->vm_rb);
  43. unsigned int seq = READ_ONCE(vmf->vma->vm_sequence.sequence);
  44. /*
  45. * Matches both the wmb in write_seqlock_{begin,end}() and
  46. * the wmb in vma_rb_erase().
  47. */
  48. smp_rmb();
  49. return ret || seq != vmf->sequence;
  50. }
  51. #endif /* CONFIG_SPECULATIVE_PAGE_FAULT */
  52. void free_pgtables(struct mmu_gather *tlb, struct vm_area_struct *start_vma,
  53. unsigned long floor, unsigned long ceiling);
  54. static inline bool can_madv_dontneed_vma(struct vm_area_struct *vma)
  55. {
  56. return !(vma->vm_flags & (VM_LOCKED|VM_HUGETLB|VM_PFNMAP));
  57. }
  58. void unmap_page_range(struct mmu_gather *tlb,
  59. struct vm_area_struct *vma,
  60. unsigned long addr, unsigned long end,
  61. struct zap_details *details);
  62. extern int __do_page_cache_readahead(struct address_space *mapping,
  63. struct file *filp, pgoff_t offset, unsigned long nr_to_read,
  64. unsigned long lookahead_size);
  65. /*
  66. * Submit IO for the read-ahead request in file_ra_state.
  67. */
  68. static inline unsigned long ra_submit(struct file_ra_state *ra,
  69. struct address_space *mapping, struct file *filp)
  70. {
  71. return __do_page_cache_readahead(mapping, filp,
  72. ra->start, ra->size, ra->async_size);
  73. }
  74. /*
  75. * Turn a non-refcounted page (->_refcount == 0) into refcounted with
  76. * a count of one.
  77. */
  78. static inline void set_page_refcounted(struct page *page)
  79. {
  80. VM_BUG_ON_PAGE(PageTail(page), page);
  81. VM_BUG_ON_PAGE(page_ref_count(page), page);
  82. set_page_count(page, 1);
  83. }
  84. extern unsigned long highest_memmap_pfn;
  85. /*
  86. * Maximum number of reclaim retries without progress before the OOM
  87. * killer is consider the only way forward.
  88. */
  89. #define MAX_RECLAIM_RETRIES 16
  90. /*
  91. * in mm/vmscan.c:
  92. */
  93. extern int isolate_lru_page(struct page *page);
  94. extern void putback_lru_page(struct page *page);
  95. /*
  96. * in mm/rmap.c:
  97. */
  98. extern pmd_t *mm_find_pmd(struct mm_struct *mm, unsigned long address);
  99. /*
  100. * in mm/page_alloc.c
  101. */
  102. /*
  103. * Structure for holding the mostly immutable allocation parameters passed
  104. * between functions involved in allocations, including the alloc_pages*
  105. * family of functions.
  106. *
  107. * nodemask, migratetype and high_zoneidx are initialized only once in
  108. * __alloc_pages_nodemask() and then never change.
  109. *
  110. * zonelist, preferred_zone and classzone_idx are set first in
  111. * __alloc_pages_nodemask() for the fast path, and might be later changed
  112. * in __alloc_pages_slowpath(). All other functions pass the whole strucure
  113. * by a const pointer.
  114. */
  115. struct alloc_context {
  116. struct zonelist *zonelist;
  117. nodemask_t *nodemask;
  118. struct zoneref *preferred_zoneref;
  119. int migratetype;
  120. enum zone_type high_zoneidx;
  121. bool spread_dirty_pages;
  122. };
  123. #define ac_classzone_idx(ac) zonelist_zone_idx(ac->preferred_zoneref)
  124. /*
  125. * Locate the struct page for both the matching buddy in our
  126. * pair (buddy1) and the combined O(n+1) page they form (page).
  127. *
  128. * 1) Any buddy B1 will have an order O twin B2 which satisfies
  129. * the following equation:
  130. * B2 = B1 ^ (1 << O)
  131. * For example, if the starting buddy (buddy2) is #8 its order
  132. * 1 buddy is #10:
  133. * B2 = 8 ^ (1 << 1) = 8 ^ 2 = 10
  134. *
  135. * 2) Any buddy B will have an order O+1 parent P which
  136. * satisfies the following equation:
  137. * P = B & ~(1 << O)
  138. *
  139. * Assumption: *_mem_map is contiguous at least up to MAX_ORDER
  140. */
  141. static inline unsigned long
  142. __find_buddy_pfn(unsigned long page_pfn, unsigned int order)
  143. {
  144. return page_pfn ^ (1 << order);
  145. }
  146. extern struct page *__pageblock_pfn_to_page(unsigned long start_pfn,
  147. unsigned long end_pfn, struct zone *zone);
  148. static inline struct page *pageblock_pfn_to_page(unsigned long start_pfn,
  149. unsigned long end_pfn, struct zone *zone)
  150. {
  151. if (zone->contiguous)
  152. return pfn_to_page(start_pfn);
  153. return __pageblock_pfn_to_page(start_pfn, end_pfn, zone);
  154. }
  155. extern int __isolate_free_page(struct page *page, unsigned int order);
  156. extern void __free_pages_bootmem(struct page *page, unsigned long pfn,
  157. unsigned int order);
  158. extern void prep_compound_page(struct page *page, unsigned int order);
  159. extern void post_alloc_hook(struct page *page, unsigned int order,
  160. gfp_t gfp_flags);
  161. extern int user_min_free_kbytes;
  162. #if defined CONFIG_COMPACTION || defined CONFIG_CMA
  163. /*
  164. * in mm/compaction.c
  165. */
  166. /*
  167. * compact_control is used to track pages being migrated and the free pages
  168. * they are being migrated to during memory compaction. The free_pfn starts
  169. * at the end of a zone and migrate_pfn begins at the start. Movable pages
  170. * are moved to the end of a zone during a compaction run and the run
  171. * completes when free_pfn <= migrate_pfn
  172. */
  173. struct compact_control {
  174. struct list_head freepages; /* List of free pages to migrate to */
  175. struct list_head migratepages; /* List of pages being migrated */
  176. struct zone *zone;
  177. unsigned long nr_freepages; /* Number of isolated free pages */
  178. unsigned long nr_migratepages; /* Number of pages to migrate */
  179. unsigned long total_migrate_scanned;
  180. unsigned long total_free_scanned;
  181. unsigned long free_pfn; /* isolate_freepages search base */
  182. unsigned long migrate_pfn; /* isolate_migratepages search base */
  183. unsigned long last_migrated_pfn;/* Not yet flushed page being freed */
  184. const gfp_t gfp_mask; /* gfp mask of a direct compactor */
  185. int order; /* order a direct compactor needs */
  186. int migratetype; /* migratetype of direct compactor */
  187. const unsigned int alloc_flags; /* alloc flags of a direct compactor */
  188. const int classzone_idx; /* zone index of a direct compactor */
  189. enum migrate_mode mode; /* Async or sync migration mode */
  190. bool ignore_skip_hint; /* Scan blocks even if marked skip */
  191. bool ignore_block_suitable; /* Scan blocks considered unsuitable */
  192. bool direct_compaction; /* False from kcompactd or /proc/... */
  193. bool whole_zone; /* Whole zone should/has been scanned */
  194. bool contended; /* Signal lock or sched contention */
  195. bool finishing_block; /* Finishing current pageblock */
  196. };
  197. unsigned long
  198. isolate_freepages_range(struct compact_control *cc,
  199. unsigned long start_pfn, unsigned long end_pfn);
  200. unsigned long
  201. isolate_migratepages_range(struct compact_control *cc,
  202. unsigned long low_pfn, unsigned long end_pfn);
  203. int find_suitable_fallback(struct free_area *area, unsigned int order,
  204. int migratetype, bool only_stealable, bool *can_steal, unsigned int start_order);
  205. #endif
  206. /*
  207. * This function returns the order of a free page in the buddy system. In
  208. * general, page_zone(page)->lock must be held by the caller to prevent the
  209. * page from being allocated in parallel and returning garbage as the order.
  210. * If a caller does not hold page_zone(page)->lock, it must guarantee that the
  211. * page cannot be allocated or merged in parallel. Alternatively, it must
  212. * handle invalid values gracefully, and use page_order_unsafe() below.
  213. */
  214. static inline unsigned int page_order(struct page *page)
  215. {
  216. /* PageBuddy() must be checked by the caller */
  217. return page_private(page);
  218. }
  219. /*
  220. * Like page_order(), but for callers who cannot afford to hold the zone lock.
  221. * PageBuddy() should be checked first by the caller to minimize race window,
  222. * and invalid values must be handled gracefully.
  223. *
  224. * READ_ONCE is used so that if the caller assigns the result into a local
  225. * variable and e.g. tests it for valid range before using, the compiler cannot
  226. * decide to remove the variable and inline the page_private(page) multiple
  227. * times, potentially observing different values in the tests and the actual
  228. * use of the result.
  229. */
  230. #define page_order_unsafe(page) READ_ONCE(page_private(page))
  231. static inline bool is_cow_mapping(vm_flags_t flags)
  232. {
  233. return (flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE;
  234. }
  235. /*
  236. * These three helpers classifies VMAs for virtual memory accounting.
  237. */
  238. /*
  239. * Executable code area - executable, not writable, not stack
  240. */
  241. static inline bool is_exec_mapping(vm_flags_t flags)
  242. {
  243. return (flags & (VM_EXEC | VM_WRITE | VM_STACK)) == VM_EXEC;
  244. }
  245. /*
  246. * Stack area - atomatically grows in one direction
  247. *
  248. * VM_GROWSUP / VM_GROWSDOWN VMAs are always private anonymous:
  249. * do_mmap() forbids all other combinations.
  250. */
  251. static inline bool is_stack_mapping(vm_flags_t flags)
  252. {
  253. return (flags & VM_STACK) == VM_STACK;
  254. }
  255. /*
  256. * Data area - private, writable, not stack
  257. */
  258. static inline bool is_data_mapping(vm_flags_t flags)
  259. {
  260. return (flags & (VM_WRITE | VM_SHARED | VM_STACK)) == VM_WRITE;
  261. }
  262. /* mm/util.c */
  263. void __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma,
  264. struct vm_area_struct *prev, struct rb_node *rb_parent);
  265. #ifdef CONFIG_MMU
  266. extern long populate_vma_page_range(struct vm_area_struct *vma,
  267. unsigned long start, unsigned long end, int *nonblocking);
  268. extern void munlock_vma_pages_range(struct vm_area_struct *vma,
  269. unsigned long start, unsigned long end);
  270. static inline void munlock_vma_pages_all(struct vm_area_struct *vma)
  271. {
  272. munlock_vma_pages_range(vma, vma->vm_start, vma->vm_end);
  273. }
  274. /*
  275. * must be called with vma's mmap_sem held for read or write, and page locked.
  276. */
  277. extern void mlock_vma_page(struct page *page);
  278. extern unsigned int munlock_vma_page(struct page *page);
  279. /*
  280. * Clear the page's PageMlocked(). This can be useful in a situation where
  281. * we want to unconditionally remove a page from the pagecache -- e.g.,
  282. * on truncation or freeing.
  283. *
  284. * It is legal to call this function for any page, mlocked or not.
  285. * If called for a page that is still mapped by mlocked vmas, all we do
  286. * is revert to lazy LRU behaviour -- semantics are not broken.
  287. */
  288. extern void clear_page_mlock(struct page *page);
  289. /*
  290. * mlock_migrate_page - called only from migrate_misplaced_transhuge_page()
  291. * (because that does not go through the full procedure of migration ptes):
  292. * to migrate the Mlocked page flag; update statistics.
  293. */
  294. static inline void mlock_migrate_page(struct page *newpage, struct page *page)
  295. {
  296. if (TestClearPageMlocked(page)) {
  297. int nr_pages = hpage_nr_pages(page);
  298. /* Holding pmd lock, no change in irq context: __mod is safe */
  299. __mod_zone_page_state(page_zone(page), NR_MLOCK, -nr_pages);
  300. SetPageMlocked(newpage);
  301. __mod_zone_page_state(page_zone(newpage), NR_MLOCK, nr_pages);
  302. }
  303. }
  304. extern pmd_t maybe_pmd_mkwrite(pmd_t pmd, struct vm_area_struct *vma);
  305. /*
  306. * At what user virtual address is page expected in vma?
  307. * Returns -EFAULT if all of the page is outside the range of vma.
  308. * If page is a compound head, the entire compound page is considered.
  309. */
  310. static inline unsigned long
  311. vma_address(struct page *page, struct vm_area_struct *vma)
  312. {
  313. pgoff_t pgoff;
  314. unsigned long address;
  315. VM_BUG_ON_PAGE(PageKsm(page), page); /* KSM page->index unusable */
  316. pgoff = page_to_pgoff(page);
  317. if (pgoff >= vma->vm_pgoff) {
  318. address = vma->vm_start +
  319. ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
  320. /* Check for address beyond vma (or wrapped through 0?) */
  321. if (address < vma->vm_start || address >= vma->vm_end)
  322. address = -EFAULT;
  323. } else if (PageHead(page) &&
  324. pgoff + (1UL << compound_order(page)) - 1 >= vma->vm_pgoff) {
  325. /* Test above avoids possibility of wrap to 0 on 32-bit */
  326. address = vma->vm_start;
  327. } else {
  328. address = -EFAULT;
  329. }
  330. return address;
  331. }
  332. /*
  333. * Then at what user virtual address will none of the page be found in vma?
  334. * Assumes that vma_address() already returned a good starting address.
  335. * If page is a compound head, the entire compound page is considered.
  336. */
  337. static inline unsigned long
  338. vma_address_end(struct page *page, struct vm_area_struct *vma)
  339. {
  340. pgoff_t pgoff;
  341. unsigned long address;
  342. VM_BUG_ON_PAGE(PageKsm(page), page); /* KSM page->index unusable */
  343. pgoff = page_to_pgoff(page) + (1UL << compound_order(page));
  344. address = vma->vm_start + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
  345. /* Check for address beyond vma (or wrapped through 0?) */
  346. if (address < vma->vm_start || address > vma->vm_end)
  347. address = vma->vm_end;
  348. return address;
  349. }
  350. #else /* !CONFIG_MMU */
  351. static inline void clear_page_mlock(struct page *page) { }
  352. static inline void mlock_vma_page(struct page *page) { }
  353. static inline void mlock_migrate_page(struct page *new, struct page *old) { }
  354. #endif /* !CONFIG_MMU */
  355. /*
  356. * Return the mem_map entry representing the 'offset' subpage within
  357. * the maximally aligned gigantic page 'base'. Handle any discontiguity
  358. * in the mem_map at MAX_ORDER_NR_PAGES boundaries.
  359. */
  360. static inline struct page *mem_map_offset(struct page *base, int offset)
  361. {
  362. if (unlikely(offset >= MAX_ORDER_NR_PAGES))
  363. return nth_page(base, offset);
  364. return base + offset;
  365. }
  366. /*
  367. * Iterator over all subpages within the maximally aligned gigantic
  368. * page 'base'. Handle any discontiguity in the mem_map.
  369. */
  370. static inline struct page *mem_map_next(struct page *iter,
  371. struct page *base, int offset)
  372. {
  373. if (unlikely((offset & (MAX_ORDER_NR_PAGES - 1)) == 0)) {
  374. unsigned long pfn = page_to_pfn(base) + offset;
  375. if (!pfn_valid(pfn))
  376. return NULL;
  377. return pfn_to_page(pfn);
  378. }
  379. return iter + 1;
  380. }
  381. /*
  382. * FLATMEM and DISCONTIGMEM configurations use alloc_bootmem_node,
  383. * so all functions starting at paging_init should be marked __init
  384. * in those cases. SPARSEMEM, however, allows for memory hotplug,
  385. * and alloc_bootmem_node is not used.
  386. */
  387. #ifdef CONFIG_SPARSEMEM
  388. #define __paginginit __meminit
  389. #else
  390. #define __paginginit __init
  391. #endif
  392. /* Memory initialisation debug and verification */
  393. enum mminit_level {
  394. MMINIT_WARNING,
  395. MMINIT_VERIFY,
  396. MMINIT_TRACE
  397. };
  398. #ifdef CONFIG_DEBUG_MEMORY_INIT
  399. extern int mminit_loglevel;
  400. #define mminit_dprintk(level, prefix, fmt, arg...) \
  401. do { \
  402. if (level < mminit_loglevel) { \
  403. if (level <= MMINIT_WARNING) \
  404. pr_warn("mminit::" prefix " " fmt, ##arg); \
  405. else \
  406. printk(KERN_DEBUG "mminit::" prefix " " fmt, ##arg); \
  407. } \
  408. } while (0)
  409. extern void mminit_verify_pageflags_layout(void);
  410. extern void mminit_verify_zonelist(void);
  411. #else
  412. static inline void mminit_dprintk(enum mminit_level level,
  413. const char *prefix, const char *fmt, ...)
  414. {
  415. }
  416. static inline void mminit_verify_pageflags_layout(void)
  417. {
  418. }
  419. static inline void mminit_verify_zonelist(void)
  420. {
  421. }
  422. #endif /* CONFIG_DEBUG_MEMORY_INIT */
  423. /* mminit_validate_memmodel_limits is independent of CONFIG_DEBUG_MEMORY_INIT */
  424. #if defined(CONFIG_SPARSEMEM)
  425. extern void mminit_validate_memmodel_limits(unsigned long *start_pfn,
  426. unsigned long *end_pfn);
  427. #else
  428. static inline void mminit_validate_memmodel_limits(unsigned long *start_pfn,
  429. unsigned long *end_pfn)
  430. {
  431. }
  432. #endif /* CONFIG_SPARSEMEM */
  433. #define NODE_RECLAIM_NOSCAN -2
  434. #define NODE_RECLAIM_FULL -1
  435. #define NODE_RECLAIM_SOME 0
  436. #define NODE_RECLAIM_SUCCESS 1
  437. #ifdef CONFIG_NUMA
  438. extern int node_reclaim(struct pglist_data *, gfp_t, unsigned int);
  439. #else
  440. static inline int node_reclaim(struct pglist_data *pgdat, gfp_t mask,
  441. unsigned int order)
  442. {
  443. return NODE_RECLAIM_NOSCAN;
  444. }
  445. #endif
  446. extern int hwpoison_filter(struct page *p);
  447. extern u32 hwpoison_filter_dev_major;
  448. extern u32 hwpoison_filter_dev_minor;
  449. extern u64 hwpoison_filter_flags_mask;
  450. extern u64 hwpoison_filter_flags_value;
  451. extern u64 hwpoison_filter_memcg;
  452. extern u32 hwpoison_filter_enable;
  453. extern unsigned long __must_check vm_mmap_pgoff(struct file *, unsigned long,
  454. unsigned long, unsigned long,
  455. unsigned long, unsigned long);
  456. extern void set_pageblock_order(void);
  457. unsigned long reclaim_clean_pages_from_list(struct zone *zone,
  458. struct list_head *page_list);
  459. /* The ALLOC_WMARK bits are used as an index to zone->watermark */
  460. #define ALLOC_WMARK_MIN WMARK_MIN
  461. #define ALLOC_WMARK_LOW WMARK_LOW
  462. #define ALLOC_WMARK_HIGH WMARK_HIGH
  463. #define ALLOC_NO_WATERMARKS 0x04 /* don't check watermarks at all */
  464. /* Mask to get the watermark bits */
  465. #define ALLOC_WMARK_MASK (ALLOC_NO_WATERMARKS-1)
  466. /*
  467. * Only MMU archs have async oom victim reclaim - aka oom_reaper so we
  468. * cannot assume a reduced access to memory reserves is sufficient for
  469. * !MMU
  470. */
  471. #ifdef CONFIG_MMU
  472. #define ALLOC_OOM 0x08
  473. #else
  474. #define ALLOC_OOM ALLOC_NO_WATERMARKS
  475. #endif
  476. #define ALLOC_HARDER 0x10 /* try to alloc harder */
  477. #define ALLOC_HIGH 0x20 /* __GFP_HIGH set */
  478. #define ALLOC_CPUSET 0x40 /* check for correct cpuset */
  479. #define ALLOC_CMA 0x80 /* allow allocations from CMA areas */
  480. enum ttu_flags;
  481. struct tlbflush_unmap_batch;
  482. /*
  483. * only for MM internal work items which do not depend on
  484. * any allocations or locks which might depend on allocations
  485. */
  486. extern struct workqueue_struct *mm_percpu_wq;
  487. #ifdef CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH
  488. void try_to_unmap_flush(void);
  489. void try_to_unmap_flush_dirty(void);
  490. void flush_tlb_batched_pending(struct mm_struct *mm);
  491. #else
  492. static inline void try_to_unmap_flush(void)
  493. {
  494. }
  495. static inline void try_to_unmap_flush_dirty(void)
  496. {
  497. }
  498. static inline void flush_tlb_batched_pending(struct mm_struct *mm)
  499. {
  500. }
  501. #endif /* CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH */
  502. extern const struct trace_print_flags pageflag_names[];
  503. extern const struct trace_print_flags vmaflag_names[];
  504. extern const struct trace_print_flags gfpflag_names[];
  505. static inline bool is_migrate_highatomic(enum migratetype migratetype)
  506. {
  507. return migratetype == MIGRATE_HIGHATOMIC;
  508. }
  509. static inline bool is_migrate_highatomic_page(struct page *page)
  510. {
  511. return get_pageblock_migratetype(page) == MIGRATE_HIGHATOMIC;
  512. }
  513. void setup_zone_pageset(struct zone *zone);
  514. #define IS_ZONE_MOVABLE_CMA_ZONE(z) IS_ZONE_MOVABLE_CMA_ZONE_IDX(\
  515. zone_idx(z))
  516. ssize_t print_max_page_owner(void);
  517. #endif /* __MM_INTERNAL_H */