Re: [PATCH]fs/jffs2/wbuf.c: add compatibility support for OOB data block

Jörn Engel
2005-08-15T14:05:41Z

On Mon, 15 August 2005 18:00:28 +0400, Artem B. Bityuckiy wrote:
> Jörn Engel wrote:
> >My preferred approach would be to allocate a slab cache for jffs2
> >erase blocks. Then we either need a (much smaller) array of pointers
> >to the slab objects or maintain them as linked lists. But then again,
> >it wouldn't be the first ugly hack in jffs2. Go right ahead if you
> >really want to!
>
> Only not slab cache, what for? We allocate the erasblock structure once
> on mount and deallocate them all once on unmount. No need to use a slab
> cache. The merit of the slab cache is very fast allocations, and we will
> not make use of this property anyway. No need to use slab cache here at all.

One of its merits is fast allocation, yes.

Others are less external fragmentation and lower-order memory
allocations.

Say, you need about 65k for your erase blocks. With slab, you need to
allocate roughly 17 pages of 4k each, plus slab overhead. With
kmalloc, you allocate 128k. That's nearly twice what you need.

With slab, you allocate order-0 pages. With kmalloc you allocate
order-5 pages. Ask Martin J Bligh about high-order allocations if you
want to hear some spooky stories.

Going from kmalloc to vmalloc makes things even worse.

Jörn

--
Do not stop an army on its way home.
-- Sun Tzu