[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4C607608.8080305@genband.com>
Date: Mon, 09 Aug 2010 15:41:28 -0600
From: Chris Friesen <chris.friesen@...band.com>
To: Rob Donovan <rob@...ivrc.com>
CC: linux-kernel@...r.kernel.org
Subject: Re: FCNTL Performance problem
On 08/08/2010 01:26 PM, Rob Donovan wrote:
> The problem is, when you have lots of F_RDLCK locks being created and
> released, then it slows down any F_WRLCK with F_SETLKW locks massively.
> Is there anything that can possibly be done in the kernel to help this, as I
> would have thought this could cause problems with other people?
>
> One possible solution would be that when the write lock tries to get a lock
> and cant, its actually puts its lock in a queue of some kind, so that the
> other reads that are about to start can see that, and they 'queue' and wait
> for the write lock first.. I'm obviously not a kernel coder, so I have no
> idea of the effects of something like that, hence this post.
What you're seeing is classical "reader priority" behaviour. The
alternative is "writer priority". I don't think POSIX specifies which
behaviour to use, so it's up to the various implementations.
If you really need writer priority, how about building your own lock
object in userspace on top of fcntl locks?
--
Chris Friesen
Software Developer
GENBAND
chris.friesen@...band.com
www.genband.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists