CPU consumption due to mdelay(5) in pxp_buf_queue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CPU consumption due to mdelay(5) in pxp_buf_queue

572 Views
morenodissegna
Contributor I

Hi everyone,

I'm working on an i.MX6UltraLite processor.

I noticed a call to mdelay(5) in the pxp_buf_queue function in mxc_pxp_v4l2.c.

This function is called once per every frame that is submitted to video4linux.

This means that if I play a video @ 25fps, about 12% CPU time is spent busy waiting.

This is confirmed by running gstreamer with the perf tool.

Is this delay really needed? What is its purpose?

Labels (3)
2 Replies

492 Views
b36401
NXP Employee
NXP Employee

Actually if the process is in sleep ("S") state it does not cunsume CPU power.

0 Kudos

492 Views
morenodissegna
Contributor I

CPU is consumed because mdelay(5) causes the cpu to busy wait for 5 ms.

Please check out the kernel docs https://www.kernel.org/doc/Documentation/timers/timers-howto.txt :

These functions use the jiffie estimation of clock speed and will busy wait for enough loop cycles to achieve the desired delay
0 Kudos