How to measure performance inside Kernel?

Peter Senna Tschudin peter.senna at gmail.com
Mon Feb 13 18:13:06 EST 2012


Hi Mulyadi,

> I read your code and I think kmalloc can be streamlined here. I
> recommend that kmalloc() allocate total memory needed to handle whole
> q->buf[] array. something like (CMIIW):
>
> q->buf=kmalloc(sizeof(struct vb_buffer)*q->num_buffers,GFP_KERNEL)
>
> then access q->buf[1], q->buf[2] etc.
>
struct vb2_queue {
	struct vb2_buffer		*bufs[VIDEO_MAX_FRAME];
	unsigned int			num_buffers;
};

bufs is an array of pointers to struct vb2_buffer. I was not able to
use your kmalloc code. I get incompatible types errors when trying it.
Any ideas?

-- 
Peter Senna Tschudin
peter.senna at gmail.com
gpg id: 48274C36



More information about the Kernelnewbies mailing list