Re: [RFC/PATCH 2/2] mm, slob: Save real allocated size in page->private

Ezequiel Garcia
2012-08-14T15:07:00Z

Hi Christoph,

Thanks for your comments.

On Tue, Aug 14, 2012 at 11:56 AM, Christoph Lameter <cl@linux.com> wrote:
> On Tue, 14 Aug 2012, Ezequiel Garcia wrote:
>
>> As documented in slob.c header, page->private field is used to return
>> accurately the allocated size, through ksize().
>> Therefore, if one allocates a contiguous set of pages the available size
>> is PAGE_SIZE << order, instead of the requested size.
>
> I would prefer if you would remove this strange feature from slob. The
> ksize for a !PageSlab() "slab" page is always PAGE_SIZE << compound_order(page).
> There is no need to use page->private here. It is a bad practice to not
> mark a page as a slab page but then use fields for special purposes.
>

Mmm, I see. Sounds sensible.
Fortunately I don't have to squeeze my brain thinking,
since I have a nice example of this in slub's ksize().

if (unlikely(!PageSlab(page))) {
WARN_ON(!PageCompound(page));
return PAGE_SIZE << compound_order(page);
}

I'll resend this patch alone with implementing something like
it and removing page->private usage.

Thanks again!
Ezequiel.