Messages in this thread | | | Subject | Re: [PATCH -mm 02/16] Use an indexed array for LRU variables | From | Lee Schermerhorn <> | Date | Tue, 27 May 2008 12:54:22 -0400 |
| |
On Fri, 2008-05-23 at 15:55 -0400, Rik van Riel wrote: > plain text document attachment > (cl-use-indexed-array-of-lru-lists.patch) > From: Christoph Lameter <clameter@sgi.com> > > Currently we are defining explicit variables for the inactive > and active list. An indexed array can be more generic and avoid > repeating similar code in several places in the reclaim code. > > We are saving a few bytes in terms of code size: > > Before: > > text data bss dec hex filename > 4097753 573120 4092484 8763357 85b7dd vmlinux > > After: > > text data bss dec hex filename > 4097729 573120 4092484 8763333 85b7c5 vmlinux > > Having an easy way to add new lru lists may ease future work on > the reclaim code. > > Signed-off-by: Rik van Riel <riel@redhat.com> > Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com> > Signed-off-by: Christoph Lameter <clameter@sgi.com> > > --- > V3 [riel]: memcontrol LRU arrayification > > V1 -> V2 [lts]: > + Remove extraneous __dec_zone_state(zone, NR_ACTIVE) pointed > out by Mel G. > > > include/linux/memcontrol.h | 17 +----- > include/linux/mm_inline.h | 33 ++++++++---- > include/linux/mmzone.h | 17 ++++-- > mm/memcontrol.c | 115 ++++++++++++++++--------------------------- > mm/page_alloc.c | 9 +-- > mm/swap.c | 2 > mm/vmscan.c | 120 +++++++++++++++++++++------------------------ > mm/vmstat.c | 3 - > 8 files changed, 146 insertions(+), 170 deletions(-) > > Index: linux-2.6.26-rc2-mm1/include/linux/mmzone.h > =================================================================== > --- linux-2.6.26-rc2-mm1.orig/include/linux/mmzone.h 2008-05-23 14:21:21.000000000 -0400 > +++ linux-2.6.26-rc2-mm1/include/linux/mmzone.h 2008-05-23 14:21:33.000000000 -0400 > @@ -81,8 +81,8 @@ struct zone_padding { > enum zone_stat_item { > /* First 128 byte cacheline (assuming 64 bit words) */ > NR_FREE_PAGES, > - NR_INACTIVE, > - NR_ACTIVE, > + NR_INACTIVE, /* must match order of LRU_[IN]ACTIVE */ > + NR_ACTIVE, /* " " " " " */ > NR_ANON_PAGES, /* Mapped anonymous pages */ > NR_FILE_MAPPED, /* pagecache pages mapped into pagetables. > only modified from process context */ > @@ -107,6 +107,13 @@ enum zone_stat_item { > #endif > NR_VM_ZONE_STAT_ITEMS }; > > +enum lru_list { > + LRU_INACTIVE, /* must match order of NR_[IN]ACTIVE */ > + LRU_ACTIVE, /* " " " " " */ > + NR_LRU_LISTS }; > + > +#define for_each_lru(l) for (l = 0; l < NR_LRU_LISTS; l++) > + > struct per_cpu_pages { > int count; /* number of pages in the list */ > int high; /* high watermark, emptying needed */ > @@ -251,10 +258,8 @@ struct zone { > > /* Fields commonly accessed by the page reclaim scanner */ > spinlock_t lru_lock; > - struct list_head active_list; > - struct list_head inactive_list; > - unsigned long nr_scan_active; > - unsigned long nr_scan_inactive; > + struct list_head list[NR_LRU_LISTS]; > + unsigned long nr_scan[NR_LRU_LISTS]; > unsigned long pages_scanned; /* since last reclaim */ > unsigned long flags; /* zone flags, see below */ > > Index: linux-2.6.26-rc2-mm1/include/linux/mm_inline.h > =================================================================== > --- linux-2.6.26-rc2-mm1.orig/include/linux/mm_inline.h 2008-05-23 14:21:21.000000000 -0400 > +++ linux-2.6.26-rc2-mm1/include/linux/mm_inline.h 2008-05-23 14:21:33 >
Rik: looks like this patch got truncated somewhere along the way.
Lee
| |