linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] use tmpfs for rootfs
@ 2008-10-16 12:03 Bodo Eggert
  2008-10-16 13:10 ` Geert Uytterhoeven
  0 siblings, 1 reply; 12+ messages in thread
From: Bodo Eggert @ 2008-10-16 12:03 UTC (permalink / raw)
  To: linux-kernel

This patch allows chosing tmpfs instead of ramfs for the root filesystem. 
Having tmpfs is usefull for running systems from RAM, because it does not 
risk deadlocking the system and possibly allows swapping. Using tmpfs 
increases the kernel by 10 bytes on x86_64.

Having tmpfs as the root filesystem allows you to get rid of the now unused 
ramfs and free some kernel memory. On my system, that's about 5198 bytes 
compared to having a ramfs root.

Off cause you can mount tmpfs and move around the data, but this is slower
(having to copy around the data), more error-prone and it uses more memory.
Besides that, I don't see the point in explicitely doing the wrong thing
and then having everybody fix it.


Signed-off-by: Bodo Eggert <7eggert@gmx.de>

---
Some numbers for my system: (from make and from size vmlinux)

Setup is 10716 bytes (padded to 10752 bytes).
System is 2659 kB
text    data     bss     dec     hex filename
5341667  874212  562992 6778871  676ff7 vmlinux

having TMPFS_IS_ROOT:
Setup is 10716 bytes (padded to 10752 bytes).
System is 2659 kB
text    data     bss     dec     hex filename
5341677  874212  562992 6778881  677001 vmlinux
    +10

not having ramfs:
Setup is 10716 bytes (padded to 10752 bytes).
System is 2659 kB
text    data     bss     dec     hex filename
5336733  873948  562992 6773673  675ba9 vmlinux
  -4934    -264


 fs/Kconfig       |   21 +++++++++++++++++++++
 fs/ramfs/inode.c |   39 +++++++++++++++++++++------------------
 mm/shmem.c       |   26 ++++++++++++++++++++++++++
 3 files changed, 68 insertions(+), 18 deletions(-)


diff -pruNXdontdiff linux-2.6.27.2-numlock/fs/Kconfig linux-2.6.27.3-tmpfs/fs/Kconfig
--- linux-2.6.27.2-numlock/fs/Kconfig	2008-10-10 13:18:34.000000000 +0200
+++ linux-2.6.27.3-tmpfs/fs/Kconfig	2008-10-11 15:42:21.000000000 +0200
@@ -953,6 +953,27 @@ config TMPFS_POSIX_ACL
 
 	  If you don't know what Access Control Lists are, say N.
 
+config TMPFS_ROOT
+	bool "Use tmpfs instrad of ramfs for initramfs"
+	depends on TMPFS && SHMEM
+	default n
+	help
+	  This replaces the ramfs used for unpacking the cpio images
+	  with tmpfs.
+	  
+	  If unsure, say N
+
+config RAMFS
+ 	bool "Ramfs file system support" if TMPFS_ROOT
+  	default y
+  	---help---
+  	  Ramfs is a file system which keeps all files in RAM. Unlike tmpfs,
+  	  it cannot be swapped to disk, and it has the risk of deadlocking
+  	  the system by using all memory.
+
+  	  Ramfs is used for booting the system and unpacking the cpio if
+  	  TMPFS_ROOT is not set.
+
 config HUGETLBFS
 	bool "HugeTLB file system support"
 	depends on X86 || IA64 || PPC64 || SPARC64 || (SUPERH && MMU) || \
diff -pruNXdontdiff linux-2.6.27.2-numlock/fs/ramfs/inode.c linux-2.6.27.3-tmpfs/fs/ramfs/inode.c
--- linux-2.6.27.2-numlock/fs/ramfs/inode.c	2008-07-13 23:51:29.000000000 +0200
+++ linux-2.6.27.3-tmpfs/fs/ramfs/inode.c	2008-10-11 15:50:03.000000000 +0200
@@ -190,6 +190,13 @@ int ramfs_get_sb(struct file_system_type
 	return get_sb_nodev(fs_type, flags, data, ramfs_fill_super, mnt);
 }
 
+static struct file_system_type ramfs_fs_type = {
+	.name		= "ramfs",
+	.get_sb		= ramfs_get_sb,
+	.kill_sb	= kill_litter_super,
+};
+
+#ifndef CONFIG_TMPFS_ROOT
 static int rootfs_get_sb(struct file_system_type *fs_type,
 	int flags, const char *dev_name, void *data, struct vfsmount *mnt)
 {
@@ -197,30 +204,12 @@ static int rootfs_get_sb(struct file_sys
 			    mnt);
 }
 
-static struct file_system_type ramfs_fs_type = {
-	.name		= "ramfs",
-	.get_sb		= ramfs_get_sb,
-	.kill_sb	= kill_litter_super,
-};
 static struct file_system_type rootfs_fs_type = {
 	.name		= "rootfs",
 	.get_sb		= rootfs_get_sb,
 	.kill_sb	= kill_litter_super,
 };
 
-static int __init init_ramfs_fs(void)
-{
-	return register_filesystem(&ramfs_fs_type);
-}
-
-static void __exit exit_ramfs_fs(void)
-{
-	unregister_filesystem(&ramfs_fs_type);
-}
-
-module_init(init_ramfs_fs)
-module_exit(exit_ramfs_fs)
-
 int __init init_rootfs(void)
 {
 	int err;
@@ -235,5 +224,19 @@ int __init init_rootfs(void)
 
 	return err;
 }
+#endif
+
+static int __init init_ramfs_fs(void)
+{
+	return register_filesystem(&ramfs_fs_type);
+}
+
+static void __exit exit_ramfs_fs(void)
+{
+	unregister_filesystem(&ramfs_fs_type);
+}
+
+module_init(init_ramfs_fs)
+module_exit(exit_ramfs_fs)
 
 MODULE_LICENSE("GPL");
diff -pruNXdontdiff linux-2.6.27.2-numlock/mm/shmem.c linux-2.6.27.3-tmpfs/mm/shmem.c
--- linux-2.6.27.2-numlock/mm/shmem.c	2008-10-10 13:18:47.000000000 +0200
+++ linux-2.6.27.3-tmpfs/mm/shmem.c	2008-10-11 16:05:52.000000000 +0200
@@ -2366,6 +2366,10 @@ static void init_once(void *foo)
 
 static int init_inodecache(void)
 {
+#ifdef CONFIG_TMPFS_ROOT
+	if (shmem_inode_cachep)
+		return 0;
+#endif
 	shmem_inode_cachep = kmem_cache_create("shmem_inode_cache",
 				sizeof(struct shmem_inode_info),
 				0, SLAB_PANIC, init_once);
@@ -2583,6 +2587,28 @@ put_memory:
 	return ERR_PTR(error);
 }
 
+#ifdef CONFIG_TMPFS_ROOT
+static int rootfs_get_sb(struct file_system_type *fs_type,
+	int flags, const char *dev_name, void *data, struct vfsmount *mnt)
+{
+	return get_sb_nodev(fs_type, flags, data, shmem_fill_super, mnt);
+}
+
+ 
+ static struct file_system_type rootfs_fs_type = {
+ 	.name		= "rootfs",
+ 	.get_sb		= rootfs_get_sb,
+ 	.kill_sb	= kill_litter_super,
+ };
+ 
+ int __init init_rootfs(void)
+ {
+ 	if (init_inodecache())
+ 		panic("Can't initialize shm inode cache");
+ 	return register_filesystem(&rootfs_fs_type);
+ }
+ #endif
+ 
 /**
  * shmem_zero_setup - setup a shared anonymous mapping
  * @vma: the vma to be mmapped is prepared by do_mmap_pgoff

-- 
"If your attack is going too well, you're walking into an ambush."
-Infantry Journal

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] use tmpfs for rootfs
  2008-10-16 12:03 [PATCH] use tmpfs for rootfs Bodo Eggert
@ 2008-10-16 13:10 ` Geert Uytterhoeven
  2008-10-16 17:35   ` Bodo Eggert
  2008-10-16 17:39   ` [PATCH] use tmpfs for rootfs v2 Bodo Eggert
  0 siblings, 2 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2008-10-16 13:10 UTC (permalink / raw)
  To: Bodo Eggert; +Cc: linux-kernel

On Thu, 16 Oct 2008, Bodo Eggert wrote:
> +config TMPFS_ROOT
> +	bool "Use tmpfs instrad of ramfs for initramfs"
> +	depends on TMPFS && SHMEM
> +	default n
> +	help
> +	  This replaces the ramfs used for unpacking the cpio images
> +	  with tmpfs.
> +	  
> +	  If unsure, say N
> +
> +config RAMFS
> + 	bool "Ramfs file system support" if TMPFS_ROOT
> +  	default y
> +  	---help---
> +  	  Ramfs is a file system which keeps all files in RAM. Unlike tmpfs,
> +  	  it cannot be swapped to disk, and it has the risk of deadlocking
> +  	  the system by using all memory.
> +
> +  	  Ramfs is used for booting the system and unpacking the cpio if
> +  	  TMPFS_ROOT is not set.

Something seems to be missing, as you add CONFIG_RAMFS, but it's nowhere used?

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] use tmpfs for rootfs
  2008-10-16 13:10 ` Geert Uytterhoeven
@ 2008-10-16 17:35   ` Bodo Eggert
  2008-10-16 17:39   ` [PATCH] use tmpfs for rootfs v2 Bodo Eggert
  1 sibling, 0 replies; 12+ messages in thread
From: Bodo Eggert @ 2008-10-16 17:35 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Bodo Eggert, linux-kernel

On Thu, 16 Oct 2008, Geert Uytterhoeven wrote:
> On Thu, 16 Oct 2008, Bodo Eggert wrote:

> > +config TMPFS_ROOT
> > +	bool "Use tmpfs instrad of ramfs for initramfs"
> > +	depends on TMPFS && SHMEM
> > +	default n
> > +	help
> > +	  This replaces the ramfs used for unpacking the cpio images
> > +	  with tmpfs.
> > +	  
> > +	  If unsure, say N
> > +
> > +config RAMFS
> > + 	bool "Ramfs file system support" if TMPFS_ROOT
> > +  	default y
> > +  	---help---
> > +  	  Ramfs is a file system which keeps all files in RAM. Unlike tmpfs,
> > +  	  it cannot be swapped to disk, and it has the risk of deadlocking
> > +  	  the system by using all memory.
> > +
> > +  	  Ramfs is used for booting the system and unpacking the cpio if
> > +  	  TMPFS_ROOT is not set.
> 
> Something seems to be missing, as you add CONFIG_RAMFS, but it's nowhere used?
> 
> Gr{oetje,eeting}s,

Yes. I managed to edit the wrong Makefile. Since there seems no way of 
sensibly appending a patch to a mail, I'll reply with the corrected patch.
-- 
Never stand when you can sit, never sit when you can lie down, never stay
awake when you can sleep.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] use tmpfs for rootfs v2
  2008-10-16 13:10 ` Geert Uytterhoeven
  2008-10-16 17:35   ` Bodo Eggert
@ 2008-10-16 17:39   ` Bodo Eggert
  2008-10-16 20:52     ` Chris Friesen
  2008-10-16 21:03     ` Jeff Schroeder
  1 sibling, 2 replies; 12+ messages in thread
From: Bodo Eggert @ 2008-10-16 17:39 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Bodo Eggert, linux-kernel, jeffschroeder

This patch allows chosing tmpfs instead of ramfs for the root filesystem. 
Having tmpfs is usefull for running systems from RAM, because it does not 
risk deadlocking the system and possibly allows swapping. Using tmpfs 
increases the kernel by 10 bytes on x86_64.

Having tmpfs as the root filesystem allows you to get rid of the now unused 
ramfs and free some kernel memory. On my system, that's about 5198 bytes 
compared to having a ramfs root.

Off cause you can mount tmpfs and move around the data, but this is slower
(having to copy around the data), more error-prone and it uses more memory.
Besides that, I don't see the point in explicitely doing the wrong thing
and then having everybody fix it.


Signed-off-by: Bodo Eggert <7eggert@gmx.de>

---
Changes to v1: Include the change to the Makefile.

Some numbers for my system: (from make and from size vmlinux)

Setup is 10716 bytes (padded to 10752 bytes).
System is 2659 kB
text    data     bss     dec     hex filename
5341667  874212  562992 6778871  676ff7 vmlinux

having TMPFS_IS_ROOT:
Setup is 10716 bytes (padded to 10752 bytes).
System is 2659 kB
text    data     bss     dec     hex filename
5341677  874212  562992 6778881  677001 vmlinux
    +10

not having ramfs:
Setup is 10716 bytes (padded to 10752 bytes).
System is 2659 kB
text    data     bss     dec     hex filename
5336733  873948  562992 6773673  675ba9 vmlinux
  -4934    -264


 fs/Kconfig       |   21 +++++++++++++++++++++
 fs/Makefile      |    2 +-
 fs/ramfs/inode.c |   39 +++++++++++++++++++++------------------
 mm/shmem.c       |   26 ++++++++++++++++++++++++++
 4 files changed, 69 insertions(+), 19 deletions(-)

diff -pruNXdontdiff linux-2.6.27.2-numlock/fs/Kconfig linux-2.6.27.3-tmpfs/fs/Kconfig
--- linux-2.6.27.2-numlock/fs/Kconfig	2008-10-10 13:18:34.000000000 +0200
+++ linux-2.6.27.3-tmpfs/fs/Kconfig	2008-10-11 15:42:21.000000000 +0200
@@ -953,6 +953,27 @@ config TMPFS_POSIX_ACL
 
 	  If you don't know what Access Control Lists are, say N.
 
