Re: [PATCH 1/2] brw_mutex: big read-write mutex
From: Oleg Nesterov
Date: Wed Oct 17 2012 - 12:58:02 EST
On 10/16, Linus Torvalds wrote:
>
> On Mon, Oct 15, 2012 at 12:10 PM, Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
> > This patch adds the new sleeping lock, brw_mutex. Unlike rw_semaphore
> > it allows multiple writers too, just "read" and "write" are mutually
> > exclusive.
>
> So those semantics just don't sound sane. It's also not what any kind
> of normal "rw" lock ever does.
Yes, this is not usual.
And initially I made brw_sem which allows only 1 writer, but then
I changed this patch.
> So can you explain why these particular insane semantics are useful,
> and what for?
To allow multiple uprobe_register/unregister at the same time. Mostly
to not add the "regression", currently this is possible.
It is not that I think this is terribly important, but still. And
personally I think that "multiple writers" is not necessarily insane
in general. Suppose you have the complex object/subsystem, the readers
can use a single brw_mutex to access it "lockless", start_read() is
very cheap.
But start_write() is slow. Multiple writes can use the fine-grained
inside the start_write/end_write section and do not block each other.
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/