Re: [PATCH UPDATED 09/10] percpu: implement new dynamic percpuallocator
From: Andrew Morton
Date: Fri Feb 20 2009 - 03:38:24 EST
On Fri, 20 Feb 2009 16:30:01 +0900 Tejun Heo <tj@xxxxxxxxxx> wrote:
> Impact: new scalable dynamic percpu allocator which allows dynamic
> percpu areas to be accessed the same way as static ones
>
> Implement scalable dynamic percpu allocator which can be used for both
> static and dynamic percpu areas. This will allow static and dynamic
> areas to share faster direct access methods. This feature is optional
> and enabled only when CONFIG_HAVE_DYNAMIC_PER_CPU_AREA is defined by
> arch. Please read comment on top of mm/percpu.c for details.
>
> ...
>
> +static int pcpu_unit_pages_shift;
> +static int pcpu_unit_pages;
> +static int pcpu_unit_shift;
> +static int pcpu_unit_size;
> +static int pcpu_chunk_size;
> +static int pcpu_nr_slots;
> +static size_t pcpu_chunk_struct_size;
> +
> +/* the address of the first chunk which starts with the kernel static area */
> +void *pcpu_base_addr;
> +EXPORT_SYMBOL_GPL(pcpu_base_addr);
> +
> +/* the size of kernel static area */
> +static int pcpu_static_size;
It would be nice to document the units of the `size' variables. Bytes?
Pages?
Or, better: s/size/bytes/g.
> +static int pcpu_size_to_slot(int size)
> +{
> + int highbit = fls(size);
> + return max(highbit - PCPU_SLOT_BASE_SHIFT + 2, 1);
> +}
See,
static int pcpu_bytes_to_slot(int bytes)
{
int highbit = fls(bytes);
return max(highbit - PCPU_SLOT_BASE_SHIFT + 2, 1);
}
is clearer.
--
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/