[PATCH -V2 07/26] powerpc: Add size argument to pgtable_cache_add

Paul Mackerras paulus at samba.org
Wed Mar 13 13:47:25 EST 2013

On Wed, Mar 06, 2013 at 11:40:08AM +0530, Aneesh Kumar K.V wrote:
> From: "Aneesh Kumar K.V" <aneesh.kumar at linux.vnet.ibm.com>
> We will use this later with THP changes to request for pmd table of double the size.
> THP code does PTE page allocation along with large page request and deposit them
> for later use. This is to ensure that we won't have any failures when we split
> huge pages to regular pages.
> On powerpc we want to use the deposited PTE page for storing hash pte slot and
> secondary bit information for the HPTEs. Hence we save them in the second half
> of the pmd table.

That much is fine, but...

> -void pgtable_cache_add(unsigned shift, void (*ctor)(void *));
> +extern void __pgtable_cache_add(unsigned shift, unsigned long table_size,
> +				void (*ctor)(void *));
>  void pgtable_cache_init(void);
> +static inline void pgtable_cache_add(unsigned shift, void (*ctor)(void *))
> +{
> +	return __pgtable_cache_add(shift, sizeof(void *) << shift, ctor);
> +}

NAK to this (and in fact the rest of this patch).

If you need twice the size, use the next slot along in pgtable_cache,
which will give you the size you need, rather than breaking the
relationship between slot index and allocation size.


More information about the Linuxppc-dev mailing list