On Wed, 2007-10-31 at 21:46 +1100, Nick Piggin wrote:
tion
d.
The problem with that is that once a slab was allocated with the right
allocation context, anybody can get objects from these slabs.
low memory, and empty slab:
task A task B
kmem_cache_alloc() =3D NULL
current->flags |=3D PF_MEMALLOC
kmem_cache_alloc() =3D obj
(slab !=3D NULL)
kmem_cache_alloc() =3D obj
kmem_cache_alloc() =3D obj
kmem_cache_alloc() =3D obj
And now task A, who doesn't have the right permissions walks
away with all our reserve memory.
So we either reserve a page per object, which for 32 byte objects is a
large waste, or we stop anybody who doesn't have the right permissions
from obtaining objects. I took the latter approach.