+config TMPFS_ROOT
+	bool "Use tmpfs instrad of ramfs for initramfs"
+	depends on TMPFS && SHMEM
+	default n
+	help
+	  This replaces the ramfs used for unpacking the cpio images
+	  with tmpfs.
+	  
+	  If unsure, say N
+
+config RAMFS
+ 	bool "Ramfs file system support" if TMPFS_ROOT
+  	default y
+  	---help---
+  	  Ramfs is a file system which keeps all files in RAM. Unlike tmpfs,
+  	  it cannot be swapped to disk, and it has the risk of deadlocking
+  	  the system by using all memory.
+
+  	  Ramfs is used for booting the system and unpacking the cpio if
+  	  TMPFS_ROOT is not set.
+
 config HUGETLBFS
 	bool "HugeTLB file system support"
 	depends on X86 || IA64 || PPC64 || SPARC64 || (SUPERH && MMU) || \
diff -pruNXdontdiff linux-2.6.27.2-numlock/fs/ramfs/inode.c linux-2.6.27.3-tmpfs/fs/ramfs/inode.c
--- linux-2.6.27.2-numlock/fs/ramfs/inode.c	2008-07-13 23:51:29.000000000 +0200
+++ linux-2.6.27.3-tmpfs/fs/ramfs/inode.c	2008-10-11 15:50:03.000000000 +0200
@@ -190,6 +190,13 @@ int ramfs_get_sb(struct file_system_type
 	return get_sb_nodev(fs_type, flags, data, ramfs_fill_super, mnt);
 }
 
+static struct file_system_type ramfs_fs_type = {
+	.name		= "ramfs",
+	.get_sb		= ramfs_get_sb,
+	.kill_sb	= kill_litter_super,
+};
+
+#ifndef CONFIG_TMPFS_ROOT
 static int rootfs_get_sb(struct file_system_type *fs_type,
 	int flags, const char *dev_name, void *data, struct vfsmount *mnt)
 {
@@ -197,30 +204,12 @@ static int rootfs_get_sb(struct file_sys
 			    mnt);
 }
 
-static struct file_system_type ramfs_fs_type = {
-	.name		= "ramfs",
-	.get_sb		= ramfs_get_sb,
-	.kill_sb	= kill_litter_super,
-};
 static struct file_system_type rootfs_fs_type = {
 	.name		= "rootfs",
 	.get_sb		= rootfs_get_sb,
 	.kill_sb	= kill_litter_super,
 };
 
-static int __init init_ramfs_fs(void)
-{
-	return register_filesystem(&ramfs_fs_type);
-}
-
-static void __exit exit_ramfs_fs(void)
-{
-	unregister_filesystem(&ramfs_fs_type);
-}
-
-module_init(init_ramfs_fs)
-module_exit(exit_ramfs_fs)
-
 int __init init_rootfs(void)
 {
 	int err;
@@ -235,5 +224,19 @@ int __init init_rootfs(void)
 
 	return err;
 }
+#endif
+
+static int __init init_ramfs_fs(void)
+{
+	return register_filesystem(&ramfs_fs_type);
+}
+
+static void __exit exit_ramfs_fs(void)
+{
+	unregister_filesystem(&ramfs_fs_type);
+}
+
+module_init(init_ramfs_fs)
+module_exit(exit_ramfs_fs)
 
 MODULE_LICENSE("GPL");
diff -pruNXdontdiff linux-2.6.27.2-numlock/mm/shmem.c linux-2.6.27.3-tmpfs/mm/shmem.c
--- linux-2.6.27.2-numlock/mm/shmem.c	2008-10-10 13:18:47.000000000 +0200
+++ linux-2.6.27.3-tmpfs/mm/shmem.c	2008-10-11 16:05:52.000000000 +0200
@@ -2366,6 +2366,10 @@ static void init_once(void *foo)
 
 static int init_inodecache(void)
 {
+#ifdef CONFIG_TMPFS_ROOT
+	if (shmem_inode_cachep)
+		return 0;
+#endif
 	shmem_inode_cachep = kmem_cache_create("shmem_inode_cache",
 				sizeof(struct shmem_inode_info),
 				0, SLAB_PANIC, init_once);
@@ -2583,6 +2587,28 @@ put_memory:
 	return ERR_PTR(error);
 }
 
