Skip to contentSkip to conversation

Reusing the slab allocator

DISCUSSION Jon Smirl 2 participants 2 messages Aug 10, 2005 – Aug 13, 2005

lore
Share & tools
lore

Jon Smirl

author
#0 lore raw

We need a memory manager for the VRAM on video cards. The most common video cards have been 2MB and 512MB memory. Is it possible to reuse the kernel slab allocator for managing this memory?

There are a couple of other odd constraints.
1) Some objects need to be allocated on boundaries, like 64B or even 1KB divisible addresses.
2) It would be best if the allocation bookkeeping data structures were kept in system RAM. It may not be simple to access VRAM for read/write of bookkeeping info. VRAM can require slow PCI cycles or need high mem mappings to access.

If possible I'd rather reuse an existing manager than write a new one.

Signature · 2 lines
Jon Smirl
[email protected]
#1 lore raw
Quoted 12 lines · Jon Smirl

We need a memory manager for the VRAM on video cards. The most common video cards have been 2MB and 512MB memory. Is it possible to reuse the kernel slab allocator for managing this memory?

There are a couple of other odd constraints.
1) Some objects need to be allocated on boundaries, like 64B or even 1KB divisible addresses.
2) It would be best if the allocation bookkeeping data structures were kept in system RAM. It may not be simple to access VRAM for read/write of bookkeeping info. VRAM can require slow PCI cycles or need high mem mappings to access.

Quoted 1 line

If possible I'd rather reuse an existing manager than write a new one.

Alternatively, take a look at vmem allocator described in Magazines and Vmem: Extending the Slab Allocator to Many CPUs and Arbitrary Resources by Bonwick. AFAIK the slab allocator in Solaris is built on vmem.

Pekka