From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Wed, 25 Apr 2007 14:16:20 +0100 Subject: Re: [RFC 16/16] Variable Order Page Cache: Alternate implementation of page cache macros Message-ID: <20070425131620.GH19942@skynet.ie> References: <20070423064845.5458.2190.sendpatchset@schroedinger.engr.sgi.com> <20070423065008.5458.77842.sendpatchset@schroedinger.engr.sgi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20070423065008.5458.77842.sendpatchset@schroedinger.engr.sgi.com> From: mel@skynet.ie (Mel Gorman) Sender: owner-linux-mm@kvack.org Return-Path: To: Christoph Lameter Cc: linux-mm@kvack.org, William Lee Irwin III , Badari Pulavarty , David Chinner , Jens Axboe , Adam Litke , Dave Hansen , Avi Kivity List-ID: On (22/04/07 23:50), Christoph Lameter didst pronounce: > Variable Order Page Cache: Alternate implementation of page cache macros > > Implement the page cache macros in a more efficient way by storing key > values in the mapping. This reduces code size but increases inode size. > Considering the hilarity with large inode-related caches and updatedb, it may be best to keep the inode size down for the moment and do a performance comparison later to see if anything is gained by the reduced codesize. > Signed-off-by: Christoph Lameter > > --- > include/linux/fs.h | 4 +++- > include/linux/pagemap.h | 13 +++++++------ > 2 files changed, 10 insertions(+), 7 deletions(-) > > Index: linux-2.6.21-rc7/include/linux/fs.h > =================================================================== > --- linux-2.6.21-rc7.orig/include/linux/fs.h 2007-04-22 19:43:01.000000000 -0700 > +++ linux-2.6.21-rc7/include/linux/fs.h 2007-04-22 19:44:29.000000000 -0700 > @@ -435,7 +435,9 @@ struct address_space { > struct inode *host; /* owner: inode, block_device */ > struct radix_tree_root page_tree; /* radix tree of all pages */ > rwlock_t tree_lock; /* and rwlock protecting it */ > - unsigned int order; /* Page order in this space */ > + unsigned int shift; /* Shift for to get to the page number */ > + unsigned int order; /* Page order for allocations */ > + loff_t offset_mask; /* To mask out offset in page */ > unsigned int i_mmap_writable;/* count VM_SHARED mappings */ > struct prio_tree_root i_mmap; /* tree of private and shared mappings */ > struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ > Index: linux-2.6.21-rc7/include/linux/pagemap.h > =================================================================== > --- linux-2.6.21-rc7.orig/include/linux/pagemap.h 2007-04-22 19:44:16.000000000 -0700 > +++ linux-2.6.21-rc7/include/linux/pagemap.h 2007-04-22 19:46:23.000000000 -0700 > @@ -42,7 +42,8 @@ static inline void mapping_set_gfp_mask( > static inline void set_mapping_order(struct address_space *m, int order) > { > m->order = order; > - > + m->shift = order + PAGE_SHIFT; > + m->offset_mask = (1UL << m->shift) -1; > if (order) > m->flags |= __GFP_COMP; > else > @@ -64,23 +65,23 @@ static inline void set_mapping_order(str > > static inline int page_cache_shift(struct address_space *a) > { > - return a->order + PAGE_SHIFT; > + return a->shift; > } > > static inline unsigned int page_cache_size(struct address_space *a) > { > - return PAGE_SIZE << a->order; > + return a->offset_mask + 1; > } > > static inline loff_t page_cache_mask(struct address_space *a) > { > - return (loff_t)PAGE_MASK << a->order; > + return ~(loff_t)a->offset_mask; > } > > static inline unsigned int page_cache_offset(struct address_space *a, > loff_t pos) > { > - return pos & ~(PAGE_MASK << a->order); > + return pos & a->offset_mask; > } > > static inline pgoff_t page_cache_index(struct address_space *a, > @@ -95,7 +96,7 @@ static inline pgoff_t page_cache_index(s > static inline pgoff_t page_cache_next(struct address_space *a, > loff_t pos) > { > - return page_cache_index(a, pos + page_cache_size(a) - 1); > + return page_cache_index(a, pos + a->offset_mask); > } > > static inline loff_t page_cache_pos(struct address_space *a, -- -- Mel Gorman Part-time Phd Student Linux Technology Center University of Limerick IBM Dublin Software Lab -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org