Re: [PATCH 1/2] percpu: make @dyn_size always mean min dyn_size in first chunk init functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On 06/18/2010 08:03 PM, Christoph Lameter wrote:
>> Yeah, something like that but I would add some buffer there for
>> alignment and whatnot.
> 
> Only the percpu allocator would know the waste for alignment and
> "whatnot". What would you like me to add to the above formula to make it
> safe?

I'm not sure, some sensible slack.  :-)

>>> What is the role of SLOTS?
>>
>> It's allocation map.  Each consecutive allocs consume one if alignment
>> doesn't require padding but two if it does.  ie. It limits how many
>> items one can allocate.
>>
>>> Each kmem_cache_cpu structure is a separate percpu allocation.
>>
>> If it's a single item.  Nothing to worry about.
> 
> ok so
> 
> BUILD_BUG_ON(SLUB_PAGE_SHIFT * <fuzz-factor> > SLOTS);
> 
> I dont know what fuzz factor would be needed.
> 
> Maybe its best to have a macro provided by percpu?
> 
> VERIFY_EARLY_ALLOCS(<nr-of-allocs>,<total-size-consumed>)
> 
> The macro would generate the proper BUILD_BUG_ON?

The problem is that alignment of each item and their allocation order
also matter.  Even the percpu allocator itself can't tell for sure
before actually allocating it.  As it's gonna be used only by the slab
allocator at least for now && those preallocated areas aren't wasted
anyway, just giving it enough should work good enough, I think.  Say,
multiply everything by two.

Thanks.

-- 
tejun

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]