[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070721150547.GA23560@elte.hu>
Date: Sat, 21 Jul 2007 17:05:47 +0200
From: Ingo Molnar <mingo@...e.hu>
To: Oleg Nesterov <oleg@...sign.ru>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Alexey Kuznetsov <kuznet@....inr.ac.ru>,
Eric Dumazet <dada1@...mosbay.com>,
Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ulrich Drepper <drepper@...hat.com>,
linux-kernel@...r.kernel.org,
Arnaldo Carvalho de Melo <acme@...driva.com>
Subject: Re: [PATCH] pi-futex: set PF_EXITING without taking ->pi_lock
* Oleg Nesterov <oleg@...sign.ru> wrote:
> static inline void ccids_read_lock(void)
> {
> atomic_inc(&ccids_lockct);
> spin_unlock_wait(&ccids_lock);
> }
>
> This looks racy, in theory atomic_inc() and spin_unlock_wait() could
> be re-ordered. However, in this particular case we have an "optimized"
> smp_mb_after_atomic_inc(), perhaps it is good that the caller can
> choose the "right" barrier by hand.
_all_ default locking and atomic APIs should be barrier-safe i believe.
(and that includes atomic_inc() too) Most people dont have barriers on
their mind when their code. _If_ someone is barrier-conscious then we
should have barrier-less APIs too for that purpose of squeezing the last
half cycle out of the code, but it should be a non-default choice. The
reason: nobody notices an unnecessary barrier, but a missing barrier can
be nasty.
Ingo
-
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