2003-03-05 04:27:59

by Randy.Dunlap

[permalink] [raw]
Subject: [PATCH] move SWAP option in menu

diff -urN a/arch/i386/Kconfig b/arch/i386/Kconfig
--- a/arch/i386/Kconfig 2003-03-03 20:04:08.000000000 +0100
+++ b/arch/i386/Kconfig 2003-03-03 19:58:48.000000000 +0100
@@ -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
--- a/init/Kconfig 2003-02-11 01:09:48.000000000 +0100
+++ b/init/Kconfig 2003-03-03 20:02:11.000000000 +0100
@@ -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---


Attachments:
swap_option.patch (1.13 kB)

2003-03-05 18:14:54

by Gabriel Paubert

[permalink] [raw]
Subject: Re: [PATCH] move SWAP option in menu

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.
>
> Thanks,
> ~Randy
> diff -urN a/arch/i386/Kconfig b/arch/i386/Kconfig
> --- a/arch/i386/Kconfig 2003-03-03 20:04:08.000000000 +0100
> +++ b/arch/i386/Kconfig 2003-03-03 19:58:48.000000000 +0100
> @@ -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
> --- a/init/Kconfig 2003-02-11 01:09:48.000000000 +0100
> +++ b/init/Kconfig 2003-03-03 20:02:11.000000000 +0100
> @@ -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.

>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

2003-03-05 21:05:47

by Randy.Dunlap

[permalink] [raw]
Subject: Re: [PATCH] move SWAP option in menu

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

2003-03-06 18:33:14

by Tom Rini

[permalink] [raw]
Subject: Re: [PATCH] move SWAP option in menu

On Wed, Mar 05, 2003 at 01:14:44PM -0800, Randy.Dunlap wrote:
> 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.

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 =====
--- 1.10/arch/alpha/Kconfig Tue Feb 18 16:57:50 2003
+++ edited/arch/alpha/Kconfig Thu Mar 6 11:36:47 2003
@@ -15,10 +15,6 @@
bool
default y

-config SWAP
- bool
- default y
-
config UID16
bool

===== arch/arm/Kconfig 1.9 vs edited =====
--- 1.9/arch/arm/Kconfig Sat Feb 15 02:34:08 2003
+++ edited/arch/arm/Kconfig Thu Mar 6 11:36:56 2003
@@ -20,10 +20,6 @@
bool
default y

-config SWAP
- bool
- default y
-
config EISA
bool
---help---
===== arch/cris/Kconfig 1.5 vs edited =====
--- 1.5/arch/cris/Kconfig Sun Feb 9 18:29:49 2003
+++ edited/arch/cris/Kconfig Thu Mar 6 11:37:00 2003
@@ -9,10 +9,6 @@
bool
default y

-config SWAP
- bool
- default y
-
config UID16
bool
default y
===== arch/i386/Kconfig 1.46 vs edited =====
--- 1.46/arch/i386/Kconfig Sun Mar 2 19:14:31 2003
+++ edited/arch/i386/Kconfig Thu Mar 6 11:36:15 2003
@@ -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 =====
--- 1.14/arch/ia64/Kconfig Sun Feb 9 18:29:49 2003
+++ edited/arch/ia64/Kconfig Thu Mar 6 11:37:08 2003
@@ -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 =====
--- 1.9/arch/m68k/Kconfig Sun Feb 9 18:29:49 2003
+++ edited/arch/m68k/Kconfig Thu Mar 6 11:37:11 2003
@@ -10,10 +10,6 @@
bool
default y

-config SWAP
- bool
- default y
-
config UID16
bool
default y
===== arch/m68knommu/Kconfig 1.6 vs edited =====
--- 1.6/arch/m68knommu/Kconfig Tue Feb 18 03:27:38 2003
+++ edited/arch/m68knommu/Kconfig Thu Mar 6 11:37:25 2003
@@ -9,10 +9,6 @@
bool
default n

-config SWAP
- bool
- default n
-
config FPU
bool
default n
===== arch/mips/Kconfig 1.8 vs edited =====
--- 1.8/arch/mips/Kconfig Sun Feb 9 18:29:49 2003
+++ edited/arch/mips/Kconfig Thu Mar 6 11:37:29 2003
@@ -10,10 +10,6 @@
bool
default y

-config SWAP
- bool
- default y
-
config SMP
bool
---help---
===== arch/mips64/Kconfig 1.9 vs edited =====
--- 1.9/arch/mips64/Kconfig Sun Feb 9 18:29:49 2003
+++ edited/arch/mips64/Kconfig Thu Mar 6 11:37:33 2003
@@ -9,10 +9,6 @@
bool
default y

-config SWAP
- bool
- default y
-
source "init/Kconfig"


===== arch/parisc/Kconfig 1.10 vs edited =====
--- 1.10/arch/parisc/Kconfig Sun Feb 9 18:29:49 2003
+++ edited/arch/parisc/Kconfig Thu Mar 6 11:37:35 2003
@@ -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 =====
--- 1.17/arch/ppc/Kconfig Sun Feb 9 18:29:49 2003
+++ edited/arch/ppc/Kconfig Thu Mar 6 11:37:47 2003
@@ -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 =====
--- 1.13/arch/ppc64/Kconfig Thu Feb 13 01:47:26 2003
+++ edited/arch/ppc64/Kconfig Thu Mar 6 11:37:50 2003
@@ -7,10 +7,6 @@
bool
default y

-config SWAP
- bool
- default y
-
config UID16
bool

===== arch/s390/Kconfig 1.7 vs edited =====
--- 1.7/arch/s390/Kconfig Mon Feb 24 11:24:34 2003
+++ edited/arch/s390/Kconfig Thu Mar 6 11:37:54 2003
@@ -7,10 +7,6 @@
bool
default y

-config SWAP
- bool
- default y
-
config UID16
bool
default y
===== arch/s390x/Kconfig 1.8 vs edited =====
--- 1.8/arch/s390x/Kconfig Mon Feb 24 11:24:34 2003
+++ edited/arch/s390x/Kconfig Thu Mar 6 11:37:59 2003
@@ -7,10 +7,6 @@
bool
default y

-config SWAP
- bool
- default y
-
config RWSEM_GENERIC_SPINLOCK
bool

===== arch/sh/Kconfig 1.7 vs edited =====
--- 1.7/arch/sh/Kconfig Sun Feb 9 18:29:49 2003
+++ edited/arch/sh/Kconfig Thu Mar 6 11:38:02 2003
@@ -18,10 +18,6 @@
bool
default y

-config SWAP
- bool
- default y
-
config UID16
bool
default y
===== arch/sparc/Kconfig 1.10 vs edited =====
--- 1.10/arch/sparc/Kconfig Mon Mar 3 01:33:45 2003
+++ edited/arch/sparc/Kconfig Thu Mar 6 11:38:04 2003
@@ -9,10 +9,6 @@
bool
default y

-config SWAP
- bool
- default y
-
config UID16
bool
default y
===== arch/sparc64/Kconfig 1.15 vs edited =====
--- 1.15/arch/sparc64/Kconfig Wed Mar 5 09:22:15 2003
+++ edited/arch/sparc64/Kconfig Thu Mar 6 11:38:06 2003
@@ -9,10 +9,6 @@
bool
default y

-config SWAP
- bool
- default y
-
source "init/Kconfig"


===== arch/um/Kconfig 1.8 vs edited =====
--- 1.8/arch/um/Kconfig Wed Feb 5 21:16:01 2003
+++ edited/arch/um/Kconfig Thu Mar 6 11:38:09 2003
@@ -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 =====
--- 1.7/arch/v850/Kconfig Tue Feb 18 19:40:02 2003
+++ edited/arch/v850/Kconfig Thu Mar 6 11:38:13 2003
@@ -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 =====
--- 1.15/arch/x86_64/Kconfig Wed Feb 12 06:38:20 2003
+++ edited/arch/x86_64/Kconfig Thu Mar 6 11:38:19 2003
@@ -24,10 +24,6 @@
bool
default y

-config SWAP
- bool
- default y
-
config ISA
bool

===== init/Kconfig 1.10 vs edited =====
--- 1.10/init/Kconfig Mon Feb 3 13:19:37 2003
+++ edited/init/Kconfig Thu Mar 6 11:41:51 2003
@@ -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---

--
Tom Rini
http://gate.crashing.org/~trini/

2003-03-06 18:38:55

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] move SWAP option in menu

On Thu, Mar 06, 2003 at 11:43:32AM -0700, Tom Rini wrote:
> 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.

2003-03-06 18:44:34

by Tom Rini

[permalink] [raw]
Subject: Re: [PATCH] move SWAP option in menu

On Thu, Mar 06, 2003 at 06:49:22PM +0000, Christoph Hellwig wrote:
> On Thu, Mar 06, 2003 at 11:43:32AM -0700, Tom Rini wrote:
> > 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 =====
--- 1.10/init/Kconfig Mon Feb 3 13:19:37 2003
+++ edited/init/Kconfig Thu Mar 6 11:54:30 2003
@@ -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---

--
Tom Rini
http://gate.crashing.org/~trini/

2003-03-06 18:46:17

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] move SWAP option in menu

On Thu, Mar 06, 2003 at 11:54:58AM -0700, Tom Rini wrote:
> On Thu, Mar 06, 2003 at 06:49:22PM +0000, Christoph Hellwig wrote:
> > On Thu, Mar 06, 2003 at 11:43:32AM -0700, Tom Rini wrote:
> > > 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 :)

2003-03-06 19:24:10

by Gabriel Paubert

[permalink] [raw]
Subject: Re: [PATCH] move SWAP option in menu

On Thu, Mar 06, 2003 at 11:43:32AM -0700, Tom Rini wrote:
>
> 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 1.10 vs edited =====
> --- 1.10/init/Kconfig Mon Feb 3 13:19:37 2003
> +++ edited/init/Kconfig Thu Mar 6 11:41:51 2003
> @@ -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.

2003-03-06 19:51:12

by Alan

[permalink] [raw]
Subject: Re: [PATCH] move SWAP option in menu

On Thu, 2003-03-06 at 19:33, Gabriel Paubert wrote:
> 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

2003-03-07 09:58:47

by Gabriel Paubert

[permalink] [raw]
Subject: Re: [PATCH] move SWAP option in menu

On Thu, Mar 06, 2003 at 09:06:49PM +0000, Alan Cox wrote:
> On Thu, 2003-03-06 at 19:33, Gabriel Paubert wrote:
> > 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.

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

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

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

2003-03-07 11:25:11

by Alan

[permalink] [raw]
Subject: Re: [PATCH] move SWAP option in menu

On Fri, 2003-03-07 at 10:03, Gabriel Paubert wrote:
> > 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.