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

Re: [PATCH 11/11] Arm/optee: don't open-code xzalloc_flex_struct()



On 13.04.2021 20:19, Julien Grall wrote:
> On 08/04/2021 13:23, Jan Beulich wrote:
>> There is a difference in generated code: xzalloc_bytes() forces
>> SMP_CACHE_BYTES alignment. I think we not only don't need this here, but
>> actually don't want it.
> 
> So I think moving to xmalloc_flex_struct() is a pretty good move. But I 
> am actually a bit confused with the argument used.
> 
> Could you provide some details why you think forcing the array to be 
> aligned to the maximum cache line supported (128 bytes on Arm) is wrong?

It is not "wrong" in that sense, but if this is intended it shouldn't
be arranged via use of xmalloc_bytes(). As also pointed out in a
similar discussion on another sub-thread, imo xmalloc_bytes(), being
type-unsafe, should go away altogether mid-term. If individual callers
have specific alignment requirements (which ought to be the exception),
they should explicitly request the needed alignment. If architectures
would prefer all allocations to have certain minimum alignment (e.g.
to avoid cacheline sharing, which was Andrew's argument) or other
"arrangement" (alignment by itself may not be that interesting due to
the bhdr placed ahead of the allocation), it should be the allocator
itself that provides for this, not individual callers.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.