[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131004115021.GA7207@redhat.com>
Date: Fri, 4 Oct 2013 13:50:21 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Mel Gorman <mgorman@...e.de>, Rik van Riel <riel@...hat.com>,
Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
Ingo Molnar <mingo@...nel.org>,
Andrea Arcangeli <aarcange@...hat.com>,
Johannes Weiner <hannes@...xchg.org>,
Thomas Gleixner <tglx@...utronix.de>,
Steven Rostedt <rostedt@...dmis.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] rcu: Create rcu_sync infrastructure
On 10/04, Peter Zijlstra wrote:
>
> On Fri, Oct 04, 2013 at 01:15:13PM +0200, Oleg Nesterov wrote:
> > Of course we can fix this, but wait_for_completion/complete already
> > does the necessary work: x->done acts as a resource counter which is
> > always checked/incremented/decremented under the same lock.
>
> Urgh, so now you're not using a semaphore as completion but using a
> completion as semaphore.
Yes. And we can use it as semaphore only because we already have gp_count.
Of course, we could add ->gp_mutex and change enter/exit to lock/unlock
it if exclusive. But I do not really like it even if this can makes the
code a bit (only a little bit) simpler. This will increase sizeof() and
for no reason, I think, because to some degree this will also duplicate
the synchronization logic. And while this doesn't really matter, this
will penalize the contending writers a bit: it is not easy (but of
course possible) to take this mutex after rss->gp_count++, and we do
want to increment this counter "asap".
Oleg.
--
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