diff options
author | Peter W Morreale <pmorreale@novell.com> | 2009-04-06 22:00:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-07 11:31:03 -0400 |
commit | fafd688e4c0c34da0f3de909881117d374e4c7af (patch) | |
tree | 5c61d499b96d78f5b56507a5d34af0ccd7c69060 /kernel/sysctl.c | |
parent | a56ed663047fc9927ec8b35750d23ece54f85dc7 (diff) |
mm: add /proc controls for pdflush threads
Add /proc entries to give the admin the ability to control the minimum and
maximum number of pdflush threads. This allows finer control of pdflush
on both large and small machines.
The rationale is simply one size does not fit all. Admins on large and/or
small systems may want to tune the min/max pdflush thread count to best
suit their needs. Right now the min/max is hardcoded to 2/8. While
probably a fair estimate for smaller machines, large machines with large
numbers of CPUs and large numbers of filesystems/block devices may benefit
from larger numbers of threads working on different block devices.
Even if the background flushing algorithm is radically changed, it is
still likely that multiple threads will be involved and admins would still
desire finer control on the min/max other than to have to recompile the
kernel.
The patch adds '/proc/sys/vm/nr_pdflush_threads_min' and
'/proc/sys/vm/nr_pdflush_threads_max' with r/w permissions.
The minimum value for nr_pdflush_threads_min is 1 and the maximum value is
the current value of nr_pdflush_threads_max. This minimum is required
since additional thread creation is performed in a pdflush thread itself.
The minimum value for nr_pdflush_threads_max is the current value of
nr_pdflush_threads_min and the maximum value can be 1000.
Documentation/sysctl/vm.txt is also updated.
[akpm@linux-foundation.org: fix comment, fix whitespace, use __read_mostly]
Signed-off-by: Peter W Morreale <pmorreale@novell.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r-- | kernel/sysctl.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index b125e3387568..72eb1a41dcab 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -101,6 +101,7 @@ static int __maybe_unused one = 1; | |||
101 | static int __maybe_unused two = 2; | 101 | static int __maybe_unused two = 2; |
102 | static unsigned long one_ul = 1; | 102 | static unsigned long one_ul = 1; |
103 | static int one_hundred = 100; | 103 | static int one_hundred = 100; |
104 | static int one_thousand = 1000; | ||
104 | 105 | ||
105 | /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ | 106 | /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ |
106 | static int maxolduid = 65535; | 107 | static int maxolduid = 65535; |
@@ -1027,6 +1028,28 @@ static struct ctl_table vm_table[] = { | |||
1027 | .proc_handler = &proc_dointvec, | 1028 | .proc_handler = &proc_dointvec, |
1028 | }, | 1029 | }, |
1029 | { | 1030 | { |
1031 | .ctl_name = CTL_UNNUMBERED, | ||
1032 | .procname = "nr_pdflush_threads_min", | ||
1033 | .data = &nr_pdflush_threads_min, | ||
1034 | .maxlen = sizeof nr_pdflush_threads_min, | ||
1035 | .mode = 0644 /* read-write */, | ||
1036 | .proc_handler = &proc_dointvec_minmax, | ||
1037 | .strategy = &sysctl_intvec, | ||
1038 | .extra1 = &one, | ||
1039 | .extra2 = &nr_pdflush_threads_max, | ||
1040 | }, | ||
1041 | { | ||
1042 | .ctl_name = CTL_UNNUMBERED, | ||
1043 | .procname = "nr_pdflush_threads_max", | ||
1044 | .data = &nr_pdflush_threads_max, | ||
1045 | .maxlen = sizeof nr_pdflush_threads_max, | ||
1046 | .mode = 0644 /* read-write */, | ||
1047 | .proc_handler = &proc_dointvec_minmax, | ||
1048 | .strategy = &sysctl_intvec, | ||
1049 | .extra1 = &nr_pdflush_threads_min, | ||
1050 | .extra2 = &one_thousand, | ||
1051 | }, | ||
1052 | { | ||
1030 | .ctl_name = VM_SWAPPINESS, | 1053 | .ctl_name = VM_SWAPPINESS, |
1031 | .procname = "swappiness", | 1054 | .procname = "swappiness", |
1032 | .data = &vm_swappiness, | 1055 | .data = &vm_swappiness, |