Re: PATCH 2.3.26: kmalloc GFP_ZERO

Karsten Keil (kkeil@suse.de)
Tue, 9 Nov 1999 07:40:00 +0100


On Mon, Nov 08, 1999 at 10:33:28PM -0500, Jeff Garzik wrote:

Won't work for none GFP_ZERO memory.
...
> continue;
> - return __kmem_cache_alloc(csizep->cs_cachep, flags);
> +
> + mem = __kmem_cache_alloc(csizep->cs_cachep, flags);
> +
> + if (mem && (flags & GFP_ZERO)) {
> + memset (mem, 0, size);
> + goto out;
> + }

should be:
if ((flags & GFP_ZERO) && mem)
memset (mem, 0, size);
goto out;
> }
> printk(KERN_ERR "kmalloc: Size (%lu) too large\n", (unsigned long) size);
> - return NULL;
> +out:
> + return mem;
> }

And I think a "return mem;" instead of "goto out;" 'll have a better
performance, you don't need to init mem then (return NULL after printk
again).

Karsten

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/