public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Fix broken kmalloc_node in rc1/rc2
@ 2005-07-06 17:47 Christoph Lameter
  2005-07-09  6:25 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Lameter @ 2005-07-06 17:47 UTC (permalink / raw)
  To: torvalds; +Cc: akpm, linux-kernel

This patch used to be in Andrew's tree before the NUMA slab allocator went 
in. Either this patch or the NUMA slab allocator is needed in order for
kmalloc_node to work correctly.

pcibus_to_node may be used to generate the node information passed to 
kmalloc_node. pcibus_to_node returns -1 if it was not able to determine
on which node a pcibus is located. For that case kmalloc_node must
work like kmalloc.

Signed-off-by: Christoph Lameter <christoph@lameter.com>

Index: linux-2.6.13-rc2/mm/slab.c
===================================================================
--- linux-2.6.13-rc2.orig/mm/slab.c	2005-07-06 03:46:33.000000000 +0000
+++ linux-2.6.13-rc2/mm/slab.c	2005-07-06 17:34:19.000000000 +0000
@@ -2372,6 +2372,9 @@ void *kmem_cache_alloc_node(kmem_cache_t
 	struct slab *slabp;
 	kmem_bufctl_t next;
 
+	if (nodeid == -1)
+		return kmem_cache_alloc(cachep, flags);
+
 	for (loop = 0;;loop++) {
 		struct list_head *q;
 

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

* Re: Fix broken kmalloc_node in rc1/rc2
  2005-07-06 17:47 Fix broken kmalloc_node in rc1/rc2 Christoph Lameter
@ 2005-07-09  6:25 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2005-07-09  6:25 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: torvalds, akpm, linux-kernel

On Wed, Jul 06 2005, Christoph Lameter wrote:
> This patch used to be in Andrew's tree before the NUMA slab allocator went 
> in. Either this patch or the NUMA slab allocator is needed in order for
> kmalloc_node to work correctly.
> 
> pcibus_to_node may be used to generate the node information passed to 
> kmalloc_node. pcibus_to_node returns -1 if it was not able to determine
> on which node a pcibus is located. For that case kmalloc_node must
> work like kmalloc.
> 
> Signed-off-by: Christoph Lameter <christoph@lameter.com>
> 
> Index: linux-2.6.13-rc2/mm/slab.c
> ===================================================================
> --- linux-2.6.13-rc2.orig/mm/slab.c	2005-07-06 03:46:33.000000000 +0000
> +++ linux-2.6.13-rc2/mm/slab.c	2005-07-06 17:34:19.000000000 +0000
> @@ -2372,6 +2372,9 @@ void *kmem_cache_alloc_node(kmem_cache_t
>  	struct slab *slabp;
>  	kmem_bufctl_t next;
>  
> +	if (nodeid == -1)
> +		return kmem_cache_alloc(cachep, flags);
> +
>  	for (loop = 0;;loop++) {
>  		struct list_head *q;

imho, things like this are much cleaner coded as:

void *kmem_cache_alloc_node(cachep, flags, node)
{
        if (node != -1)
                return __kmem_cache_alloc_node(cachep, flags, node);

        /* no valid node, fall back to regular slab alloc */
        return kmem_cache_alloc(cachep, flags);

}

-- 
Jens Axboe


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

end of thread, other threads:[~2005-07-09  6:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-06 17:47 Fix broken kmalloc_node in rc1/rc2 Christoph Lameter
2005-07-09  6:25 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox