tech-userlevel archive

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

Re: malloc, thread and alignment



On Fri, Mar 27, 2015 at 04:46:51PM +0000, Emmanuel Dreyfus wrote:
> On Fri, Mar 27, 2015 at 04:38:56PM +0000, Taylor R Campbell wrote:
> > Someone^TM should document the kernel CACHE_LINE_SIZE, coherency_unit,
> > COHERENCY_UNIT, and figure out what it is worthwhile to expose MI to
> > userland.  
> 
> Shouldn't malloc take care of that stuff, and enforce a minimal allocation
> size based on hardware requirement? e.g.: you request one byte, malloc
> allocates a chunk of 32 bytes. 

Why should it? That would seriously waste memory for questionable gains
in concurrent work loads. It is sad that malloc has to honour maximal
alignment of a platform for allocations smaller too small to have a type
requiring them in it, but wasting more space is much more likely to hurt
a lot programs than the reverse.

Joerg


Home | Main Index | Thread Index | Old Index