Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Feb 2017 18:13:54 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Alexander Kabaev <kabaev@gmail.com>
Cc:        Alexander Kabaev <kan@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r313040 - head/sys/mips/include
Message-ID:  <20170201161354.GF2092@kib.kiev.ua>
In-Reply-To: <20170201103842.1ad0989f@kan>
References:  <201702010500.v1150YLR075051@repo.freebsd.org> <20170201141721.GB2092@kib.kiev.ua> <20170201103842.1ad0989f@kan>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Feb 01, 2017 at 10:38:42AM -0500, Alexander Kabaev wrote:
> On Wed, 1 Feb 2017 16:17:21 +0200
> Konstantin Belousov <kostikbel@gmail.com> wrote:
> 
> > Please do not retry on sc failure, return the error to upper layer.
> > See also r313007 and preceeding discussion after r312973.
> 
> There was not much a discussion there, do you mind expanding a bit on
> why one behavior is more desired than other? I am not against the
> change, but I need to understand the reasoning behind it better. Since
> atomic_cmpset retries too, it will have to be adjusted as well.

atomic_cmpset() cannot avoid retry on the ll/sc architectures, because
sc might fail even if the old and the new values are same. One of the
points of the fcmpset API design is to avoid nested loops: this is a
microoptimization to put less pressure on the CPUs frontend. The caller
of (f)cmpset must check for failure anyway, so not doing this inside the
function reduces number of branches. Less branches makes code shorter,
and reduces utilization of some CPU resources, like branch predictor
state.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170201161354.GF2092>