Re: [PATCH] __alloc_bootmem_node should not panic when it fails

From: Ingo Oeser
Date: Sun Jun 27 2004 - 11:14:10 EST


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 27 June 2004 07:27, Anton Blanchard wrote:
> The following patch does that. We fall back to the regular
> __alloc_bootmem when __alloc_bootmem_node fails, which means all other
> nodes are checked for available memory.

But allocating from other nodes has performance implications, which
might be quite big, depending on the specific architecture. So you
should at least print an KERN_INFO or even KERN_WARNING message,
if this happens.

> Signed-off-by: Anton Blanchard <anton@xxxxxxxxx>
>
> diff -puN mm/bootmem.c~debugit mm/bootmem.c
> --- gr_work/mm/bootmem.c~debugit 2004-06-06 21:49:20.729826223 -0500
> +++ gr_work-anton/mm/bootmem.c 2004-06-06 22:07:16.840243987 -0500
> @@ -371,11 +371,6 @@ void * __init __alloc_bootmem_node (pg_d
> if (ptr)
> return (ptr);
>
> - /*
> - * Whoops, we cannot satisfy the allocation request.
> - */
> - printk(KERN_ALERT "bootmem alloc of %lu bytes failed!\n", size);
Maybe changing this message to:
printk(KERN_WARNING "Failed to alloc %lu bytes from local node.\n"
" Allocating from distant node instead. Performance may drop!\n", size);

> - panic("Out of memory");
> - return NULL;
> + return __alloc_bootmem(size, align, goal);
> }

So now the user knows what is going on and that this node might need
more memory ;-)

Regards

Ingo Oeser

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA3mjOU56oYWuOrkARAuQGAJ9lasSDYLgMDzAGnGYxnH4OpSHXNQCg0uy3
12GFsxYaaptUIZkYHYUw9Is=
=1ydw
-----END PGP SIGNATURE-----
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/