Re: [PATCH 00/28] Swap over NFS -v16

Pekka Enberg
2008-02-29T12:29:07Z

On Fri, Feb 29, 2008 at 2:18 PM, Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
> Clearing PG_emergency would mean kmem_is_emergency() would return false
> in kfree_reserve() and fail to un-charge the object.
>
> Previously objects would track their account status themselves (when
> needed) and freeing PG_emergency wouldn't be a problem.
>
> > and allocate a new fresh page to the reserves?
>
> Not sure I understand this properly. We would only do this once the page
> watermarks are high enough, so the reserves are full again.

The problem with PG_emergency is that, once the watermarks are high
again, SLUB keeps holding to the emergency page and it cannot be used
for regular kmalloc allocations, right?

So the way to fix this is to batch uncharge the objects and clear
PG_emergency for the said SLUB pages thus freeing them for regular
allocations. And to compensate for the loss in the reserves, we ask
the page allocator to give a new one that SLUB knows nothing about.

If you don't do this, the reserve page can only contain few objects
making them unavailable for regular allocations. So we're might be
forced into "emergency mode" even though there's enough memory
available to satisfy the allocation.

Pekka