Skip to contentSkip to conversation

move SWAP option in menu

PATCH In review Randy.Dunlap 6 participants 11 messages Mar 5, 2003 – Mar 7, 2003

Subsystems (9)
Arm (32-bit) MIPS s390 SuperH +5 more subsystems
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 move SWAP option in menu

Hi,

Please apply this patch (option B of 2 choices) from Tomas Szepe to move the SWAP option into the General Setup menu.

Patch is to 2.5.64.

Thanks,
~Randy

arch/i386/Kconfig +0 -9
diff -urN a/arch/i386/Kconfig b/arch/i386/Kconfig
@@ -18,15 +18,6 @@
 	bool
 	default y
 
-config SWAP
-	bool "Support for paging of anonymous memory"
-	default y
-	help
-	  This option allows you to choose whether you want to have support
-	  for socalled swap devices or swap files in your kernel that are
-	  used to provide more virtual memory than the actual RAM present
-	  in your computer.  If unusre say Y.
-
 config SBUS
 	bool
 
init/Kconfig +10 -1
diff -urN a/init/Kconfig b/init/Kconfig
@@ -34,9 +34,18 @@
 
 endmenu
 
-
 menu "General setup"
 
+config SWAP
+	depends on X86
+	bool "Support for paging of anonymous memory"
+	default y
+	help
+	  This option allows you to choose whether you want to have support
+	  for the so-called swap devices or swap files.  There are used to
+	  provide more virtual memory than the actual RAM presents in your
+	  computer.  If unsure, say Y.
+
 config SYSVIPC
 	bool "System V IPC"
 	---help---
#1 lore raw
Quoted 33 lines · Randy.Dunlap

Hi,

Please apply this patch (option B of 2 choices) from Tomas Szepe to move the SWAP option into the General Setup menu.

Patch is to 2.5.64.

Thanks,
~Randy
diff -urN a/arch/i386/Kconfig b/arch/i386/Kconfig

arch/i386/Kconfig +0 -9
@@ -18,15 +18,6 @@
 	bool
 	default y
 
-config SWAP
-	bool "Support for paging of anonymous memory"
-	default y
-	help
-	  This option allows you to choose whether you want to have support
-	  for socalled swap devices or swap files in your kernel that are
-	  used to provide more virtual memory than the actual RAM present
-	  in your computer.  If unusre say Y.
-
 config SBUS
 	bool
 

diff -urN a/init/Kconfig b/init/Kconfig

init/Kconfig line 40

Quoted 8 lines
init/Kconfig +2 -1
@@ -34,9 +34,18 @@
 
 endmenu
 
-
 menu "General setup"
 
+config SWAP
+	depends on X86

Why restrict it to Intel only? I don't know if it works properly on other architectures, but at least it would give people the opportunity to test it on embedded PPC/Arm/MIPS/CRIS/whatever.

Quoted 1 line

From a quick grep over a recent BK tree, the only files who have

sections conditional on CONFIG_SWAP are:

include/linux/page-flags.h
include/linux/swap.h
mm/vmscan.c
mm/Makefile

no architecture specific code at all. From a quick look, the conditionals are rather simple (most of them are replacements of actual functions by dummies) and should work on all architectures. Please let people test it on non-X86, after all it's still a development kernel. Any breakage is unlikely to be serious and embedded people are going to be the most interested since it saves some space.

Gabriel

#2 lore raw

On Wed, 5 Mar 2003 19:17:48 +0100 Gabriel Paubert <[email protected]> wrote:

| On Tue, Mar 04, 2003 at 08:36:13PM -0800, Randy.Dunlap wrote:
| > Hi,
| > 
| > Please apply this patch (option B of 2 choices) from
| > Tomas Szepe to move the SWAP option into the General Setup
| > menu.
| > 
| > Patch is to 2.5.64.
| > 
[snip]
| 
| Why restrict it to Intel only? I don't know if it works properly on
| other architectures, but at least it would give people the opportunity 
| to test it on embedded PPC/Arm/MIPS/CRIS/whatever.
| 
| >From a quick grep over a recent BK tree, the only files who have 
| sections conditional on CONFIG_SWAP are:
| 
| include/linux/page-flags.h
| include/linux/swap.h
| mm/vmscan.c
| mm/Makefile
| 
| no architecture specific code at all. From a quick look, the
| conditionals are rather simple (most of them are replacements of
| actual functions by dummies) and should work on all architectures.
| Please let people test it on non-X86, after all it's still a 
| development kernel. Any breakage is unlikely to be serious and 
| embedded people are going to be the most interested since it 
| saves some space.

