Re: [patch] mm: Reimplementation of dynamic percpu memory allocator

From: Ravikiran G Thirumalai
Date: Mon Jan 17 2005 - 13:35:02 EST


On Fri, Jan 14, 2005 at 01:34:25AM -0800, Andrew Morton wrote:
> Ravikiran G Thirumalai <kiran@xxxxxxxxxx> wrote:
>
> > >
> > > Why cannot the code simply call vmalloc rather than copying its internals?
> >
> > Node local allocation. vmalloc cannot ensure pages for correspomding
> > cpus are node local. Also, design goal was to allocate pages for
> > cpu_possible cpus only. With plain vmalloc, we will end up allocating
> > pages for NR_CPUS.
>
> So... is it not possible to enhance vmalloc() for node-awareness, then
> just use it?
>

Memory for block management (free lists, bufctl lists) is also resident
in one block. A typical block in this allocator looks like this:


VMALLOC_ADDR PAGE_ADDR BLOCK
============ ========= ========

0xa0000 0x10100 ----------------- ^ ^
. | | | |
. | cpu 0 | PCPU_BLKSIZE |
| | | |
0xa0100 0x30100 ----------------- v |
| | |
| cpu 1 | |
| | |
0xa0200 - ----------------- NR_CPUS
| | |
| !cpu_possible | |
| | |
0xa0300 - ----------------- |
| | |
| !cpu_possible | |
| | |
0xa0400 0x10300 ----------------- ^ v
| | |
| Block mgmt |BLOCK_MANAGEMENT_SIZE
| | |
0xa05ff ----------------- v



This block is setup by valloc_percpu in the allocator code. There is lot
of allocator specific stuff like the PCPU_BLKSIZE, BLOCK_MANAGEMENT_SIZE
used here. I thought it was not appropriate to put them in vmalloc.c.
A common vmalloc_percpu which can take arguments for PCPU_BLKSIZE and
BLOCK_MANAGEMENT_SIZE is not useful anywhere else.

Changed patchset with other modifications suggested will follow.

Thanks,
Kiran
-
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/