Add Kconfig option for default swappiness
Subsystems (5)
PATCH 1/1 Add Kconfig option for default swappiness
This will allow distributions to tune this important vm parameter in a more self-contained manner.
--- Documentation/sysctl/vm.txt | 2 +- mm/Kconfig | 14 ++++++++++++++ mm/vmscan.c | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-)
Documentation/sysctl/vm.txt +1 -1
@@ -643,7 +643,7 @@ This control is used to define how aggressive the kernel will swap memory pages. Higher values will increase agressiveness, lower values decrease the amount of swap. -The default value is 60. +The default value is 60 (changed with CONFIG_DEFAULT_SWAPINESS). ==============================================================
mm/Kconfig +14 -0
@@ -61,6 +61,20 @@ config SPARSEMEM_MANUAL endchoice +config DEFAULT_SWAPPINESS + int "Default swappiness" + default "60" + range 0 100 + help + This control is used to define how aggressive the kernel will swap + memory pages. Higher values will increase agressiveness, lower + values decrease the amount of swap. Valid values range from 0 to 100. + + This only sets the default value at boot. Swappiness can be set at + runtime through /proc/sys/vm/swappiness. + + If unsure, keep default value of 60. + config DISCONTIGMEM def_bool y depends on (!SELECT_MEMORY_MODEL && ARCH_DISCONTIGMEM_ENABLE) || DISCONTIGMEM_MANUAL
mm/vmscan.c +1 -1
@@ -133,7 +133,7 @@ struct scan_control {/* * From 0 .. 100. Higher means more swappy. */ -int vm_swappiness =60 ; +int vm_swappiness =CONFIG_DEFAULT_SWAPPINESS ;long vm_total_pages;/* The total number of pages which the VM controls */ static LIST_HEAD (shrinker_list);
Signature · 8 lines
1.7.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 3 lines · Ben Gamari
This will allow distributions to tune this important vm parameter in a more self-contained manner.
And they can't use an init script to tune /proc/sys/vm/swappiness because...?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 2 lines · David Rientjes
And they can't use an init script to tune
/proc/sys/vm/swappinessbecause...?
Packaging concerns, as I mentioned before,
Quoted 6 lines · Ben Gamari
Ubuntu ships different kernels for desktop and server usage. From a packaging standpoint it would be much nicer to have this set in the kernel configuration. If we were to throw the setting
/etc/sysctl.confthe kernel would depend upon the package containing sysctl(8) (procps). We'd rather avoid this and keep the default kernel configuration in one place.
In short, being able to specify this default in .config is just far simpler from a packaging standpoint than the alternatives.
- Ben
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
2010/11/2 Ben Gamari <[email protected]>:
Quoted 14 lines · David Rientjes
Quoted 2 lines
And they can't use an init script to tune
/proc/sys/vm/swappinessbecause...?Packaging concerns, as I mentioned before,
Quoted 6 lines · Ben Gamari
Ubuntu ships different kernels for desktop and server usage. From a packaging standpoint it would be much nicer to have this set in the kernel configuration. If we were to throw the setting
/etc/sysctl.confthe kernel would depend upon the package containing sysctl(8) (procps). We'd rather avoid this and keep the default kernel configuration in one place.
Quoted 3 lines
In short, being able to specify this default in .config is just far simpler from a packaging standpoint than the alternatives.
Hmm, then, can't we add a sysctl template config/script for generic sysctl values ?
Adding this kind of CONFIG one by one seems not very helpful...
Thanks,
-Kame
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 3 lines · Hiroyuki Kamezawa
Hmm, then, can't we add a sysctl template config/script for generic sysctl values ?
That is one idea. Unfortunately, then we have something of a dependency on out of tree userspace utilities.
Quoted 2 lines
Adding this kind of CONFIG one by one seems not very helpful...
This was definitely a concern of mine as well. In principle, a distribution might want to tune any of the knobs in /proc/sys, so I agree that adding them to Kconfig is a bit of a poor path to go down. That being said, swappiness is an especially important tunable.
- Ben
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 14 lines · Ben Gamari
Quoted 2 lines · David Rientjes
And they can't use an init script to tune
/proc/sys/vm/swappinessbecause...?Packaging concerns, as I mentioned before,
Quoted 6 lines · Ben Gamari
Ubuntu ships different kernels for desktop and server usage. From a packaging standpoint it would be much nicer to have this set in the kernel configuration. If we were to throw the setting
/etc/sysctl.confthe kernel would depend upon the package containing sysctl(8) (procps). We'd rather avoid this and keep the default kernel configuration in one place.
Quoted 2 lines
In short, being able to specify this default in .config is just far simpler from a packaging standpoint than the alternatives.
It's interesting to know what value you plan to use for your desktop/server systems and the rationals (is it based on any testing results?). And why it's easier to do it in kernel (hope it's not because of trouble communicating with the user space packaging team).
Thanks,
Fengguang
Quoted 8 lines · Wu Fengguang
Quoted 8 lines · Ben Gamari
Quoted 6 lines
Ubuntu ships different kernels for desktop and server usage. From a packaging standpoint it would be much nicer to have this set in the kernel configuration. If we were to throw the setting
/etc/sysctl.confthe kernel would depend upon the package containing sysctl(8) (procps). We'd rather avoid this and keep the default kernel configuration in one place.
Quoted 8 lines
Quoted 2 lines
In short, being able to specify this default in .config is just far simpler from a packaging standpoint than the alternatives.
It's interesting to know what value you plan to use for your desktop/server systems and the rationals (is it based on any testing results?). And why it's easier to do it in kernel (hope it's not because of trouble communicating with the user space packaging team).
Not sure why I was cc'd on this, but at least for Fedora, we still take the 'one kernel to rule them all' approach for every spin (and will likely continue to do so to maximise coverage testing) so a config option for us for things like this is moot.
Whenever I've tried to push changes to our defaults through to our default /etc/sysctl.conf, it's been met with resistance due to beliefs that a) the file is there for _users_ to override decisions the distro made at build time and b) if this is the right default, why isn't the kernel setting it?
The idea keeps coming up to have some userspace thing automatically tune the kernel to dtrt based upon whatever profile it has been fed. Various implementations of things like this have come and gone (Arjan and myself even wrote one circa 2000). For whatever reason, they don't seem to catch on.
Dave
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · Dave Jones
Not sure why I was cc'd on this, but at least for Fedora, we still take the 'one kernel to rule them all' approach for every spin (and will likely continue to do so to maximise coverage testing) so a config option for us for things like this is moot.
Just didn't want to miss anyone important. Sorry for the noise.
Quoted 6 lines
Whenever I've tried to push changes to our defaults through to our default
/etc/sysctl.conf, it's been met with resistance due to beliefs that a) the file is there for _users_ to override decisions the distro made at build time and b) if this is the right default, why isn't the kernel setting it?
This seems to be the consensus within the Ubuntu community as well. I don't have any strong opinion either way but I will admit that setting it in userspace does make the packaging issue messy.
- Ben
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 3 lines · Wu Fengguang
It's interesting to know what value you plan to use for your desktop/server systems and the rationals (is it based on any testing results?).
This is something that will likely require a great deal of research, thinking, and testing. I wish I could give you a better answer at the moment. I have read many opinions on this but have not seen enough evidence to suggest specific values. In the desktop case, it seems clear that the preferred value should be lower than the current default to preserve interactive performance (long latencies due to swapping is something that many desktop users complain about currently). I set swappiness to 10 on my own machines machines with good results, but mine is anything but a model case. I don't believe there is any direct need to touch the server kernel swappiness at the moment.
Quoted 2 lines
And why it's easier to do it in kernel (hope it's not because of trouble communicating with the user space packaging team).
Fear not, this is certainly not the case. We would simply like to be able to keep this our kernel configuration self-contained. We already have separate packages for various kernel flavors with their own configurations. Allowing us to tune swappiness from the configuration would keep things much cleaner.
The other option would be to drop a file in /etc/sysctl.d from the kernel meta-package (e.g. linux-image-generic and linux-image-server). However, it would make little sense to do this without adding a dependency on procps to this package (although, admittedly, procps is in the default installation) which we would rather not do if possible. Furthermore, this spreads the kernel configuration across the system. In sum, it seems that configuring the default in the kernel itself is by far the most elegant way to proceed.
Cheers,
- Ben
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · Ben Gamari
Quoted 2 lines
And they can't use an init script to tune
/proc/sys/vm/swappinessbecause...?Packaging concerns, as I mentioned before,
That you snipped from the changelog?
Quoted 11 lines · Ben Gamari
Quoted 6 lines
Ubuntu ships different kernels for desktop and server usage. From a packaging standpoint it would be much nicer to have this set in the kernel configuration. If we were to throw the setting
/etc/sysctl.confthe kernel would depend upon the package containing sysctl(8) (procps). We'd rather avoid this and keep the default kernel configuration in one place.In short, being able to specify this default in .config is just far simpler from a packaging standpoint than the alternatives.
You could say the same thing for any sysctl, it's not indicative of why this particular change is needed in the kernel.
Let's not have the "in short" answer, what's the "long" answer?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · David Rientjes
Quoted 1 line · Ben Gamari
Packaging concerns, as I mentioned before,
That you snipped from the changelog?
Guilty as charged. Sorry about that, time has been in short supply recently.
Quoted 3 lines
You could say the same thing for any sysctl, it's not indicative of why this particular change is needed in the kernel.
This is certainly true; a distribution could in principle want to tweak the default values of any of the sysctl knobs. If we wanted to tweak anything else in addition to swappiness that I wouldn't have even bothered to submit the patch since I'll be the first to admit that the precedent set by further growing the Kconfig phase space is not a positive one. That being said, swappiness is one of the more significant knobs in the vm and certainly one of the more likely to be tuned by a distribution.
Quoted 1 line
Let's not have the "in short" answer, what's the "long" answer?
See my recent response to Wu Fengguang.
Cheers,
- Ben
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 6 lines · Ben Gamari
This will allow distributions to tune this important vm parameter in a more self-contained manner.
Signed-off-by Ben Gamari <[email protected]>Acked-by Johannes Weiner <[email protected]>Acked-by Wu Fengguang <[email protected]>
Doesn't mean much, but this gets my ACK now :-)
Signature · 10 lines
Jesper Juhl <[email protected]> http://www.chaosbits.net/ Plain text mails only, please http://www.expita.com/nomime.html Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 62 lines · Ben Gamari
This will allow distributions to tune this important vm parameter in a more self-contained manner.
Signed-off-by Ben Gamari <[email protected]>Acked-by Johannes Weiner <[email protected]>Acked-by Wu Fengguang <[email protected]>---
Documentation/sysctl/vm.txt | 2 +- mm/Kconfig | 14 ++++++++++++++mm/vmscan.c| 2 +-3 files changed, 16 insertions(+), 2 deletions(-)Documentation/sysctl/vm.txt +0
-0@@ -643,7 +643,7 @@ This control is used to define how aggressive the kernel will swapmemory pages. Higher values will increase agressiveness, lower values decrease the amount of swap.
Documentation/sysctl/vm.txt +1
-1-The default value is 60. +The default value is 60 (changed with CONFIG_DEFAULT_SWAPINESS).==============================================================
mm/Kconfig +0
-0@@ -61,6 +61,20 @@ config SPARSEMEM_MANUALendchoice
mm/Kconfig +14
-0+config DEFAULT_SWAPPINESS + int "Default swappiness" + default "60" + range 0 100 + help + This control is used to define how aggressive the kernel will swap + memory pages. Higher values will increase agressiveness, lower + values decrease the amount of swap. Valid values range from 0 to 100. + + This only sets the default value at boot. Swappiness can be set at + runtime through /proc/sys/vm/swappiness. + + If unsure, keep default value of 60. +config DISCONTIGMEM
def_bool y
depends on (!SELECT_MEMORY_MODEL &&ARCH_DISCONTIGMEM_ENABLE) ||DISCONTIGMEM_MANUALmm/vmscan.c +1
-1@@ -133,7 +133,7 @@ struct scan_control { /** From 0 .. 100. Higher means more swappy. */ -int vm_swappiness =60 ; +int vm_swappiness =CONFIG_DEFAULT_SWAPPINESS ;long
vm_total_pages; /* The total number of pages which the VM controls */
Quoted 1 line
static
LIST_HEAD(shrinker_list);
Apparently, it wouldn't hurt maintain the kernel. But I have a concern. As someone think this parameter is very important and would be better to control by kernel config rather than init script to make the package, it would make new potential kernel configs by someone in future.
But I can't convince my opinion myself. Because if there will be lots of kernel config for tuning parameters, could it hurt maintain/usability? I can't say "Yes" strongly. so I am not against this idea strongly.
Hmm,, Just pass the decision to others.
Signature · 9 lines
Kind regards, Minchan Kim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
2010/11/2 Minchan Kim <[email protected]>:
Quoted 11 lines
Apparently, it wouldn't hurt maintain the kernel. But I have a concern. As someone think this parameter is very important and would be better to control by kernel config rather than init script to make the package, it would make new potential kernel configs by someone in future.
But I can't convince my opinion myself. Because if there will be lots of kernel config for tuning parameters, could it hurt maintain/usability? I can't say "Yes" strongly. so I am not against this idea strongly.
Hmm,, Just pass the decision to others.
please modify sysctl setting....
No ack from me.
Thanks,
-Kame
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>