public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rik van Riel <riel@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Lee Schermerhorn <lee.schermerhorn@hp.com>,
	Kosaki Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Christoph Lameter <clameter@sgi.com>
Subject: [PATCH -mm 02/16] Use an indexed array for LRU variables
Date: Fri, 23 May 2008 15:55:08 -0400	[thread overview]
Message-ID: <20080523195534.918991067@redhat.com> (raw)
In-Reply-To: 20080523195506.084894989@redhat.com

[-- Attachment #1: cl-use-indexed-array-of-lru-lists.patch --]
[-- Type: text/plain, Size: 3209 bytes --]

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


  parent reply	other threads:[~2008-05-23 19:58 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-23 19:55 [PATCH -mm 00/16] VM pageout scalability improvements (V8) Rik van Riel
2008-05-23 19:55 ` [PATCH -mm 01/16] move isolate_lru_page() to vmscan.c Rik van Riel
2008-05-23 19:55 ` Rik van Riel [this message]
2008-05-27 16:54   ` [PATCH -mm 02/16] Use an indexed array for LRU variables Lee Schermerhorn
2008-05-27 17:03     ` Rik van Riel
2008-05-23 19:55 ` [PATCH -mm 03/16] use an array for the LRU pagevecs Rik van Riel
2008-05-23 19:55 ` [PATCH -mm 04/16] free swap space on swap-in/activation Rik van Riel
2008-05-28  9:08   ` Daisuke Nishimura
2008-05-23 19:55 ` [PATCH -mm 05/16] define page_file_cache() function Rik van Riel
2008-05-23 19:55 ` [PATCH -mm 06/16] split LRU lists into anon & file sets Rik van Riel
2008-05-23 19:55 ` [PATCH -mm 07/16] second chance replacement for anonymous pages Rik van Riel
2008-05-28  5:36   ` Daisuke Nishimura
2008-05-28 13:39     ` Rik van Riel
2008-05-28 15:42       ` Daisuke Nishimura
2008-05-28 16:08         ` Rik van Riel
2008-05-28 11:03   ` KOSAKI Motohiro
2008-05-28 13:43     ` Rik van Riel
2008-05-23 19:55 ` [PATCH -mm 08/16] add some sanity checks to get_scan_ratio Rik van Riel
2008-05-23 19:55 ` [PATCH -mm 09/16] fix pagecache reclaim referenced bit check Rik van Riel
2008-05-23 19:55 ` [PATCH -mm 10/16] add newly swapped in pages to the inactive list Rik van Riel
2008-05-23 19:55 ` [PATCH -mm 11/16] more aggressively use lumpy reclaim Rik van Riel
2008-05-23 19:55 ` [PATCH -mm 12/16] pageflag helpers for configed-out flags Rik van Riel
2008-05-23 19:55 ` [PATCH -mm 13/16] No Reclaim LRU Infrastructure Rik van Riel
2008-05-23 19:55 ` [PATCH -mm 14/16] Non-reclaimable page statistics Rik van Riel
2008-05-23 19:55 ` [PATCH -mm 15/16] ramfs pages are non-reclaimable Rik van Riel
2008-05-23 19:55 ` [PATCH -mm 16/16] SHM_LOCKED pages are nonreclaimable Rik van Riel
2008-05-26 18:24 ` [PATCH -mm 00/16] VM pageout scalability improvements (V8) Balbir Singh
2008-05-26 19:33   ` Rik van Riel
2008-05-27 15:54     ` Lee Schermerhorn
2008-05-27 16:10       ` Balbir Singh
2008-05-28  1:12       ` KAMEZAWA Hiroyuki
2008-05-28 11:04         ` [RFC PATCH] No Reclaim LRU Infrastructure enhancement for memcgroup KOSAKI Motohiro
2008-05-29  2:30           ` Balbir Singh
2008-05-29 11:14             ` Daisuke Nishimura
2008-05-28 11:49     ` [PATCH -mm 00/16] VM pageout scalability improvements (V8) Balbir Singh
2008-05-28 13:33       ` KOSAKI Motohiro
2008-05-28 13:36         ` Balbir Singh
2008-05-29 12:47 ` Carsten Otte
2008-05-29 14:43   ` Rik van Riel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080523195534.918991067@redhat.com \
    --to=riel@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=clameter@sgi.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=lee.schermerhorn@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox