tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Patch: optimize kmem_alloc for frequent mid-sized allocations



On Thu, Feb 12, 2009 at 11:40:17PM +0900, enami tsugutomo wrote:

> > > Your point is to keep memory in pool cache and not in pool itself,
> > > right?  If so, we want to bypass pool layer to avoid page header
> > > allocation, don't we?
> > 
> > I think that's a great idea. It could be done without an ABI change if an
> > additional flag was introduced and the 'palloc' argument to pool_cache_init
> > was made a 'void *'.
> 
> I initially thought it requires a bit more complicated change but
> actually we can just call pool_allocator_{alloc,free} instead of
> pool_{get,put} for minimum modification.

How about KASSERT(pa->pa_pagesz == sz) when the cache is being set up?
Looking at vmem, for its quantum caches it seems to allocate larger
pool pages, qcache_max*3. I guess this is to avoid excessive
fragmentation.

        http://nxr.netbsd.org/source/xref/sys/kern/subr_vmem.c#435

Andrew


Home | Main Index | Thread Index | Old Index