+#ifdef CONFIG_TMPFS_ROOT
+static int rootfs_get_sb(struct file_system_type *fs_type,
+	int flags, const char *dev_name, void *data, struct vfsmount *mnt)
+{
+	return get_sb_nodev(fs_type, flags, data, shmem_fill_super, mnt);
+}
+
+ 
+ static struct file_system_type rootfs_fs_type = {
+ 	.name		= "rootfs",
+ 	.get_sb		= rootfs_get_sb,
+ 	.kill_sb	= kill_litter_super,
+ };
+ 
+ int __init init_rootfs(void)
+ {
+ 	if (init_inodecache())
+ 		panic("Can't initialize shm inode cache");
+ 	return register_filesystem(&rootfs_fs_type);
+ }
+ #endif
+ 
 /**
  * shmem_zero_setup - setup a shared anonymous mapping
  * @vma: the vma to be mmapped is prepared by do_mmap_pgoff
diff -pruNXdontdiff linux-2.6.27.2-numlock/fs/Makefile linux-2.6.27.3-tmpfs/fs/Makefile
--- linux-2.6.27.2-numlock/fs/Makefile	2008-10-16 19:25:20.000000000 +0200
+++ linux-2.6.27.3-tmpfs/fs/Makefile	2008-10-16 19:24:00.000000000 +0200
@@ -67,6 +67,7 @@ obj-$(CONFIG_PROFILING)		+= dcookies.o
 obj-$(CONFIG_DLM)		+= dlm/
  
 # Do not add any filesystems before this line
+obj-$(CONFIG_RAMFS)             += ramfs/
 obj-$(CONFIG_REISERFS_FS)	+= reiserfs/
 obj-$(CONFIG_EXT3_FS)		+= ext3/ # Before ext2 so root fs can be ext3
 obj-$(CONFIG_EXT4DEV_FS)	+= ext4/ # Before ext2 so root fs can be ext4dev
@@ -74,7 +75,6 @@ obj-$(CONFIG_JBD)		+= jbd/
 obj-$(CONFIG_JBD2)		+= jbd2/
 obj-$(CONFIG_EXT2_FS)		+= ext2/
 obj-$(CONFIG_CRAMFS)		+= cramfs/
-obj-y				+= ramfs/
 obj-$(CONFIG_HUGETLBFS)		+= hugetlbfs/
 obj-$(CONFIG_CODA_FS)		+= coda/
 obj-$(CONFIG_MINIX_FS)		+= minix/
-- 
Fun things to slip into your budget
TRUE:  $3000 for light bulb rotation

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] use tmpfs for rootfs v2
  2008-10-16 17:39   ` [PATCH] use tmpfs for rootfs v2 Bodo Eggert
@ 2008-10-16 20:52     ` Chris Friesen
  2008-10-16 22:45       ` Bodo Eggert
  2008-10-16 21:03     ` Jeff Schroeder
  1 sibling, 1 reply; 12+ messages in thread
From: Chris Friesen @ 2008-10-16 20:52 UTC (permalink / raw)
  To: Bodo Eggert; +Cc: Geert Uytterhoeven, linux-kernel, jeffschroeder

Bodo Eggert wrote:

> Having tmpfs as the root filesystem allows you to get rid of the now unused 
> ramfs and free some kernel memory. On my system, that's about 5198 bytes 
> compared to having a ramfs root.

If you're not using swap, I assume the memory usage of tmpfs and ramfs 
would be identical?

Chris

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] use tmpfs for rootfs v2
  2008-10-16 17:39   ` [PATCH] use tmpfs for rootfs v2 Bodo Eggert
  2008-10-16 20:52     ` Chris Friesen
@ 2008-10-16 21:03     ` Jeff Schroeder
  2008-10-16 22:53       ` Bodo Eggert
  2008-10-17 11:16       ` [PATCH] use tmpfs for rootfs v3 Bodo Eggert
  1 sibling, 2 replies; 12+ messages in thread
From: Jeff Schroeder @ 2008-10-16 21:03 UTC (permalink / raw)
  To: Bodo Eggert; +Cc: Geert Uytterhoeven, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 8050 bytes --]

On Thu, Oct 16, 2008 at 10:39 AM, Bodo Eggert <7eggert@gmx.de> wrote:
> This patch allows chosing tmpfs instead of ramfs for the root filesystem.
> Having tmpfs is usefull for running systems from RAM, because it does not
> risk deadlocking the system and possibly allows swapping. Using tmpfs
> increases the kernel by 10 bytes on x86_64.
>
> Having tmpfs as the root filesystem allows you to get rid of the now unused
> ramfs and free some kernel memory. On my system, that's about 5198 bytes
> compared to having a ramfs root.
>
> Off cause you can mount tmpfs and move around the data, but this is slower
> (having to copy around the data), more error-prone and it uses more memory.
> Besides that, I don't see the point in explicitely doing the wrong thing
> and then having everybody fix it.
>
>
> Signed-off-by: Bodo Eggert <7eggert@gmx.de>
>
> ---
> Changes to v1: Include the change to the Makefile.
>
> Some numbers for my system: (from make and from size vmlinux)
>
> Setup is 10716 bytes (padded to 10752 bytes).
> System is 2659 kB
> text    data     bss     dec     hex filename
> 5341667  874212  562992 6778871  676ff7 vmlinux
>
> having TMPFS_IS_ROOT:
> Setup is 10716 bytes (padded to 10752 bytes).
> System is 2659 kB
> text    data     bss     dec     hex filename
> 5341677  874212  562992 6778881  677001 vmlinux
>    +10
>
> not having ramfs:
> Setup is 10716 bytes (padded to 10752 bytes).
> System is 2659 kB
> text    data     bss     dec     hex filename
> 5336733  873948  562992 6773673  675ba9 vmlinux
>  -4934    -264
>
>
>  fs/Kconfig       |   21 +++++++++++++++++++++
>  fs/Makefile      |    2 +-
>  fs/ramfs/inode.c |   39 +++++++++++++++++++++------------------
>  mm/shmem.c       |   26 ++++++++++++++++++++++++++
>  4 files changed, 69 insertions(+), 19 deletions(-)
>
> diff -pruNXdontdiff linux-2.6.27.2-numlock/fs/Kconfig linux-2.6.27.3-tmpfs/fs/Kconfig
> --- linux-2.6.27.2-numlock/fs/Kconfig   2008-10-10 13:18:34.000000000 +0200
> +++ linux-2.6.27.3-tmpfs/fs/Kconfig     2008-10-11 15:42:21.000000000 +0200
> @@ -953,6 +953,27 @@ config TMPFS_POSIX_ACL
>
>          If you don't know what Access Control Lists are, say N.
>
> +config TMPFS_ROOT
> +       bool "Use tmpfs instrad of ramfs for initramfs"
> +       depends on TMPFS && SHMEM
> +       default n
> +       help
> +         This replaces the ramfs used for unpacking the cpio images
> +         with tmpfs.
> +
> +         If unsure, say N
> +
> +config RAMFS
> +       bool "Ramfs file system support" if TMPFS_ROOT
> +       default y
> +       ---help---
> +         Ramfs is a file system which keeps all files in RAM. Unlike tmpfs,
> +         it cannot be swapped to disk, and it has the risk of deadlocking
> +         the system by using all memory.
> +
> +         Ramfs is used for booting the system and unpacking the cpio if
> +         TMPFS_ROOT is not set.
> +
>  config HUGETLBFS
>        bool "HugeTLB file system support"
>        depends on X86 || IA64 || PPC64 || SPARC64 || (SUPERH && MMU) || \
> diff -pruNXdontdiff linux-2.6.27.2-numlock/fs/ramfs/inode.c linux-2.6.27.3-tmpfs/fs/ramfs/inode.c
> --- linux-2.6.27.2-numlock/fs/ramfs/inode.c     2008-07-13 23:51:29.000000000 +0200
> +++ linux-2.6.27.3-tmpfs/fs/ramfs/inode.c       2008-10-11 15:50:03.000000000 +0200
> @@ -190,6 +190,13 @@ int ramfs_get_sb(struct file_system_type
>        return get_sb_nodev(fs_type, flags, data, ramfs_fill_super, mnt);
>  }
>
> +static struct file_system_type ramfs_fs_type = {
> +       .name           = "ramfs",
> +       .get_sb         = ramfs_get_sb,
> +       .kill_sb        = kill_litter_super,
> +};
> +
> +#ifndef CONFIG_TMPFS_ROOT
>  static int rootfs_get_sb(struct file_system_type *fs_type,
>        int flags, const char *dev_name, void *data, struct vfsmount *mnt)
>  {
> @@ -197,30 +204,12 @@ static int rootfs_get_sb(struct file_sys
>                            mnt);
>  }
>
> -static struct file_system_type ramfs_fs_type = {
> -       .name           = "ramfs",
> -       .get_sb         = ramfs_get_sb,
> -       .kill_sb        = kill_litter_super,
> -};
>  static struct file_system_type rootfs_fs_type = {
>        .name           = "rootfs",
>        .get_sb         = rootfs_get_sb,
>        .kill_sb        = kill_litter_super,
>  };
>
> -static int __init init_ramfs_fs(void)
> -{
> -       return register_filesystem(&ramfs_fs_type);
> -}
> -
> -static void __exit exit_ramfs_fs(void)
> -{
> -       unregister_filesystem(&ramfs_fs_type);
> -}
> -
> -module_init(init_ramfs_fs)
> -module_exit(exit_ramfs_fs)
> -
>  int __init init_rootfs(void)
>  {
>        int err;
> @@ -235,5 +224,19 @@ int __init init_rootfs(void)
>
>        return err;
>  }
> +#endif
> +
> +static int __init init_ramfs_fs(void)
> +{
> +       return register_filesystem(&ramfs_fs_type);
> +}
> +
> +static void __exit exit_ramfs_fs(void)
> +{
> +       unregister_filesystem(&ramfs_fs_type);
> +}
> +
> +module_init(init_ramfs_fs)
> +module_exit(exit_ramfs_fs)
>
>  MODULE_LICENSE("GPL");
> diff -pruNXdontdiff linux-2.6.27.2-numlock/mm/shmem.c linux-2.6.27.3-tmpfs/mm/shmem.c
> --- linux-2.6.27.2-numlock/mm/shmem.c   2008-10-10 13:18:47.000000000 +0200
> +++ linux-2.6.27.3-tmpfs/mm/shmem.c     2008-10-11 16:05:52.000000000 +0200
> @@ -2366,6 +2366,10 @@ static void init_once(void *foo)
>
>  static int init_inodecache(void)
>  {
> +#ifdef CONFIG_TMPFS_ROOT
> +       if (shmem_inode_cachep)
> +               return 0;
> +#endif
>        shmem_inode_cachep = kmem_cache_create("shmem_inode_cache",
>                                sizeof(struct shmem_inode_info),
>                                0, SLAB_PANIC, init_once);
> @@ -2583,6 +2587,28 @@ put_memory:
>        return ERR_PTR(error);
>  }
>
> +#ifdef CONFIG_TMPFS_ROOT
> +static int rootfs_get_sb(struct file_system_type *fs_type,
> +       int flags, const char *dev_name, void *data, struct vfsmount *mnt)
> +{
> +       return get_sb_nodev(fs_type, flags, data, shmem_fill_super, mnt);
> +}
> +
> +
> + static struct file_system_type rootfs_fs_type = {
> +       .name           = "rootfs",
> +       .get_sb         = rootfs_get_sb,
> +       .kill_sb        = kill_litter_super,
> + };
> +
> + int __init init_rootfs(void)
> + {
> +       if (init_inodecache())
> +               panic("Can't initialize shm inode cache");
> +       return register_filesystem(&rootfs_fs_type);
> + }
> + #endif
> +
>  /**
>  * shmem_zero_setup - setup a shared anonymous mapping
>  * @vma: the vma to be mmapped is prepared by do_mmap_pgoff
> diff -pruNXdontdiff linux-2.6.27.2-numlock/fs/Makefile linux-2.6.27.3-tmpfs/fs/Makefile
> --- linux-2.6.27.2-numlock/fs/Makefile  2008-10-16 19:25:20.000000000 +0200
> +++ linux-2.6.27.3-tmpfs/fs/Makefile    2008-10-16 19:24:00.000000000 +0200
> @@ -67,6 +67,7 @@ obj-$(CONFIG_PROFILING)               += dcookies.o
>  obj-$(CONFIG_DLM)              += dlm/
>
>  # Do not add any filesystems before this line
> +obj-$(CONFIG_RAMFS)             += ramfs/
>  obj-$(CONFIG_REISERFS_FS)      += reiserfs/
>  obj-$(CONFIG_EXT3_FS)          += ext3/ # Before ext2 so root fs can be ext3
>  obj-$(CONFIG_EXT4DEV_FS)       += ext4/ # Before ext2 so root fs can be ext4dev
> @@ -74,7 +75,6 @@ obj-$(CONFIG_JBD)             += jbd/
>  obj-$(CONFIG_JBD2)             += jbd2/
>  obj-$(CONFIG_EXT2_FS)          += ext2/
>  obj-$(CONFIG_CRAMFS)           += cramfs/
> -obj-y                          += ramfs/
>  obj-$(CONFIG_HUGETLBFS)                += hugetlbfs/
>  obj-$(CONFIG_CODA_FS)          += coda/
>  obj-$(CONFIG_MINIX_FS)         += minix/

Haven't gotten the hang of attaching patches inline using gmail yet.
Here is a patch ontop of the previous one that fixes whitespace problems
pointed out by checkpatch.pl. It is based on 2.7.27
3fa8749e584b55f1180411ab1b51117190bac1e5

It is also available here:
http://www.digitalprognosis.com/opensource/patches/linux-2.6/0001-Cleanup-the-whitespace-to-be-checkpatch-compliant.patch

-- 
Jeff Schroeder

Don't drink and derive, alcohol and analysis don't mix.
http://www.digitalprognosis.com

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Cleanup-the-whitespace-to-be-checkpatch-compliant.patch --]
[-- Type: text/x-diff; name=0001-Cleanup-the-whitespace-to-be-checkpatch-compliant.patch, Size: 1469 bytes --]

From e1fe0b8129d1769c834bff4262bab356e8d444bb Mon Sep 17 00:00:00 2001
From: Jeff Schroeder <jeffschroeder@computer.org>
Date: Thu, 16 Oct 2008 13:47:20 -0700
Subject: [PATCH] Cleanup the whitespace to be checkpatch compliant

Applies ontop of: http://lkml.org/lkml/diff/2008/10/16/388/1
Signed-off-by: Jeff Schroeder <jeffschroeder@computer.org>
---
 mm/shmem.c |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index a1d2042..d1b3cd8 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2594,21 +2594,21 @@ static int rootfs_get_sb(struct file_system_type *fs_type,
 	return get_sb_nodev(fs_type, flags, data, shmem_fill_super, mnt);
 }
 
- 
- static struct file_system_type rootfs_fs_type = {
- 	.name		= "rootfs",
- 	.get_sb		= rootfs_get_sb,
- 	.kill_sb	= kill_litter_super,
- };
- 
- int __init init_rootfs(void)
- {
- 	if (init_inodecache())
- 		panic("Can't initialize shm inode cache");
- 	return register_filesystem(&rootfs_fs_type);
- }
- #endif
- 
+
+static struct file_system_type rootfs_fs_type = {
+	.name		= "rootfs",
+	.get_sb		= rootfs_get_sb,
+	.kill_sb	= kill_litter_super,
+};
+
+int __init init_rootfs(void)
+{
+	if (init_inodecache())
+		panic("Can't initialize shm inode cache");
+	return register_filesystem(&rootfs_fs_type);
+}
+#endif
+
 /**
  * shmem_zero_setup - setup a shared anonymous mapping
  * @vma: the vma to be mmapped is prepared by do_mmap_pgoff
-- 
1.5.4.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] use tmpfs for rootfs v2
  2008-10-16 20:52     ` Chris Friesen
@ 2008-10-16 22:45       ` Bodo Eggert
  0 siblings, 0 replies; 12+ messages in thread
From: Bodo Eggert @ 2008-10-16 22:45 UTC (permalink / raw)
  To: Chris Friesen
  Cc: Bodo Eggert, Geert Uytterhoeven, linux-kernel, jeffschroeder

On Thu, 16 Oct 2008, Chris Friesen wrote:
> Bodo Eggert wrote:

> > Having tmpfs as the root filesystem allows you to get rid of the now unused
> > ramfs and free some kernel memory. On my system, that's about 5198 bytes
> > compared to having a ramfs root.
> 
> If you're not using swap, I assume the memory usage of tmpfs and ramfs would
> be identical?

I'd rather think having ACL, security labels etc. pp. will make tmpfs use 
more memory per file or directory. If you have no use for tmpfs' features,
you should use ramfs. But if you do want to use tmpfs in your system,
my guess is you'll be most likely be better off using no ramfs.
-- 
Good programming is 99% sweat and 1% coffee.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] use tmpfs for rootfs v2
  2008-10-16 21:03     ` Jeff Schroeder
@ 2008-10-16 22:53       ` Bodo Eggert
  2008-10-17 11:16       ` [PATCH] use tmpfs for rootfs v3 Bodo Eggert
  1 sibling, 0 replies; 12+ messages in thread
From: Bodo Eggert @ 2008-10-16 22:53 UTC (permalink / raw)
  To: jeffschroeder; +Cc: Bodo Eggert, Geert Uytterhoeven, linux-kernel

On Thu, 16 Oct 2008, Jeff Schroeder wrote:


> Haven't gotten the hang of attaching patches inline using gmail yet.
> Here is a patch ontop of the previous one that fixes whitespace problems
> pointed out by checkpatch.pl. It is based on 2.7.27
> 3fa8749e584b55f1180411ab1b51117190bac1e5
> 
> It is also available here:
> http://www.digitalprognosis.com/opensource/patches/linux-2.6/0001-Cleanup-the-whitespace-to-be-checkpatch-compliant.patch

Thanks. I'll update the patch soon.

Things you should know: In foo.rej, there are extra spaces. Some fools will 
keep them while applying these hunks.-(

-- 
"A slipping gear could let your M203 grenade launcher fire when you
least expect it. That would make you quite unpopular in what's left of
your unit."
-Army's magazine of preventive maintenance.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] use tmpfs for rootfs v3
  2008-10-16 21:03     ` Jeff Schroeder
  2008-10-16 22:53       ` Bodo Eggert
@ 2008-10-17 11:16       ` Bodo Eggert
  2008-10-19 18:12         ` Mike Frysinger
  1 sibling, 1 reply; 12+ messages in thread
From: Bodo Eggert @ 2008-10-17 11:16 UTC (permalink / raw)
  To: jeffschroeder; +Cc: Bodo Eggert, Geert Uytterhoeven, linux-kernel


This patch allows chosing tmpfs instead of ramfs for the root filesystem. 
Having tmpfs is usefull for running systems from RAM, because it does not 
risk deadlocking the system and possibly allows swapping. Using tmpfs 
increases the kernel by 10 bytes on x86_64.

Having tmpfs as the root filesystem allows you to get rid of the now unused 
ramfs and free some kernel memory. On my system, that's about 5198 bytes 
compared to having a ramfs root.

Off cause you can mount tmpfs and move around the data, but this is slower
(having to copy around the data), more error-prone and it uses more memory.
Besides that, I don't see the point in explicitely doing the wrong thing
and then having everybody fix it.


Signed-off-by: Bodo Eggert <7eggert@gmx.de>

---

Changes to v1: Include the change to the Makefile.
Changes to v2: Fix whitespace damage

Some numbers for my system: (from make and from size vmlinux)

Setup is 10716 bytes (padded to 10752 bytes).
System is 2659 kB
text    data     bss     dec     hex filename
5341667  874212  562992 6778871  676ff7 vmlinux

having TMPFS_IS_ROOT:
Setup is 10716 bytes (padded to 10752 bytes).
System is 2659 kB
text    data     bss     dec     hex filename
5341677  874212  562992 6778881  677001 vmlinux
    +10

not having ramfs:
Setup is 10716 bytes (padded to 10752 bytes).
System is 2659 kB
text    data     bss     dec     hex filename
5336733  873948  562992 6773673  675ba9 vmlinux
  -4934    -264


 fs/Kconfig       |   21 +++++++++++++++++++++
 fs/Makefile      |    2 +-
 fs/ramfs/inode.c |   39 +++++++++++++++++++++------------------
 mm/shmem.c       |   26 ++++++++++++++++++++++++++
 4 files changed, 69 insertions(+), 19 deletions(-)

diff -pruNXdontdiff linux-2.6.27.2-numlock/fs/Kconfig linux-2.6.27.3-tmpfs/fs/Kconfig
--- linux-2.6.27.2-numlock/fs/Kconfig	2008-10-10 13:18:34.000000000 +0200
+++ linux-2.6.27.3-tmpfs/fs/Kconfig	2008-10-11 15:42:21.000000000 +0200
@@ -953,6 +953,27 @@ config TMPFS_POSIX_ACL
 
 	  If you don't know what Access Control Lists are, say N.
 
+config TMPFS_ROOT
+	bool "Use tmpfs instrad of ramfs for initramfs"
+	depends on TMPFS && SHMEM
+	default n
+	help
+	  This replaces the ramfs used for unpacking the cpio images
+	  with tmpfs.
+	  
+	  If unsure, say N
+
+config RAMFS
+ 	bool "Ramfs file system support" if TMPFS_ROOT
+  	default y
+  	---help---
+  	  Ramfs is a file system which keeps all files in RAM. Unlike tmpfs,
+  	  it cannot be swapped to disk, and it has the risk of deadlocking
+  	  the system by using all memory.
+
+  	  Ramfs is used for booting the system and unpacking the cpio if
+  	  TMPFS_ROOT is not set.
+
 config HUGETLBFS
 	bool "HugeTLB file system support"
 	depends on X86 || IA64 || PPC64 || SPARC64 || (SUPERH && MMU) || \
diff -pruNXdontdiff linux-2.6.27.2-numlock/fs/ramfs/inode.c linux-2.6.27.3-tmpfs/fs/ramfs/inode.c
--- linux-2.6.27.2-numlock/fs/ramfs/inode.c	2008-07-13 23:51:29.000000000 +0200
+++ linux-2.6.27.3-tmpfs/fs/ramfs/inode.c	2008-10-11 15:50:03.000000000 +0200
@@ -190,6 +190,13 @@ int ramfs_get_sb(struct file_system_type
 	return get_sb_nodev(fs_type, flags, data, ramfs_fill_super, mnt);
 }
 
+static struct file_system_type ramfs_fs_type = {
+	.name		= "ramfs",
+	.get_sb		= ramfs_get_sb,
+	.kill_sb	= kill_litter_super,
+};
+
+#ifndef CONFIG_TMPFS_ROOT
 static int rootfs_get_sb(struct file_system_type *fs_type,
 	int flags, const char *dev_name, void *data, struct vfsmount *mnt)
 {
@@ -197,30 +204,12 @@ static int rootfs_get_sb(struct file_sys
 			    mnt);
 }
 
-static struct file_system_type ramfs_fs_type = {
-	.name		= "ramfs",
-	.get_sb		= ramfs_get_sb,
-	.kill_sb	= kill_litter_super,
-};
 static struct file_system_type rootfs_fs_type = {
 	.name		= "rootfs",
 	.get_sb		= rootfs_get_sb,
 	.kill_sb	= kill_litter_super,
 };
 
-static int __init init_ramfs_fs(void)
-{
-	return register_filesystem(&ramfs_fs_type);
-}
-
-static void __exit exit_ramfs_fs(void)
-{
-	unregister_filesystem(&ramfs_fs_type);
-}
-
-module_init(init_ramfs_fs)
-module_exit(exit_ramfs_fs)
-
 int __init init_rootfs(void)
 {
 	int err;
@@ -235,5 +224,19 @@ int __init init_rootfs(void)
 
 	return err;
 }
+#endif
+
+static int __init init_ramfs_fs(void)
+{
+	return register_filesystem(&ramfs_fs_type);
+}
+
+static void __exit exit_ramfs_fs(void)
+{
+	unregister_filesystem(&ramfs_fs_type);
+}
+
+module_init(init_ramfs_fs)
+module_exit(exit_ramfs_fs)
 
 MODULE_LICENSE("GPL");
diff -pruNXdontdiff linux-2.6.27.2-numlock/mm/shmem.c linux-2.6.27.3-tmpfs/mm/shmem.c
--- linux-2.6.27.2-numlock/mm/shmem.c	2008-10-10 13:18:47.000000000 +0200
+++ linux-2.6.27.3-tmpfs/mm/shmem.c	2008-10-11 16:05:52.000000000 +0200
@@ -2366,6 +2366,10 @@ static void init_once(void *foo)
 
 static int init_inodecache(void)
 {
+#ifdef CONFIG_TMPFS_ROOT
+	if (shmem_inode_cachep)
+		return 0;
+#endif
 	shmem_inode_cachep = kmem_cache_create("shmem_inode_cache",
 				sizeof(struct shmem_inode_info),
 				0, SLAB_PANIC, init_once);
@@ -2583,6 +2587,28 @@ put_memory:
 	return ERR_PTR(error);
 }
 
+#ifdef CONFIG_TMPFS_ROOT
+static int rootfs_get_sb(struct file_system_type *fs_type,
+	int flags, const char *dev_name, void *data, struct vfsmount *mnt)
+{
+	return get_sb_nodev(fs_type, flags, data, shmem_fill_super, mnt);
+}
+
+
+static struct file_system_type rootfs_fs_type = {
+	.name		= "rootfs",
+	.get_sb		= rootfs_get_sb,
+	.kill_sb	= kill_litter_super,
+};
+
+int __init init_rootfs(void)
+{
+	if (init_inodecache())
+		panic("Can't initialize shm inode cache");
+	return register_filesystem(&rootfs_fs_type);
+}
+#endif
+
 /**
  * shmem_zero_setup - setup a shared anonymous mapping
  * @vma: the vma to be mmapped is prepared by do_mmap_pgoff
diff -pruNXdontdiff linux-2.6.27.2-numlock/fs/Makefile linux-2.6.27.3-tmpfs/fs/Makefile
--- linux-2.6.27.2-numlock/fs/Makefile	2008-10-16 19:25:20.000000000 +0200
+++ linux-2.6.27.3-tmpfs/fs/Makefile	2008-10-16 19:24:00.000000000 +0200
@@ -67,6 +67,7 @@ obj-$(CONFIG_PROFILING)		+= dcookies.o
 obj-$(CONFIG_DLM)		+= dlm/
  
 # Do not add any filesystems before this line
+obj-$(CONFIG_RAMFS)             += ramfs/
 obj-$(CONFIG_REISERFS_FS)	+= reiserfs/
 obj-$(CONFIG_EXT3_FS)		+= ext3/ # Before ext2 so root fs can be ext3
 obj-$(CONFIG_EXT4DEV_FS)	+= ext4/ # Before ext2 so root fs can be ext4dev
@@ -74,7 +75,6 @@ obj-$(CONFIG_JBD)		+= jbd/
 obj-$(CONFIG_JBD2)		+= jbd2/
 obj-$(CONFIG_EXT2_FS)		+= ext2/
 obj-$(CONFIG_CRAMFS)		+= cramfs/
-obj-y				+= ramfs/
 obj-$(CONFIG_HUGETLBFS)		+= hugetlbfs/
 obj-$(CONFIG_CODA_FS)		+= coda/
 obj-$(CONFIG_MINIX_FS)		+= minix/
-- 
In the beginning, God created the earth and rested.
Then God created Man and rested.
Then God created Woman.
Since then, neither God nor Man has rested.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] use tmpfs for rootfs v3
  2008-10-17 11:16       ` [PATCH] use tmpfs for rootfs v3 Bodo Eggert
@ 2008-10-19 18:12         ` Mike Frysinger
  2008-10-20 18:13           ` Bodo Eggert
  0 siblings, 1 reply; 12+ messages in thread
From: Mike Frysinger @ 2008-10-19 18:12 UTC (permalink / raw)
  To: Bodo Eggert; +Cc: jeffschroeder, Geert Uytterhoeven, linux-kernel

On Fri, Oct 17, 2008 at 07:16, Bodo Eggert wrote:
> This patch allows chosing tmpfs instead of ramfs for the root filesystem.
> Having tmpfs is usefull for running systems from RAM, because it does not
> risk deadlocking the system and possibly allows swapping. Using tmpfs
> increases the kernel by 10 bytes on x86_64.

great option, thanks

> --- linux-2.6.27.2-numlock/fs/Kconfig   2008-10-10 13:18:34.000000000 +0200
> +++ linux-2.6.27.3-tmpfs/fs/Kconfig     2008-10-11 15:42:21.000000000 +0200
> @@ -953,6 +953,27 @@ config TMPFS_POSIX_ACL
>
>          If you don't know what Access Control Lists are, say N.
>
> +config TMPFS_ROOT
> +       bool "Use tmpfs instrad of ramfs for initramfs"
> +       depends on TMPFS && SHMEM
> +       default n
> +       help
> +         This replaces the ramfs used for unpacking the cpio images
> +         with tmpfs.
> +
> +         If unsure, say N

this should be init/Kconfig and depend on BLK_DEV_INITRD i think.  and
then update the comment to talk about the initial filesystem rather
than cpio images.

> +config RAMFS
> +       bool "Ramfs file system support" if TMPFS_ROOT

if you have initramfs support disabled, then you should be able to
disable RAMFS as well.  so perhaps the depend should read like:
if BLK_DEV_INITRD && TMPFS_ROOT || !BLK_DEV_INITRD
-mike

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] use tmpfs for rootfs v3
  2008-10-19 18:12         ` Mike Frysinger
@ 2008-10-20 18:13           ` Bodo Eggert
  2008-10-22 19:03             ` Mike Frysinger
  0 siblings, 1 reply; 12+ messages in thread
From: Bodo Eggert @ 2008-10-20 18:13 UTC (permalink / raw)
  To: Mike Frysinger
  Cc: Bodo Eggert, jeffschroeder, Geert Uytterhoeven, linux-kernel

On Sun, 19 Oct 2008, Mike Frysinger wrote:
> On Fri, Oct 17, 2008 at 07:16, Bodo Eggert wrote:

> > This patch allows chosing tmpfs instead of ramfs for the root filesystem.
> > Having tmpfs is usefull for running systems from RAM, because it does not
> > risk deadlocking the system and possibly allows swapping. Using tmpfs
> > increases the kernel by 10 bytes on x86_64.
> 
> great option, thanks
> 
> > --- linux-2.6.27.2-numlock/fs/Kconfig   2008-10-10 13:18:34.000000000 +0200
> > +++ linux-2.6.27.3-tmpfs/fs/Kconfig     2008-10-11 15:42:21.000000000 +0200
> > @@ -953,6 +953,27 @@ config TMPFS_POSIX_ACL
> >
> >          If you don't know what Access Control Lists are, say N.
> >
> > +config TMPFS_ROOT
> > +       bool "Use tmpfs instrad of ramfs for initramfs"
> > +       depends on TMPFS && SHMEM
> > +       default n
> > +       help
> > +         This replaces the ramfs used for unpacking the cpio images
> > +         with tmpfs.
> > +
> > +         If unsure, say N
> 
> this should be init/Kconfig and depend on BLK_DEV_INITRD i think.  and
> then update the comment to talk about the initial filesystem rather
> than cpio images.

Maybe, but then you'd have to go to filesystems->pseudo-fs to enable tmpfs,
then to i-don't-remember to set it as the rootfs, and then back to
fs->pseudo-fs to unselect ramfs.

Thinking of it as a tmpfs option makes it much easier to use.

> > +config RAMFS
> > +       bool "Ramfs file system support" if TMPFS_ROOT
> 
> if you have initramfs support disabled, then you should be able to
> disable RAMFS as well.  so perhaps the depend should read like:
> if BLK_DEV_INITRD && TMPFS_ROOT || !BLK_DEV_INITRD

No, since a kernel not having initcpio support will mount rootfs anyway,
create some directories and special files and use them to open the console
and to mount the real root into.
-- 
The enemy diversion you have been ignoring will be the main attack.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] use tmpfs for rootfs v3
  2008-10-20 18:13           ` Bodo Eggert
@ 2008-10-22 19:03             ` Mike Frysinger
  0 siblings, 0 replies; 12+ messages in thread
From: Mike Frysinger @ 2008-10-22 19:03 UTC (permalink / raw)
  To: Bodo Eggert; +Cc: jeffschroeder, Geert Uytterhoeven, linux-kernel

On Mon, Oct 20, 2008 at 14:13, Bodo Eggert wrote:
> On Sun, 19 Oct 2008, Mike Frysinger wrote:
>> On Fri, Oct 17, 2008 at 07:16, Bodo Eggert wrote:
>> > --- linux-2.6.27.2-numlock/fs/Kconfig   2008-10-10 13:18:34.000000000 +0200
>> > +++ linux-2.6.27.3-tmpfs/fs/Kconfig     2008-10-11 15:42:21.000000000 +0200
>> > @@ -953,6 +953,27 @@ config TMPFS_POSIX_ACL
>> >
>> >          If you don't know what Access Control Lists are, say N.
>> >
>> > +config TMPFS_ROOT
>> > +       bool "Use tmpfs instrad of ramfs for initramfs"
>> > +       depends on TMPFS && SHMEM
>> > +       default n
>> > +       help
>> > +         This replaces the ramfs used for unpacking the cpio images
>> > +         with tmpfs.
>> > +
>> > +         If unsure, say N
>>
>> this should be init/Kconfig and depend on BLK_DEV_INITRD i think.  and
>> then update the comment to talk about the initial filesystem rather
>> than cpio images.
>
> Maybe, but then you'd have to go to filesystems->pseudo-fs to enable tmpfs,
> then to i-don't-remember to set it as the rootfs, and then back to
> fs->pseudo-fs to unselect ramfs.
>
> Thinking of it as a tmpfs option makes it much easier to use.

i guess that works

>> > +config RAMFS
>> > +       bool "Ramfs file system support" if TMPFS_ROOT
>>
>> if you have initramfs support disabled, then you should be able to
>> disable RAMFS as well.  so perhaps the depend should read like:
>> if BLK_DEV_INITRD && TMPFS_ROOT || !BLK_DEV_INITRD
>
> No, since a kernel not having initcpio support will mount rootfs anyway,

we should get that fixed then

> create some directories and special files and use them to open the console
> and to mount the real root into.

erm, i dont recall seeing any init code create any directories or
files.  opening /dev/console doesnt require the fake rootfs, nor does
mounting the real root on top of it.  where exactly do you see this
logic ?
-mike

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-10-22 19:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-16 12:03 [PATCH] use tmpfs for rootfs Bodo Eggert
2008-10-16 13:10 ` Geert Uytterhoeven
2008-10-16 17:35   ` Bodo Eggert
2008-10-16 17:39   ` [PATCH] use tmpfs for rootfs v2 Bodo Eggert
2008-10-16 20:52     ` Chris Friesen
2008-10-16 22:45       ` Bodo Eggert
2008-10-16 21:03     ` Jeff Schroeder
2008-10-16 22:53       ` Bodo Eggert
2008-10-17 11:16       ` [PATCH] use tmpfs for rootfs v3 Bodo Eggert
2008-10-19 18:12         ` Mike Frysinger
2008-10-20 18:13           ` Bodo Eggert
2008-10-22 19:03             ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).