All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: initramfs fails for medium sized cpio archives
  2003-03-19  1:11 initramfs fails for medium sized cpio archives Trammell Hudson
@ 2003-03-19  1:07 ` Greg KH
  2003-03-19  2:03 ` Andrew Morton
  1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2003-03-19  1:07 UTC (permalink / raw)
  To: Trammell Hudson; +Cc: linux-kernel

On Tue, Mar 18, 2003 at 06:11:17PM -0700, Trammell Hudson wrote:
> [ Please cc me on any replies.  Thanks! ]
> 
> I'm trying to get 2.5.64 to load my initramfs cpio archive and
> have run into a problem with memory allocation during the
> unpacking.

This should be fixed in 2.5.65.  Please let us know if you still have
problems after trying that kernel.

thanks,

greg k-h

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

* initramfs fails for medium sized cpio archives
@ 2003-03-19  1:11 Trammell Hudson
  2003-03-19  1:07 ` Greg KH
  2003-03-19  2:03 ` Andrew Morton
  0 siblings, 2 replies; 4+ messages in thread
From: Trammell Hudson @ 2003-03-19  1:11 UTC (permalink / raw)
  To: linux-kernel

[ Please cc me on any replies.  Thanks! ]

I'm trying to get 2.5.64 to load my initramfs cpio archive and
have run into a problem with memory allocation during the
unpacking.

It seems that page_writeback_init() does not get called before
populate_root(), so total_pages in mm/page-writeback.c is still
zero rather than being initialized to nr_free_pagecache_pages().

The symptom is that after about 300 kb of files, balance_dirty_pages()
is called.  This then calls get_dirty_limits() that computes

	unmapped_ratio = 100 - (ps->nr_mapped * 100) / total_pages;

I've added a sanity check in get_dirty_limits() that initialized
total_pages if it is still zero and things seem to work, but
should some of the memory management modules be initialized first?

The kernel is booting on an Athlon and compiled with gcc 3.2.2.
The cpio archive is uClibc based and is about 600 k in size.
I created it with the following command:

	find . \
		| cpio -H crc -ov \
		| gzip
		> ../linux-2.5.64/usr/initramfs_data.cpio.gz

Trammell
-- 
  -----|----- hudson@osresearch.net                   W 240-283-1700
*>=====[]L\   hudson@rotomotion.com                   M 505-463-1896
'     -'-`-   http://www.swcp.com/~hudson/                    KC5RNF


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

* Re: initramfs fails for medium sized cpio archives
  2003-03-19  1:11 initramfs fails for medium sized cpio archives Trammell Hudson
  2003-03-19  1:07 ` Greg KH
@ 2003-03-19  2:03 ` Andrew Morton
  2003-03-20  2:12   ` Trammell Hudson
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2003-03-19  2:03 UTC (permalink / raw)
  To: Trammell Hudson; +Cc: linux-kernel

Trammell Hudson <hudson@osresearch.net> wrote:
>
> 	unmapped_ratio = 100 - (ps->nr_mapped * 100) / total_pages;
> 
> I've added a sanity check in get_dirty_limits() that initialized
> total_pages if it is still zero and things seem to work, but
> should some of the memory management modules be initialized first?

This is fixed in 2.5.65, with the below patch.

> The kernel is booting on an Athlon and compiled with gcc 3.2.2.
> The cpio archive is uClibc based and is about 600 k in size.
> I created it with the following command:
> 
> 	find . \
> 		| cpio -H crc -ov \
> 		| gzip
> 		> ../linux-2.5.64/usr/initramfs_data.cpio.gz

Neat.  Nice to see it working.


--- 25/include/linux/writeback.h~early-writeback-init	2003-03-16 22:54:07.000000000 -0800
+++ 25-akpm/include/linux/writeback.h	2003-03-16 22:54:07.000000000 -0800
@@ -79,6 +79,7 @@ extern int dirty_writeback_centisecs;
 extern int dirty_expire_centisecs;
 
 
+void page_writeback_init(void);
 void balance_dirty_pages(struct address_space *mapping);
 void balance_dirty_pages_ratelimited(struct address_space *mapping);
 int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0);
diff -puN init/main.c~early-writeback-init init/main.c
--- 25/init/main.c~early-writeback-init	2003-03-16 22:54:07.000000000 -0800
+++ 25-akpm/init/main.c	2003-03-16 22:54:07.000000000 -0800
@@ -35,6 +35,7 @@
 #include <linux/profile.h>
 #include <linux/rcupdate.h>
 #include <linux/moduleparam.h>
+#include <linux/writeback.h>
 
 #include <asm/io.h>
 #include <asm/bugs.h>
@@ -443,6 +444,8 @@ asmlinkage void __init start_kernel(void
 	vfs_caches_init(num_physpages);
 	radix_tree_init();
 	signals_init();
+	/* rootfs populating might need page-writeback */
+	page_writeback_init();
 	populate_rootfs();
 #ifdef CONFIG_PROC_FS
 	proc_root_init();
diff -puN mm/page-writeback.c~early-writeback-init mm/page-writeback.c
--- 25/mm/page-writeback.c~early-writeback-init	2003-03-16 22:54:07.000000000 -0800
+++ 25-akpm/mm/page-writeback.c	2003-03-16 22:54:07.000000000 -0800
@@ -369,7 +369,7 @@ static struct notifier_block ratelimit_n
  * dirty memory thresholds: allowing too much dirty highmem pins an excessive
  * number of buffer_heads.
  */
-static int __init page_writeback_init(void)
+void __init page_writeback_init(void)
 {
 	long buffer_pages = nr_free_buffer_pages();
 	long correction;
@@ -392,9 +392,7 @@ static int __init page_writeback_init(vo
 	add_timer(&wb_timer);
 	set_ratelimit();
 	register_cpu_notifier(&ratelimit_nb);
-	return 0;
 }
-module_init(page_writeback_init);
 
 int do_writepages(struct address_space *mapping, struct writeback_control *wbc)
 {

_


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

* Re: initramfs fails for medium sized cpio archives
  2003-03-19  2:03 ` Andrew Morton
@ 2003-03-20  2:12   ` Trammell Hudson
  0 siblings, 0 replies; 4+ messages in thread
From: Trammell Hudson @ 2003-03-20  2:12 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

On Tue, Mar 18, 2003 at 06:03:50PM -0800, Andrew Morton wrote:
> Trammell Hudson <hudson@osresearch.net> wrote:
> > I've added a sanity check in get_dirty_limits() that initialized
> > total_pages if it is still zero and things seem to work, but
> > should some of the memory management modules be initialized first?
> 
> This is fixed in 2.5.65, with the below patch.

Thanks.  I had missed it in the 2.5.65 change log since it didn't
mention initramfs, but now see the "Early page_writeback initialization"
entry.  The patch does fix the divide by zero error.

> [...] Neat.  Nice to see it working.

I'm working on a custom system that can only send a single file to
the nodes (over a custom interconnect) when they boot, so neither
tftping a ramdisk or a PXE boot loader would work for me.  Having
the initramfs image be bundled into the kernel is a real life saver.

Trammell
-- 
  -----|----- hudson@osresearch.net                   W 240-283-1700
*>=====[]L\   hudson@rotomotion.com                   M 505-463-1896
'     -'-`-   http://www.swcp.com/~hudson/                    KC5RNF


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

end of thread, other threads:[~2003-03-20  2:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-19  1:11 initramfs fails for medium sized cpio archives Trammell Hudson
2003-03-19  1:07 ` Greg KH
2003-03-19  2:03 ` Andrew Morton
2003-03-20  2:12   ` Trammell Hudson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.