block: don't make REQ_POLLED imply REQ_NOWAIT
[platform/kernel/linux-starfive.git] / mm / internal.h
index e6029d9..a7d9e98 100644 (file)
@@ -133,8 +133,8 @@ int truncate_inode_folio(struct address_space *mapping, struct folio *folio);
 bool truncate_inode_partial_folio(struct folio *folio, loff_t start,
                loff_t end);
 long invalidate_inode_page(struct page *page);
-unsigned long invalidate_mapping_pagevec(struct address_space *mapping,
-               pgoff_t start, pgoff_t end, unsigned long *nr_pagevec);
+unsigned long mapping_try_invalidate(struct address_space *mapping,
+               pgoff_t start, pgoff_t end, unsigned long *nr_failed);
 
 /**
  * folio_evictable - Test whether a folio is evictable.
@@ -202,10 +202,12 @@ extern char * const zone_names[MAX_NR_ZONES];
 /* perform sanity checks on struct pages being allocated or freed */
 DECLARE_STATIC_KEY_MAYBE(CONFIG_DEBUG_VM, check_pages_enabled);
 
-static inline bool is_check_pages_enabled(void)
-{
-       return static_branch_unlikely(&check_pages_enabled);
-}
+extern int min_free_kbytes;
+
+void setup_per_zone_wmarks(void);
+void calculate_min_free_kbytes(void);
+int __meminit init_per_zone_wmark_min(void);
+void page_alloc_sysctl_init(void);
 
 /*
  * Structure for holding the mostly immutable allocation parameters passed
@@ -365,6 +367,13 @@ static inline struct page *pageblock_pfn_to_page(unsigned long start_pfn,
        return __pageblock_pfn_to_page(start_pfn, end_pfn, zone);
 }
 
+void set_zone_contiguous(struct zone *zone);
+
+static inline void clear_zone_contiguous(struct zone *zone)
+{
+       zone->contiguous = false;
+}
+
 extern int __isolate_free_page(struct page *page, unsigned int order);
 extern void __putback_isolated_page(struct page *page, unsigned int order,
                                    int mt);
@@ -372,12 +381,27 @@ extern void memblock_free_pages(struct page *page, unsigned long pfn,
                                        unsigned int order);
 extern void __free_pages_core(struct page *page, unsigned int order);
 
+/*
+ * This will have no effect, other than possibly generating a warning, if the
+ * caller passes in a non-large folio.
+ */
+static inline void folio_set_order(struct folio *folio, unsigned int order)
+{
+       if (WARN_ON_ONCE(!order || !folio_test_large(folio)))
+               return;
+
+       folio->_folio_order = order;
+#ifdef CONFIG_64BIT
+       folio->_folio_nr_pages = 1U << order;
+#endif
+}
+
 static inline void prep_compound_head(struct page *page, unsigned int order)
 {
        struct folio *folio = (struct folio *)page;
 
-       set_compound_page_dtor(page, COMPOUND_PAGE_DTOR);
-       set_compound_order(page, order);
+       folio_set_compound_dtor(folio, COMPOUND_PAGE_DTOR);
+       folio_set_order(folio, order);
        atomic_set(&folio->_entire_mapcount, -1);
        atomic_set(&folio->_nr_pages_mapped, 0);
        atomic_set(&folio->_pincount, 0);
@@ -410,27 +434,12 @@ extern void *memmap_alloc(phys_addr_t size, phys_addr_t align,
                          phys_addr_t min_addr,
                          int nid, bool exact_nid);
 
-int split_free_page(struct page *free_page,
-                       unsigned int order, unsigned long split_pfn_offset);
+void memmap_init_range(unsigned long, int, unsigned long, unsigned long,
+               unsigned long, enum meminit_context, struct vmem_altmap *, int);
 
-/*
- * This will have no effect, other than possibly generating a warning, if the
- * caller passes in a non-large folio.
- */
-static inline void folio_set_order(struct folio *folio, unsigned int order)
-{
-       if (WARN_ON_ONCE(!folio_test_large(folio)))
-               return;
 
-       folio->_folio_order = order;
-#ifdef CONFIG_64BIT
-       /*
-        * When hugetlb dissolves a folio, we need to clear the tail
-        * page, rather than setting nr_pages to 1.
-        */
-       folio->_folio_nr_pages = order ? 1U << order : 0;
-#endif
-}
+int split_free_page(struct page *free_page,
+                       unsigned int order, unsigned long split_pfn_offset);
 
 #if defined CONFIG_COMPACTION || defined CONFIG_CMA
 
@@ -557,8 +566,8 @@ extern long populate_vma_page_range(struct vm_area_struct *vma,
 extern long faultin_vma_page_range(struct vm_area_struct *vma,
                                   unsigned long start, unsigned long end,
                                   bool write, int *locked);
-extern int mlock_future_check(struct mm_struct *mm, unsigned long flags,
-                             unsigned long len);
+extern bool mlock_future_ok(struct mm_struct *mm, unsigned long flags,
+                              unsigned long bytes);
 /*
  * mlock_vma_folio() and munlock_vma_folio():
  * should be called with vma's mmap_lock held for read or write,
@@ -1041,17 +1050,17 @@ static inline void vma_iter_store(struct vma_iterator *vmi,
 {
 
 #if defined(CONFIG_DEBUG_VM_MAPLE_TREE)
-       if (WARN_ON(vmi->mas.node != MAS_START && vmi->mas.index > vma->vm_start)) {
-               printk("%lu > %lu\n", vmi->mas.index, vma->vm_start);
-               printk("store of vma %lu-%lu", vma->vm_start, vma->vm_end);
-               printk("into slot    %lu-%lu", vmi->mas.index, vmi->mas.last);
-               mt_dump(vmi->mas.tree);
+       if (MAS_WARN_ON(&vmi->mas, vmi->mas.node != MAS_START &&
+                       vmi->mas.index > vma->vm_start)) {
+               pr_warn("%lx > %lx\n store vma %lx-%lx\n into slot %lx-%lx\n",
+                       vmi->mas.index, vma->vm_start, vma->vm_start,
+                       vma->vm_end, vmi->mas.index, vmi->mas.last);
        }
-       if (WARN_ON(vmi->mas.node != MAS_START && vmi->mas.last <  vma->vm_start)) {
-               printk("%lu < %lu\n", vmi->mas.last, vma->vm_start);
-               printk("store of vma %lu-%lu", vma->vm_start, vma->vm_end);
-               printk("into slot    %lu-%lu", vmi->mas.index, vmi->mas.last);
-               mt_dump(vmi->mas.tree);
+       if (MAS_WARN_ON(&vmi->mas, vmi->mas.node != MAS_START &&
+                       vmi->mas.last <  vma->vm_start)) {
+               pr_warn("%lx < %lx\nstore vma %lx-%lx\ninto slot %lx-%lx\n",
+                      vmi->mas.last, vma->vm_start, vma->vm_start, vma->vm_end,
+                      vmi->mas.index, vmi->mas.last);
        }
 #endif