Re: [RFC] per thread page reservation patch

From: Nikita Danilov
Date: Fri Jan 07 2005 - 16:09:41 EST


Christoph Hellwig <hch@xxxxxxxxxxxxx> writes:

> On Fri, Jan 07, 2005 at 11:48:58PM +0300, Nikita Danilov wrote:
>> sufficient to create and use per-thread reservations. Using
>> current->private_pages_count directly
>>
>> - makes API less uniform, not contained within single namespace
>> (perthread_pages_*), and worse,
>>
>> - exhibits internal implementation detail to the user.
>
> Completely disagreed, hiding all the details doesn't help for such
> trivial access, it's just obsfucating things.
>
> But looking at it the API doesn't make sense at all. Number of pages
> in the thread-pool is an internal implementation detail and no caller
> must look at it - think about two callers, e.g. filesystem and iscsi
> initiator using it in the same thread.
>
> Here's an updated patch with my suggestions implemented and other goodies
> such a kerneldoc comments (but completely untested so far):
>
>
> --- 1.20/include/linux/gfp.h 2005-01-05 18:30:39 +01:00
> +++ edited/include/linux/gfp.h 2005-01-07 20:30:20 +01:00
> @@ -130,6 +130,9 @@
> #define __free_page(page) __free_pages((page), 0)
> #define free_page(addr) free_pages((addr),0)
>
> +extern int perthread_pages_reserve(unsigned int nrpages, unsigned int gfp_mask);
> +extern void perthread_pages_release(unsigned int nrpages);

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?

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