aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2014-04-03 17:47:46 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-03 19:21:00 -0400
commit0cd6144aadd2afd19d1aca880153530c52957604 (patch)
tree529df1dc75d6a58eff057dde5feb07cecf6ba527 /include
parente7b563bb2a6f4d974208da46200784b9c5b5a47e (diff)
mm + fs: prepare for non-page entries in page cache radix trees
shmem mappings already contain exceptional entries where swap slot information is remembered. To be able to store eviction information for regular page cache, prepare every site dealing with the radix trees directly to handle entries other than pages. The common lookup functions will filter out non-page entries and return NULL for page cache holes, just as before. But provide a raw version of the API which returns non-page entries as well, and switch shmem over to use it. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Reviewed-by: Rik van Riel <riel@redhat.com> Reviewed-by: Minchan Kim <minchan@kernel.org> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Bob Liu <bob.liu@oracle.com> Cc: Christoph Hellwig <hch@infradead.org> Cc: Dave Chinner <david@fromorbit.com> Cc: Greg Thelen <gthelen@google.com> Cc: Hugh Dickins <hughd@google.com> Cc: Jan Kara <jack@suse.cz> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Luigi Semenzato <semenzato@google.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Metin Doslu <metin@citusdata.com> Cc: Michel Lespinasse <walken@google.com> Cc: Ozgun Erdogan <ozgun@citusdata.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Roman Gushchin <klamm@yandex-team.ru> Cc: Ryan Mallon <rmallon@gmail.com> Cc: Tejun Heo <tj@kernel.org> Cc: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mm.h8
-rw-r--r--include/linux/pagemap.h15
-rw-r--r--include/linux/pagevec.h5
-rw-r--r--include/linux/shmem_fs.h1
4 files changed, 23 insertions, 6 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 2eec61fe75c9..b1331aff769c 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1041,6 +1041,14 @@ extern void show_free_areas(unsigned int flags);
1041extern bool skip_free_areas_node(unsigned int flags, int nid); 1041extern bool skip_free_areas_node(unsigned int flags, int nid);
1042 1042
1043int shmem_zero_setup(struct vm_area_struct *); 1043int shmem_zero_setup(struct vm_area_struct *);
1044#ifdef CONFIG_SHMEM
1045bool shmem_mapping(struct address_space *mapping);
1046#else
1047static inline bool shmem_mapping(struct address_space *mapping)
1048{
1049 return false;
1050}
1051#endif
1044 1052
1045extern int can_do_mlock(void); 1053extern int can_do_mlock(void);
1046extern int user_shm_lock(size_t, struct user_struct *); 1054extern int user_shm_lock(size_t, struct user_struct *);
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 52d56872fe26..493bfd85214e 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -248,12 +248,15 @@ pgoff_t page_cache_next_hole(struct address_space *mapping,
248pgoff_t page_cache_prev_hole(struct address_space *mapping, 248pgoff_t page_cache_prev_hole(struct address_space *mapping,
249 pgoff_t index, unsigned long max_scan); 249 pgoff_t index, unsigned long max_scan);
250 250
251extern struct page * find_get_page(struct address_space *mapping, 251struct page *find_get_entry(struct address_space *mapping, pgoff_t offset);
252 pgoff_t index); 252struct page *find_get_page(struct address_space *mapping, pgoff_t offset);
253extern struct page * find_lock_page(struct address_space *mapping, 253struct page *find_lock_entry(struct address_space *mapping, pgoff_t offset);
254 pgoff_t index); 254struct page *find_lock_page(struct address_space *mapping, pgoff_t offset);
255extern struct page * find_or_create_page(struct address_space *mapping, 255struct page *find_or_create_page(struct address_space *mapping, pgoff_t index,
256 pgoff_t index, gfp_t gfp_mask); 256 gfp_t gfp_mask);
257unsigned find_get_entries(struct address_space *mapping, pgoff_t start,
258 unsigned int nr_entries, struct page **entries,
259 pgoff_t *indices);
257unsigned find_get_pages(struct address_space *mapping, pgoff_t start, 260unsigned find_get_pages(struct address_space *mapping, pgoff_t start,
258 unsigned int nr_pages, struct page **pages); 261 unsigned int nr_pages, struct page **pages);
259unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start, 262unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start,
diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h
index e4dbfab37729..b45d391b4540 100644
--- a/include/linux/pagevec.h
+++ b/include/linux/pagevec.h
@@ -22,6 +22,11 @@ struct pagevec {
22 22
23void __pagevec_release(struct pagevec *pvec); 23void __pagevec_release(struct pagevec *pvec);
24void __pagevec_lru_add(struct pagevec *pvec); 24void __pagevec_lru_add(struct pagevec *pvec);
25unsigned pagevec_lookup_entries(struct pagevec *pvec,
26 struct address_space *mapping,
27 pgoff_t start, unsigned nr_entries,
28 pgoff_t *indices);
29void pagevec_remove_exceptionals(struct pagevec *pvec);
25unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping, 30unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping,
26 pgoff_t start, unsigned nr_pages); 31 pgoff_t start, unsigned nr_pages);
27unsigned pagevec_lookup_tag(struct pagevec *pvec, 32unsigned pagevec_lookup_tag(struct pagevec *pvec,
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index 9d55438bc4ad..4d1771c2d29f 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -51,6 +51,7 @@ extern struct file *shmem_kernel_file_setup(const char *name, loff_t size,
51 unsigned long flags); 51 unsigned long flags);
52extern int shmem_zero_setup(struct vm_area_struct *); 52extern int shmem_zero_setup(struct vm_area_struct *);
53extern int shmem_lock(struct file *file, int lock, struct user_struct *user); 53extern int shmem_lock(struct file *file, int lock, struct user_struct *user);
54extern bool shmem_mapping(struct address_space *mapping);
54extern void shmem_unlock_mapping(struct address_space *mapping); 55extern void shmem_unlock_mapping(struct address_space *mapping);
55extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping, 56extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
56 pgoff_t index, gfp_t gfp_mask); 57 pgoff_t index, gfp_t gfp_mask);