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..