Skip to contentSkip to conversation

Add Kconfig option for default swappiness

RFC PATCH In review Ben Gamari 4 participants 7 messages Oct 31, 2010 – Nov 2, 2010

Subsystems (5)
lore
Share & tools
lore

Ben Gamari

author
#0 lore raw

RFC 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                  |   11 +++++++++++
 mm/vmscan.c                 |    2 +-
 3 files changed, 13 insertions(+), 2 deletions(-)
Documentation/sysctl/vm.txt +1 -1
index 6c7d18c..792823b 100644
@@ -614,7 +614,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 +11 -0
index 9c61158..729ecec 100644
@@ -61,6 +61,17 @@ 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.
+
+	  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
index 3ff3311..342975f 100644
@@ -126,7 +126,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>
maintainer
#1 lore raw
Quoted 2 lines · Ben Gamari

This will allow distributions to tune this important vm parameter in a more self-contained manner.

What's wrong with sticking

vm.swappiness = <your value>

into the shipped /etc/sysctl.conf?

--
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>

author
#2 lore raw
Quoted 9 lines · Johannes Weiner
Quoted 2 lines · Ben Gamari

This will allow distributions to tune this important vm parameter in a more self-contained manner.

What's wrong with sticking

vm.swappiness = <your value>

into the shipped /etc/sysctl.conf?

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.conf the kernel would depend upon the package containing sysctl(8) (procps). We'd rather avoid this and keep the default kernel configuration in one place. This was just an RFC though; let me know if you think this is totally insane.

- 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>

maintainer Acked-by
#3 lore raw
Quoted 9 lines · Ben Gamari
Quoted 8 lines · Johannes Weiner
Quoted 2 lines · Ben Gamari

This will allow distributions to tune this important vm parameter in a more self-contained manner.

What's wrong with sticking

vm.swappiness = <your value>

Quoted 8 lines
Quoted 1 line

into the shipped /etc/sysctl.conf?

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.conf the kernel would depend upon the package containing sysctl(8) (procps). We'd rather avoid this and keep the default kernel configuration in one place.

Fair point. Feel free to add my

--
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>

#4 lore raw
In reply to Ben Gamari
Quoted 32 lines · Ben Gamari

This will allow distributions to tune this important vm parameter in a more self-contained manner.

---
 Documentation/sysctl/vm.txt |    2 +-
 mm/Kconfig                  |   11 +++++++++++
 mm/vmscan.c                 |    2 +-
 3 files changed, 13 insertions(+), 2 deletions(-)
Documentation/sysctl/vm.txt +1 -1
index 6c7d18c..792823b 100644
@@ -614,7 +614,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 +1 -0
index 9c61158..729ecec 100644
@@ -61,6 +61,17 @@ config SPARSEMEM_MANUAL
 
 endchoice
 
+config DEFAULT_SWAPPINESS

mm/Kconfig config SPARSEMEM_MANUAL · line 74

Quoted 10 lines
mm/Kconfig +10 -0
+	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.
+
+	  If unsure, keep default value of 60.
+

Perhaps this help text should mention the fact that swapiness setting can be changed at runtime (regardless of the set default) by writing to /proc/sys/vm/swappiness ???

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>
author
#5 lore raw
Quoted 4 lines · Jesper Juhl

Perhaps this help text should mention the fact that swapiness setting can be changed at runtime (regardless of the set default) by writing to /proc/sys/vm/swappiness ???

This definitely wouldn't hurt. I'll respin with updated help text.

- 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>

Acked-by
#6 lore raw
Quoted 6 lines · Ben Gamari
Quoted 4 lines · Jesper Juhl

Perhaps this help text should mention the fact that swapiness setting can be changed at runtime (regardless of the set default) by writing to /proc/sys/vm/swappiness ???

This definitely wouldn't hurt. I'll respin with updated help text.

--
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>