block: add QUEUE_FLAG_NOWAIT
[linux-2.6-microblaze.git] / mm / internal.h
index b5634e7..10c6776 100644 (file)
@@ -49,18 +49,20 @@ void unmap_page_range(struct mmu_gather *tlb,
                             unsigned long addr, unsigned long end,
                             struct zap_details *details);
 
-extern unsigned int __do_page_cache_readahead(struct address_space *mapping,
-               struct file *filp, pgoff_t offset, unsigned long nr_to_read,
+void force_page_cache_readahead(struct address_space *, struct file *,
+               pgoff_t index, unsigned long nr_to_read);
+void __do_page_cache_readahead(struct address_space *, struct file *,
+               pgoff_t index, unsigned long nr_to_read,
                unsigned long lookahead_size);
 
 /*
  * Submit IO for the read-ahead request in file_ra_state.
  */
-static inline unsigned long ra_submit(struct file_ra_state *ra,
+static inline void ra_submit(struct file_ra_state *ra,
                struct address_space *mapping, struct file *filp)
 {
-       return __do_page_cache_readahead(mapping, filp,
-                                       ra->start, ra->size, ra->async_size);
+       __do_page_cache_readahead(mapping, filp,
+                       ra->start, ra->size, ra->async_size);
 }
 
 /**
@@ -125,12 +127,12 @@ extern pmd_t *mm_find_pmd(struct mm_struct *mm, unsigned long address);
  * between functions involved in allocations, including the alloc_pages*
  * family of functions.
  *
- * nodemask, migratetype and high_zoneidx are initialized only once in
+ * nodemask, migratetype and highest_zoneidx are initialized only once in
  * __alloc_pages_nodemask() and then never change.
  *
- * zonelist, preferred_zone and classzone_idx are set first in
+ * zonelist, preferred_zone and highest_zoneidx are set first in
  * __alloc_pages_nodemask() for the fast path, and might be later changed
- * in __alloc_pages_slowpath(). All other functions pass the whole strucure
+ * in __alloc_pages_slowpath(). All other functions pass the whole structure
  * by a const pointer.
  */
 struct alloc_context {
@@ -138,12 +140,21 @@ struct alloc_context {
        nodemask_t *nodemask;
        struct zoneref *preferred_zoneref;
        int migratetype;
-       enum zone_type high_zoneidx;
+
+       /*
+        * highest_zoneidx represents highest usable zone index of
+        * the allocation request. Due to the nature of the zone,
+        * memory on lower zone than the highest_zoneidx will be
+        * protected by lowmem_reserve[highest_zoneidx].
+        *
+        * highest_zoneidx is also used by reclaim/compaction to limit
+        * the target zone since higher zone than this index cannot be
+        * usable for this allocation request.
+        */
+       enum zone_type highest_zoneidx;
        bool spread_dirty_pages;
 };
 
-#define ac_classzone_idx(ac) zonelist_zone_idx(ac->preferred_zoneref)
-
 /*
  * Locate the struct page for both the matching buddy in our
  * pair (buddy1) and the combined O(n+1) page they form (page).
@@ -222,12 +233,13 @@ struct compact_control {
        int order;                      /* order a direct compactor needs */
        int migratetype;                /* migratetype of direct compactor */
        const unsigned int alloc_flags; /* alloc flags of a direct compactor */
-       const int classzone_idx;        /* zone index of a direct compactor */
+       const int highest_zoneidx;      /* zone index of a direct compactor */
        enum migrate_mode mode;         /* Async or sync migration mode */
        bool ignore_skip_hint;          /* Scan blocks even if marked skip */
        bool no_set_skip_hint;          /* Don't mark blocks for skipping */
        bool ignore_block_suitable;     /* Scan blocks considered unsuitable */
        bool direct_compaction;         /* False from kcompactd or /proc/... */
+       bool proactive_compaction;      /* kcompactd proactive compaction */
        bool whole_zone;                /* Whole zone should/has been scanned */
        bool contended;                 /* Signal lock or sched contention */
        bool rescan;                    /* Rescanning the same pageblock */
@@ -333,7 +345,7 @@ static inline void munlock_vma_pages_all(struct vm_area_struct *vma)
 }
 
 /*
- * must be called with vma's mmap_sem held for read or write, and page locked.
+ * must be called with vma's mmap_lock held for read or write, and page locked.
  */
 extern void mlock_vma_page(struct page *page);
 extern unsigned int munlock_vma_page(struct page *page);
@@ -357,7 +369,7 @@ extern void clear_page_mlock(struct page *page);
 static inline void mlock_migrate_page(struct page *newpage, struct page *page)
 {
        if (TestClearPageMlocked(page)) {
-               int nr_pages = hpage_nr_pages(page);
+               int nr_pages = thp_nr_pages(page);
 
                /* Holding pmd lock, no change in irq context: __mod is safe */
                __mod_zone_page_state(page_zone(page), NR_MLOCK, -nr_pages);
@@ -384,7 +396,7 @@ vma_address(struct page *page, struct vm_area_struct *vma)
        unsigned long start, end;
 
        start = __vma_address(page, vma);
-       end = start + PAGE_SIZE * (hpage_nr_pages(page) - 1);
+       end = start + thp_size(page) - PAGE_SIZE;
 
        /* page should be within @vma mapping range */
        VM_BUG_ON_VMA(end < vma->vm_start || start >= vma->vm_end, vma);
@@ -402,13 +414,13 @@ static inline struct file *maybe_unlock_mmap_for_io(struct vm_fault *vmf,
 
        /*
         * FAULT_FLAG_RETRY_NOWAIT means we don't want to wait on page locks or
-        * anything, so we only pin the file and drop the mmap_sem if only
+        * anything, so we only pin the file and drop the mmap_lock if only
         * FAULT_FLAG_ALLOW_RETRY is set, while this is the first attempt.
         */
        if (fault_flag_allow_retry_first(flags) &&
            !(flags & FAULT_FLAG_RETRY_NOWAIT)) {
                fpin = get_file(vmf->vma->vm_file);
-               up_read(&vmf->vma->vm_mm->mmap_sem);
+               mmap_read_unlock(vmf->vma->vm_mm);
        }
        return fpin;
 }
@@ -527,7 +539,7 @@ extern unsigned long  __must_check vm_mmap_pgoff(struct file *, unsigned long,
         unsigned long, unsigned long);
 
 extern void set_pageblock_order(void);
-unsigned long reclaim_clean_pages_from_list(struct zone *zone,
+unsigned int reclaim_clean_pages_from_list(struct zone *zone,
                                            struct list_head *page_list);
 /* The ALLOC_WMARK bits are used as an index to zone->watermark */
 #define ALLOC_WMARK_MIN                WMARK_MIN
@@ -601,5 +613,11 @@ static inline bool is_migrate_highatomic_page(struct page *page)
 }
 
 void setup_zone_pageset(struct zone *zone);
-extern struct page *alloc_new_node_page(struct page *page, unsigned long node);
+
+struct migration_target_control {
+       int nid;                /* preferred node id */
+       nodemask_t *nmask;
+       gfp_t gfp_mask;
+};
+
 #endif /* __MM_INTERNAL_H */