Re: [PATCH] [percpu] Make the unit size of the first chunk the same as other chunks

From: Zhihui Zhang
Date: Mon Oct 27 2014 - 19:32:53 EST


In pcpu_embed_first_chunk(), we allocate full unit size for each CPU
in the first chunk:

1981 /* allocate space for the whole group */
1982 ptr = alloc_fn(cpu, gi->nr_units * ai->unit_size,
atom_size);
1983 if (!ptr) {
1984 rc = -ENOMEM;
1985 goto out_free_areas;
1986 }


Later we freed unused part:


2009 /* copy and return the unused part */
2010 memcpy(ptr, __per_cpu_load, ai->static_size);
2011 free_fn(ptr + size_sum, ai->unit_size - size_sum);

I am trying to make each CPU to have a full unit size in the first
chunk, same as in all other chunks. Does this make sense?

-Zhihui

On Mon, Oct 27, 2014 at 10:08 AM, Tejun Heo <tj@xxxxxxxxxx> wrote:
> On Sat, Oct 25, 2014 at 11:05:58AM -0400, Zhihui Zhang wrote:
>> Since we have already allocated the full unit size for the first chunk, we might as well use
>> it so that the unit size are the same for all chunks. The page first chunk allocator already
>> has this effect because it allocates one page at a time.
>
> I'm not following. Where do we allocate the full unit size for the
> first chunk?
>
> Thanks.
>
> --
> tejun
--
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/