Re: [RFC] [PATCH] kmem_alloc (generic wrapper for kmallocand vmalloc)

From: Robert Love
Date: Wed Nov 10 2004 - 01:58:55 EST


On Wed, 2004-11-10 at 07:31 +0100, Carl-Daniel Hailfinger wrote:

> Yes, but what do you suggest for the following problem:
> alloc(max_loop*sizeof(struct loop_device))
>
> where sizeof(struct loop_device)==304 and 1<=max_loop<=16384
>
> For the smallest allocation (304 bytes) vmalloc is clearly wasteful
> and for the largest allocation (~ 5 MBytes) kmalloc doesn't work.

Stab in the dark: Break it into two separate loops?

Two loops would be faster than the branch on each alloc, too.

Even better: Re-architect so as not to need that mess at all?

Robert Love


-
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/