On Sunday 13 July 2003 04:05, Gregor Lawatscheck wrote:
> At 19:17 12/07/2003, you wrote:
> >[...]
> >I'll check what causes this high load as soon as I
> >get oprofile running on my machine. ;-)

Well, I found the reason for the high cpu load:
i2c_busy_rise_and_fall (saa7146.c) uses mdelay calls, i.e. busy-waiting.
Normally this is no problem, but it consumes 30% of the cpu power when 
the frontend thread is unable to tune...

@Michael:
Are ms-delays really required?
After I applied the following patch the cpu load dropped to 3%:

--- saa7146.c.org       Mon Nov 18 22:18:46 2002
+++ saa7146.c   Sun Jul 13 06:06:22 2003
@@ -1275,7 +1275,7 @@
        hprintk("saa7146: ==> i2c_busy_rise_and_fall\n");
 
        /* wait until busy-flag rises */
-       for (i = 5; i > 0; i--) {
+       for (i = 1; i > 0; i--) {
 
                hprintk("saa7146: i2c_busy_rise_and_fall; rise wait %d\n",i);
 
@@ -1286,8 +1286,8 @@
                        break;
 
                /* see if anything can be done while we're waiting */
-               cond_resched ();
-               mdelay(1);
+               current->state = TASK_INTERRUPTIBLE;
+               schedule_timeout(1);            
        }
 
        /* we don't check the i-value, since it does not matter
@@ -1296,7 +1296,7 @@
           after an i2c-command has been written out */ 
        
        /* wait until busy-flag is inactive or error is reported */
-       for (i = timeout; i > 0; i--) {
+       for (i = timeout/10; i > 0; i--) {
        
                hprintk("saa7146: i2c_busy_rise_and_fall; fall wait %d\n",i);
 
@@ -1311,9 +1311,8 @@
                        break;
 
                /* see if anything can be done while we're waiting */
-               cond_resched ();
-
-               mdelay(1);
+               current->state = TASK_INTERRUPTIBLE;
+               schedule_timeout(1);                    
        }
        
        /* did a timeout occur ? */
.

Oliver


-- 
Info:
To unsubscribe send a mail to [EMAIL PROTECTED] with "unsubscribe linux-dvb" as 
subject.

Reply via email to