aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@engr.sgi.com>2006-02-01 06:05:33 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-01 11:53:16 -0500
commit2a11ff06d7d12be5d1bbcf592fff649b45ac2388 (patch)
treecef86d3f60b6ae5b3dab277a554a92a8e08d903b
parenta92f71263af9d0ab77c260f709c0c079656221aa (diff)
[PATCH] zone_reclaim: configurable off node allocation period.
Currently the zone_reclaim code has a fixed window of 30 seconds of off node allocations should a local zone have no unused pagecache pages left. Reclaim will be attempted again after this timeout period to avoid repeated useless scans for memory. This is also useful to established sufficiently large off node allocation chunks to relieve the local node. It may be beneficial to adjust that time period for some special situations. For example if memory use was exceeding node capacity one may want to give up for longer periods of time. If memory spikes intermittendly then one may want to shorten the time period to reduce the number of off node allocations. This patch allows just that.... Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--Documentation/sysctl/vm.txt12
-rw-r--r--include/linux/swap.h1
-rw-r--r--include/linux/sysctl.h3
-rw-r--r--kernel/sysctl.c9
-rw-r--r--mm/vmscan.c4
5 files changed, 26 insertions, 3 deletions
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
index 391dd64363e7..44518c023949 100644
--- a/Documentation/sysctl/vm.txt
+++ b/Documentation/sysctl/vm.txt
@@ -28,6 +28,7 @@ Currently, these files are in /proc/sys/vm:
28- block_dump 28- block_dump
29- drop-caches 29- drop-caches
30- zone_reclaim_mode 30- zone_reclaim_mode
31- zone_reclaim_interval
31 32
32============================================================== 33==============================================================
33 34
@@ -137,4 +138,15 @@ of memory should be used for caching files from disk.
137 138
138It may be beneficial to switch this on if one wants to do zone 139It may be beneficial to switch this on if one wants to do zone
139reclaim regardless of the numa distances in the system. 140reclaim regardless of the numa distances in the system.
141================================================================
142
143zone_reclaim_interval:
144
145The time allowed for off node allocations after zone reclaim
146has failed to reclaim enough pages to allow a local allocation.
147
148Time is set in seconds and set by default to 30 seconds.
149
150Reduce the interval if undesired off node allocations occur. However, too
151frequent scans will have a negative impact onoff node allocation performance.
140 152
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 4a99e4a7fbf3..e53fef7051e6 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -178,6 +178,7 @@ extern int vm_swappiness;
178 178
179#ifdef CONFIG_NUMA 179#ifdef CONFIG_NUMA
180extern int zone_reclaim_mode; 180extern int zone_reclaim_mode;
181extern int zone_reclaim_interval;
181extern int zone_reclaim(struct zone *, gfp_t, unsigned int); 182extern int zone_reclaim(struct zone *, gfp_t, unsigned int);
182#else 183#else
183#define zone_reclaim_mode 0 184#define zone_reclaim_mode 0
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 8352a7ce5895..32a4139c4ad8 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -182,7 +182,8 @@ enum
182 VM_SWAP_TOKEN_TIMEOUT=28, /* default time for token time out */ 182 VM_SWAP_TOKEN_TIMEOUT=28, /* default time for token time out */
183 VM_DROP_PAGECACHE=29, /* int: nuke lots of pagecache */ 183 VM_DROP_PAGECACHE=29, /* int: nuke lots of pagecache */
184 VM_PERCPU_PAGELIST_FRACTION=30,/* int: fraction of pages in each percpu_pagelist */ 184 VM_PERCPU_PAGELIST_FRACTION=30,/* int: fraction of pages in each percpu_pagelist */
185 VM_ZONE_RECLAIM_MODE=31,/* reclaim local zone memory before going off node */ 185 VM_ZONE_RECLAIM_MODE=31, /* reclaim local zone memory before going off node */
186 VM_ZONE_RECLAIM_INTERVAL=32, /* time period to wait after reclaim failure */
186}; 187};
187 188
188 189
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index c74f03bc0144..71dd6f62efec 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -881,6 +881,15 @@ static ctl_table vm_table[] = {
881 .strategy = &sysctl_intvec, 881 .strategy = &sysctl_intvec,
882 .extra1 = &zero, 882 .extra1 = &zero,
883 }, 883 },
884 {
885 .ctl_name = VM_ZONE_RECLAIM_INTERVAL,
886 .procname = "zone_reclaim_interval",
887 .data = &zone_reclaim_interval,
888 .maxlen = sizeof(zone_reclaim_interval),
889 .mode = 0644,
890 .proc_handler = &proc_dointvec_jiffies,
891 .strategy = &sysctl_jiffies,
892 },
884#endif 893#endif
885 { .ctl_name = 0 } 894 { .ctl_name = 0 }
886}; 895};
diff --git a/mm/vmscan.c b/mm/vmscan.c
index f8b94ea6f722..8760a4abfa1f 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1595,7 +1595,7 @@ int zone_reclaim_mode __read_mostly;
1595/* 1595/*
1596 * Mininum time between zone reclaim scans 1596 * Mininum time between zone reclaim scans
1597 */ 1597 */
1598#define ZONE_RECLAIM_INTERVAL 30*HZ 1598int zone_reclaim_interval __read_mostly = 30*HZ;
1599 1599
1600/* 1600/*
1601 * Priority for ZONE_RECLAIM. This determines the fraction of pages 1601 * Priority for ZONE_RECLAIM. This determines the fraction of pages
@@ -1617,7 +1617,7 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
1617 int node_id; 1617 int node_id;
1618 1618
1619 if (time_before(jiffies, 1619 if (time_before(jiffies,
1620 zone->last_unsuccessful_zone_reclaim + ZONE_RECLAIM_INTERVAL)) 1620 zone->last_unsuccessful_zone_reclaim + zone_reclaim_interval))
1621 return 0; 1621 return 0;
1622 1622
1623 if (!(gfp_mask & __GFP_WAIT) || 1623 if (!(gfp_mask & __GFP_WAIT) ||