[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] Arm/optee: don't open-code xzalloc_flex_struct()
commit 7a2b787880bddbb3bd68b18efe1d6fe339df6ff1 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Fri May 7 10:45:14 2021 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Fri May 7 10:45:14 2021 +0200 Arm/optee: don't open-code xzalloc_flex_struct() The current use of xzalloc_bytes() in optee is nearly an open-coded version of xzalloc_flex_struct(), which was introduced after the driver was merged. The main difference is xzalloc_bytes() will also force the allocation to be SMP_CACHE_BYTES aligned and therefore avoid sharing the cache line. While sharing the cache line can have an impact on the performance, this is also true for most of the other users of x*alloc(), x*alloc_array(), and x*alloc_flex_struct(). So if we want to prevent sharing cache lines, arranging for this should be done in the allocator itself. In this case, we don't need stricter alignment than what the allocator provides. Hence replace the call to xzalloc_bytes() with one of xzalloc_flex_struct(). Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Signed-off-by: Julien Grall <julien@xxxxxxx> Acked-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx> --- xen/arch/arm/tee/optee.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c index 9570dc6771..980eebe847 100644 --- a/xen/arch/arm/tee/optee.c +++ b/xen/arch/arm/tee/optee.c @@ -529,8 +529,7 @@ static struct optee_shm_buf *allocate_optee_shm_buf(struct optee_domain *ctx, while ( unlikely(old != atomic_cmpxchg(&ctx->optee_shm_buf_pages, old, new)) ); - optee_shm_buf = xzalloc_bytes(sizeof(struct optee_shm_buf) + - pages_cnt * sizeof(struct page *)); + optee_shm_buf = xzalloc_flex_struct(struct optee_shm_buf, pages, pages_cnt); if ( !optee_shm_buf ) { err_code = -ENOMEM; -- generated by git-patchbot for /home/xen/git/xen.git#staging
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |