From dc2b1201cf5756b18bc67c6c2b73d9dde49a1ed4 Mon Sep 17 00:00:00 2001 From: Lee Schermerhorn Date: Sat, 18 Oct 2008 20:26:42 -0700 Subject: [PATCH] --- yaml --- r: 115848 b: refs/heads/master c: ba9ddf49391645e6bb93219131a40446538a5e76 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/ramfs/inode.c | 1 + trunk/include/linux/pagemap.h | 22 ++++++++++++++++++++++ trunk/mm/vmscan.c | 5 +++++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 23b54d9e2652..9190ab7da88d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 7b854121eb3e5ba0241882ff939e2c485228c9c5 +refs/heads/master: ba9ddf49391645e6bb93219131a40446538a5e76 diff --git a/trunk/fs/ramfs/inode.c b/trunk/fs/ramfs/inode.c index b13123424e49..f031d1c925f0 100644 --- a/trunk/fs/ramfs/inode.c +++ b/trunk/fs/ramfs/inode.c @@ -61,6 +61,7 @@ struct inode *ramfs_get_inode(struct super_block *sb, int mode, dev_t dev) inode->i_mapping->a_ops = &ramfs_aops; inode->i_mapping->backing_dev_info = &ramfs_backing_dev_info; mapping_set_gfp_mask(inode->i_mapping, GFP_HIGHUSER); + mapping_set_unevictable(inode->i_mapping); inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; switch (mode & S_IFMT) { default: diff --git a/trunk/include/linux/pagemap.h b/trunk/include/linux/pagemap.h index 5da31c12101c..09164d2c5c27 100644 --- a/trunk/include/linux/pagemap.h +++ b/trunk/include/linux/pagemap.h @@ -32,6 +32,28 @@ static inline void mapping_set_error(struct address_space *mapping, int error) } } +#ifdef CONFIG_UNEVICTABLE_LRU +#define AS_UNEVICTABLE (__GFP_BITS_SHIFT + 2) /* e.g., ramdisk, SHM_LOCK */ + +static inline void mapping_set_unevictable(struct address_space *mapping) +{ + set_bit(AS_UNEVICTABLE, &mapping->flags); +} + +static inline int mapping_unevictable(struct address_space *mapping) +{ + if (mapping && (mapping->flags & AS_UNEVICTABLE)) + return 1; + return 0; +} +#else +static inline void mapping_set_unevictable(struct address_space *mapping) { } +static inline int mapping_unevictable(struct address_space *mapping) +{ + return 0; +} +#endif + static inline gfp_t mapping_gfp_mask(struct address_space * mapping) { return (__force gfp_t)mapping->flags & __GFP_BITS_MASK; diff --git a/trunk/mm/vmscan.c b/trunk/mm/vmscan.c index 2804d23e2da7..9babfbc1ddc8 100644 --- a/trunk/mm/vmscan.c +++ b/trunk/mm/vmscan.c @@ -2332,11 +2332,16 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order) * lists vs unevictable list. * * Reasons page might not be evictable: + * (1) page's mapping marked unevictable + * * TODO - later patches */ int page_evictable(struct page *page, struct vm_area_struct *vma) { + if (mapping_unevictable(page_mapping(page))) + return 0; + /* TODO: test page [!]evictable conditions */ return 1;