Re: [ANNOUNCE] 3.10.6-rt3

From: Steven Rostedt
Date: Tue Aug 20 2013 - 10:07:01 EST


On Tue, 20 Aug 2013 09:14:15 +0200
Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> wrote:

> On 08/20/2013 03:02 AM, Steven Rostedt wrote:
> > Looking at it more, I can now see why they did what they did.
>
> He is the only user in the whole kernel. It is somehow hard to believe
> that it can't be solved differently.
>

Perhaps. But if I understand the code, this is what they have.

When a request is sent out, the writes must wait till it is complete
before it can do anything, thus the writers wait. When the request
finishes (by a different thread), it releases the reader, then the
writers can continue.

The problem is that the task that sends the request does not wait for
it to finish. But until the request does finish, all writers must wait.
To complicate the matter, it appears that more than one request can be
in transition at a time. That is, its not just a single request the a
writer must wait for, it could be many.

The only way I can think of at the moment to fix this without
non-owner, is to set up a wait queue, and a ref count. Basically have
this:

writer:

again:
down_write(lock);
if (refcount) {
up_write(lock);
wait_event(wq, !refcount);
goto again;
}

reader:
down_read(lock);
refcount++;
request();
up_read(lock);

completion:

down_read(lock);
refcount--;
up_read_(lock);

The refcount would need to be an atomic, but I think this would work.

Maybe I'll submit it to get rid of the one user of non_owner().

-- Steve
--
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/