[Cbe-oss-dev] [patch 07/10] spufs: add kernel support for spu task

Sebastian Siewior cbe-oss-dev at ml.breakpoint.cc
Thu Aug 30 20:00:06 EST 2007


* Arnd Bergmann | 2007-08-29 22:07:40 [+0200]:

>> +	ret = -ENOMEM;
>> +	kctx = kzalloc(sizeof *kctx, GFP_KERNEL);
>> +	if (!kctx)
>> +		goto err;
>> +
>> +	kctx->qlen = 0;
>> +	kctx->spu_code = spu_code;
>> +	init_waitqueue_head(&kctx->newitem_wq);
>> +	spin_lock_init(&kctx->queue_lock);
>> +	INIT_LIST_HEAD(&kctx->work_queue);
>> +	kctx->notify_cb_info = kzalloc(sizeof(*kctx->notify_cb_info) *
>> +			(kctx->spu_code->queue_mask + 1), GFP_KERNEL);
>
>You can do a single allocation here, to make the cleanup logic simpler.

So I attach the second allocation to the bootom of the first one right?
If so, than
- I though that's odd
- the first allocation is about 80 bytes, the second is 2048 bytes. The
  latter should fit exactly into one slab.

Now, If I mix them together then I allocate 2136 bytes which are
allocated from size-4096 leaving the remaining 1960 bytes unused. Is
that right or my misunderstanding?

>	Arnd <><



More information about the cbe-oss-dev mailing list