OK, please send a patch.

--
~Randy

#3 lore raw
Quoted 33 lines · Randy.Dunlap

On Wed, 5 Mar 2003 19:17:48 +0100 Gabriel Paubert <[email protected]> wrote:

| On Tue, Mar 04, 2003 at 08:36:13PM -0800, Randy.Dunlap wrote:
| > Hi,
| > 
| > Please apply this patch (option B of 2 choices) from
| > Tomas Szepe to move the SWAP option into the General Setup
| > menu.
| > 
| > Patch is to 2.5.64.
| > 
[snip]
| 
| Why restrict it to Intel only? I don't know if it works properly on
| other architectures, but at least it would give people the opportunity 
| to test it on embedded PPC/Arm/MIPS/CRIS/whatever.
| 
| >From a quick grep over a recent BK tree, the only files who have 
| sections conditional on CONFIG_SWAP are:
| 
| include/linux/page-flags.h
| include/linux/swap.h
| mm/vmscan.c
| mm/Makefile
| 
| no architecture specific code at all. From a quick look, the
| conditionals are rather simple (most of them are replacements of
| actual functions by dummies) and should work on all architectures.
| Please let people test it on non-X86, after all it's still a 
| development kernel. Any breakage is unlikely to be serious and 
| embedded people are going to be the most interested since it 
| saves some space.
Quoted 1 line

OK, please send a patch.

How's this look? I picked MMU=x implies SWAP=x for defaults, just because that's how they were before...

===== arch/alpha/Kconfig 1.10 vs edited =====

arch/alpha/Kconfig +0 -4
@@ -15,10 +15,6 @@
 	bool
 	default y
 
-config SWAP
-	bool
-	default y
-
 config UID16
 	bool
 

===== arch/arm/Kconfig 1.9 vs edited =====

arch/arm/Kconfig +0 -4
@@ -20,10 +20,6 @@
 	bool
 	default y
 
-config SWAP
-	bool
-	default y
-
 config EISA
 	bool
 	---help---

===== arch/cris/Kconfig 1.5 vs edited =====

arch/cris/Kconfig +0 -4
@@ -9,10 +9,6 @@
 	bool
 	default y
 
-config SWAP
-	bool
-	default y
-
 config UID16
 	bool
 	default y

===== arch/i386/Kconfig 1.46 vs edited =====

arch/i386/Kconfig +0 -9
@@ -18,15 +18,6 @@
 	bool
 	default y
 
-config SWAP
-	bool "Support for paging of anonymous memory"
-	default y
-	help
-	  This option allows you to choose whether you want to have support
-	  for socalled swap devices or swap files in your kernel that are
-	  used to provide more virtual memory than the actual RAM present
-	  in your computer.  If unusre say Y.
-
 config SBUS
 	bool
 

===== arch/ia64/Kconfig 1.14 vs edited =====

arch/ia64/Kconfig +0 -4
@@ -22,10 +22,6 @@
 	bool
 	default y
 
-config SWAP
-	bool
-	default y
-
 config RWSEM_GENERIC_SPINLOCK
 	bool
 	default y

===== arch/m68k/Kconfig 1.9 vs edited =====

arch/m68k/Kconfig +0 -4
@@ -10,10 +10,6 @@
 	bool
 	default y
 
-config SWAP
-	bool
-	default y
-
 config UID16
 	bool
 	default y

===== arch/m68knommu/Kconfig 1.6 vs edited =====

arch/m68knommu/Kconfig +0 -4
@@ -9,10 +9,6 @@
 	bool
 	default n
 
-config SWAP
-	bool
-	default n
-
 config FPU
 	bool
 	default n

===== arch/mips/Kconfig 1.8 vs edited =====

arch/mips/Kconfig +0 -4
@@ -10,10 +10,6 @@
 	bool
 	default y
 
-config SWAP
-	bool
-	default y
-
 config SMP
 	bool
 	---help---

===== arch/mips64/Kconfig 1.9 vs edited =====

arch/mips64/Kconfig +0 -4
@@ -9,10 +9,6 @@
 	bool
 	default y
 
-config SWAP
-	bool
-	default y
-
 source "init/Kconfig"
 
 

===== arch/parisc/Kconfig 1.10 vs edited =====

arch/parisc/Kconfig +0 -4
@@ -18,10 +18,6 @@
 	bool
 	default y
 
-config SWAP
-	bool
-	default y
-
 config STACK_GROWSUP
 	bool
 	default y

===== arch/ppc/Kconfig 1.17 vs edited =====

arch/ppc/Kconfig +0 -16
@@ -1126,22 +1126,6 @@
 config PIN_TLB
 	bool "Pinned Kernel TLBs (860 ONLY)"
 	depends on ADVANCED_OPTIONS && 8xx
-
-config SWAP
-	bool "Enable support for swap"
-	depends on ADVANCED_OPTIONS
-	help
-	  This option allows you to turn off support for swapfiles in
-	  the kernel.  This can be useful if you know that your system
-	  will never have swap.
-
-	  Say Y here unless you know what you are doing.
-
-config SWAP
-	bool
-	depends on !ADVANCED_OPTIONS
-	default y
-
 endmenu
 
 source "drivers/mtd/Kconfig"

===== arch/ppc64/Kconfig 1.13 vs edited =====

arch/ppc64/Kconfig +0 -4
@@ -7,10 +7,6 @@
 	bool
 	default y
 
-config SWAP
-	bool
-	default y
-
 config UID16
 	bool
 

===== arch/s390/Kconfig 1.7 vs edited =====

arch/s390/Kconfig +0 -4
@@ -7,10 +7,6 @@
 	bool
 	default y
 
-config SWAP
-	bool
-	default y
-
 config UID16
 	bool
 	default y

===== arch/s390x/Kconfig 1.8 vs edited =====

arch/s390x/Kconfig +0 -4
@@ -7,10 +7,6 @@
 	bool
 	default y
 
-config SWAP
-	bool
-	default y
-
 config RWSEM_GENERIC_SPINLOCK
 	bool
 

===== arch/sh/Kconfig 1.7 vs edited =====

arch/sh/Kconfig +0 -4
@@ -18,10 +18,6 @@
 	bool
 	default y
 
-config SWAP
-	bool
-	default y
-
 config UID16
 	bool
 	default y

===== arch/sparc/Kconfig 1.10 vs edited =====

arch/sparc/Kconfig +0 -4
@@ -9,10 +9,6 @@
 	bool
 	default y
 
-config SWAP
-	bool
-	default y
-
 config UID16
 	bool
 	default y

===== arch/sparc64/Kconfig 1.15 vs edited =====

arch/sparc64/Kconfig +0 -4
@@ -9,10 +9,6 @@
 	bool
 	default y
 
-config SWAP
-	bool
-	default y
-
 source "init/Kconfig"
 
 

===== arch/um/Kconfig 1.8 vs edited =====

arch/um/Kconfig +0 -4
@@ -7,10 +7,6 @@
 	bool
 	default y
 
-config SWAP
-	bool
-	default y
-
 mainmenu "Linux/Usermode Kernel Configuration"
 
 config ISA

===== arch/v850/Kconfig 1.7 vs edited =====

arch/v850/Kconfig +0 -3
@@ -10,9 +10,6 @@
 config MMU
        	bool
 	default n
-config SWAP
-	bool
-	default n
 config UID16
 	bool
 	default n

===== arch/x86_64/Kconfig 1.15 vs edited =====

arch/x86_64/Kconfig +0 -4
@@ -24,10 +24,6 @@
 	bool
 	default y
 
-config SWAP
-	bool
-	default y
-
 config ISA
 	bool
 

===== init/Kconfig 1.10 vs edited =====

init/Kconfig +10 -0
@@ -37,6 +37,16 @@
 
 menu "General setup"
 
+config SWAP
+	bool "Support for paging of anonymous memory"
+	default y if MMU
+	default n if !MMU
+	help
+	  This option allows you to choose whether you want to have support
+	  for socalled swap devices or swap files in your kernel that are
+	  used to provide more virtual memory than the actual RAM present
+	  in your computer.  If unusre say Y.
+
 config SYSVIPC
 	bool "System V IPC"
 	---help---
Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#4 lore raw
Quoted 2 lines · Tom Rini

How's this look? I picked MMU=x implies SWAP=x for defaults, just because that's how they were before...

CONFIG_SWAP must be n if CONFIG_MMU isn't set either, so it shouldn't be an option for those targets.

#5 lore raw
Quoted 6 lines · Christoph Hellwig
Quoted 2 lines · Tom Rini

How's this look? I picked MMU=x implies SWAP=x for defaults, just because that's how they were before...

CONFIG_SWAP must be n if CONFIG_MMU isn't set either, so it shouldn't be an option for those targets.

Erm, yes, that makes sense. How about this (for brevity, just init/Kconfig):

===== init/Kconfig 1.10 vs edited =====

init/Kconfig +10 -0
@@ -37,6 +37,16 @@
 
 menu "General setup"
 
