Re: [RFC] per thread page reservation patch

From: Christoph Hellwig
Date: Fri Jan 07 2005 - 16:14:46 EST


On Sat, Jan 08, 2005 at 12:00:00AM +0300, Nikita Danilov wrote:
> I don't see how this can work.
>
> /* make conservative estimation... */
> perthread_pages_reserve(100, GFP_KERNEL);
>
> /* actually, use only 10 pages during atomic operation */
>
> /* want to release remaining 90 pages... */
> perthread_pages_release(???);
>
> Can you elaborate how to calculate number of pages that has to be
> released?

That's a good question actually, and it's true for the original
version aswell if we want (and to make the API useful we must) make
it useable for multiple callers in the same thread.

Assuming the callers strictly nest we can indeed just go back to the
orininal count, maybe with an API like:

int perthread_pages_reserve(unsigned int nrpages, unsigned int gfp_mask);
void perthread_pages_release(unsigned int nrpages_goal);


unsigned int old_nr_pages;

...

old_nr_pages = perthread_pages_reserve(100, GFP_KERNEL);

...

perthread_pages_release(old_nr_pages);

-
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/