Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Apr 2013 22:39:12 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Pawel Jakub Dawidek <pjd@FreeBSD.org>
Cc:        freebsd-hackers@FreeBSD.org, Alexander Motin <mav@FreeBSD.org>, freebsd-geom@FreeBSD.org
Subject:   Re: devstat overhead VS precision
Message-ID:  <20130415193912.GS2930@kib.kiev.ua>
In-Reply-To: <20130415193730.GB1839@garage.freebsd.pl>
References:  <51692C95.3010901@FreeBSD.org> <20130415184203.GA1839@garage.freebsd.pl> <20130415191815.GR2930@kib.kiev.ua> <20130415193730.GB1839@garage.freebsd.pl>

next in thread | previous in thread | raw e-mail | index | archive | help

--qxmd2aOE9n9J83EO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Apr 15, 2013 at 09:37:30PM +0200, Pawel Jakub Dawidek wrote:
> On Mon, Apr 15, 2013 at 10:18:15PM +0300, Konstantin Belousov wrote:
> > On Mon, Apr 15, 2013 at 08:42:03PM +0200, Pawel Jakub Dawidek wrote:
> > > On a mostly unrelated note when two threads (T0 and T1) call get*time=
()
> > > on two different cores, but T0 does that a bit earlier is it possible
> > > that T0 can get later time than T1?
> >=20
> > Define earlier first.
> >=20
> > If you have taken sufficient measures to prevent preemption and interru=
ption,
> > e.g. by entering spinlock before the fragment that calls get*, then no,
> > it is impossible, at least not with any x86 timekeeping hardware we use.
> >=20
> > On the other hand, if interrupts are allowed, all bets are off.
>=20
> So if we consider only one thread, it is not possible for it to obtain
> time t0, be scheduled to different CPU and obtain t1 where t1 < t0?

Yes, I believe this scenario is also not possible. The context switching
ensures that thread's view on the global memory is consistent. At least
it is so on x86, and I think it must be the same on all other architectures.
Otherwise the compiler emited code would not work.

--qxmd2aOE9n9J83EO
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (FreeBSD)

iQIcBAEBAgAGBQJRbFdgAAoJEJDCuSvBvK1BHHwP/3jWyITU2jLV7rr4PL9byXPW
5It47gDGungmtlGIiPj7s5t9Apq4DvZ9G7kBNvR/1FjATVPbXa9TPvo6t8qqGrEm
7CIq72pt6B0BcxwBLD3cLDU6qQfm5hMu5VkJqKFGg/LpWzKkHOvGt2ostDEY5N79
WQldd1wJsRp25SsFChsb/z9RXBKIcCJvc3ukUxTQAblaIIoQ3dThUpVv+pN5/pl/
yj2URn44dQTJkNNQw4mUN72PHf66wFeYpw3I2U8Lr1LMdl/2PGuM4gbancjeGSp3
md7EoKrGll6/8lH58X4aVgHDjbqD7/ccDCn8yNok2FwaDSyiuUqUPyYTGIiCExgm
Ni+71fyyL9wFd79n93ovC6LrqwaB8Lvn8fOydGp8ZPIRDRl0d+dEbhD8FUaaCaUk
wl0TmhOZVarWJBstiOunWHlVeLkltcSdfV9X8gyp0ThFJZfM9nbgPdMdawRaIQ+v
H1lWbXBhAFA+kwwM2zZSf1YiOvUGVbjf/Y0XSR6i6rSmhjJl2QA9BYX/Gr60I1Fg
hQr9JlBsLOCZbqNX7f4KdjucVOjKLsdDyk10on4pGYIQXHCmNO28bhNiKxiqYMkP
aYervPFifouuO9LvcGkQqD1XIJH4mQfSKLQtkTpKd44Sf1avoqHFu37SYp3+Fu51
eq5VSCa48ydDx69Wujek
=KrTY
-----END PGP SIGNATURE-----

--qxmd2aOE9n9J83EO--



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