+config SWAP
+	bool "Support for paging of anonymous memory"
+	depends on MMU
+	default y
+	help
+	  This option allows you to choose whether you want to have support
+	  for socalled swap devices or swap files in your kernel that are
+	  used to provide more virtual memory than the actual RAM present
+	  in your computer.  If unusre say Y.
+
 config SYSVIPC
 	bool "System V IPC"
 	---help---
Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#6 lore raw
Quoted 10 lines · Tom Rini
Quoted 6 lines · Christoph Hellwig
Quoted 2 lines · Tom Rini

How's this look? I picked MMU=x implies SWAP=x for defaults, just because that's how they were before...

CONFIG_SWAP must be n if CONFIG_MMU isn't set either, so it shouldn't be an option for those targets.

Erm, yes, that makes sense. How about this (for brevity, just init/Kconfig):

Looks good, the help text is also much nicer than my version :)

#7 lore raw
In reply to Tom Rini
Quoted 3 lines · Tom Rini

How's this look? I picked MMU=x implies SWAP=x for defaults, just because that's how they were before...

I'd be very surprised if it were possible to have swap on a MMU-less machine (no virtual memory, page faults, etc.). Except for this nitpick, the patch looks fine, but my knowledge of MM is close to zero (and also of the new config language, but I'll have to learn it soon).

init/Kconfig line 43

Quoted 11 lines

===== init/Kconfig 1.10 vs edited =====

init/Kconfig +4 -0
@@ -37,6 +37,16 @@
 
 menu "General setup"
 
+config SWAP
+	bool "Support for paging of anonymous memory"
+	default y if MMU
+	default n if !MMU

Should rather be (from just reading kconfig-language.txt):

config SWAP
depends on MMU
bool "Support for paging of anonymous memory" default y

Comments?

Gabriel.

#8 lore raw
Quoted 4 lines · Gabriel Paubert

I'd be very surprised if it were possible to have swap on a MMU-less machine (no virtual memory, page faults, etc.). Except for this nitpick, the patch looks fine, but my knowledge of MM is close to zero (and also of the new config language, but I'll have to learn it soon).

You can, and people have had swapping long before virtual memory. Most ucLinux platforms can't swap because they can't dynamically relocate code. Linux 8086 can swap because it can use CS/DS updates to relocate code/data.

The way it worked on older systems is that you never run a program which isnt entirely in memory. With that constraint you know it won't suddenely want data you don't have

#9 lore raw
Quoted 7 lines · Alan Cox
Quoted 4 lines · Gabriel Paubert

I'd be very surprised if it were possible to have swap on a MMU-less machine (no virtual memory, page faults, etc.). Except for this nitpick, the patch looks fine, but my knowledge of MM is close to zero (and also of the new config language, but I'll have to learn it soon).

You can, and people have had swapping long before virtual memory.

Indeed, I was unclear. A long time ago some OS I used distinguished between swapping (getting rid of a whole process' address space) and paging. The former one you can implement on any machine (with restrictions), the second one needs an MMU and that's what CONFIG_SWAP means AFAICT.

Quoted 1 line

Most ucLinux platforms can't swap because they can't dynamically relocate code.

I believe that dynamically relocating code is fairly easy (PIC may help too), but data is not: how do you relocate pointers of a swapped out process when you swap it in at a different address?

I have fuzzy memories of a system in which you had a pair of privileged registers (base and limit) which allowed you to implement swapping and moving programs around in physical memories: all addresses were checked against the limit and the base was added to perform physical accesses. I might be wrong: it was about 20 years ago and I've used so many different systems since then. But there is no such mechanism on a 68000 for example (you could add it externally) and it has its own problems (no easy way of sharing library code).

(Yes we're drifting way off-topic.)

Quoted 1 line

Linux 8086 can swap because it can use CS/DS updates to relocate code/data.

Unless I miss a subtle trick, that's using the segment registers as a poor man's MMU. You can share library code with far calls but you can't use "far" data pointers, can you?

Quoted 3 lines

The way it worked on older systems is that you never run a program which isnt entirely in memory. With that constraint you know it won't suddenely want data you don't have.

Oh yes, I've used such systems a loooong time ago. But I can't remember the details well enough.

Gabriel.

#10 lore raw
Quoted 5 lines · Gabriel Paubert
Quoted 1 line

Linux 8086 can swap because it can use CS/DS updates to relocate code/data.

Unless I miss a subtle trick, that's using the segment registers as a poor man's MMU. You can share library code with far calls but you can't use "far" data pointers, can you?

Linux 8086 doesnt support "far" anything. The segment registers are being used as base registers, and on 8086 "limit" isnt available.