Re: kjournald wasting CPU in invert_lock fs/jbd/commit.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2005-07-11 at 15:41 -0700, Andrew Morton wrote:
> Steven Rostedt <[email protected]> wrote:
> >
> > I noticed that the code in commit.c of the jbd system can waste CPU
> > cycles.
> 
> How did you notice?  By code inspection or by runtime observation?  If the
> latter, please share.

Argh! I just realize that this problem is really more in Ingo's RT
kernel, but I assumed that it was a problem in vanilla since the code is
more from the vanilla kernel.  With Ingo's spin_locks as mutexes, this
creates a problem on UP, but your are right, this is not a problem for
vanilla UP.


> Yeah.  But these _are_ spinlocks, so spinning is what's supposed to happen.
>  Maybe we should dump that silly schedule() and just do cpu_relax(). 
> Although I do recall once theorising that the time we spend in the
> schedule() might be preventing livelocks.
> 

As mentioned above, this was a confusion of paradigms. I just got back
from Europe, so I'm blaming this on jetlag!  

OK a cpu_relax() may be better. So here it is :-)

Signed-off-by: Steven Rostedt <[email protected]>
---
--- a/fs/jbd/commit.c	2005-07-11 17:51:37.000000000 -0400
+++ b/fs/jbd/commit.c	2005-07-11 19:05:35.000000000 -0400
@@ -87,7 +87,7 @@ static int inverted_lock(journal_t *jour
 {
 	if (!jbd_trylock_bh_state(bh)) {
 		spin_unlock(&journal->j_list_lock);
-		schedule();
+		cpu_relax();
 		return 0;
 	}
 	return 1;


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux