Re: flock(fd, LOCK_UN) taking 500ms+ ?

John Levon (levon@movementarian.org)
Wed, 2 Oct 2002 04:23:27 +0100


On Wed, Oct 02, 2002 at 03:39:01AM +0100, John Levon wrote:

> Unlock, took 541386 usecs

Hmm. This :

--- linux-linus/fs/locks.c Sat Sep 28 15:56:28 2002
+++ linux/fs/locks.c Wed Oct 2 04:15:54 2002
@@ -727,11 +727,11 @@
}
unlock_kernel();

- if (found)
- yield();
-
if (new_fl->fl_type == F_UNLCK)
return 0;
+
+ if (found)
+ yield();

lock_kernel();
for_each_lock(inode, before) {

"fixes" the problem (a simultaneous kernel compile is going on; it's a
2-way SMP machine). What is the yield for ? What's the right fix (if
any) ? This turns our app's main loop from a second or two into a
90-second behemoth.

There are no other apps taking locks on the relevant files, btw

regards
john

-- 
"I never understood what's so hard about picking a unique
 first and last name - and not going beyond the 6 character limit."
 	- Toon Moene
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/