Re: [PATCH V4 05/16] perf, core: pmu specific data for perf task context

From: Peter Zijlstra
Date: Wed Jul 02 2014 - 06:19:10 EST


On Mon, Jun 30, 2014 at 04:50:42PM +0800, Yan, Zheng wrote:

> @@ -3068,6 +3077,14 @@ alloc_perf_context(struct pmu *pmu, struct task_struct *task)
> if (!ctx)
> return NULL;
>
> + if (task && pmu->task_ctx_size > 0) {
> + ctx->task_ctx_data = kzalloc(pmu->task_ctx_size, GFP_KERNEL);
> + if (!ctx->task_ctx_data) {
> + kfree(ctx);
> + return NULL;
> + }
> + }

Can we delay this allocation until such time as that its actually
needed? Otherwise we're wasting all this memory..

Attachment: pgpKx2SaeTAfb.pgp
Description: PGP signature