All of lore.kernel.org
 help / color / mirror / Atom feed
From: Erwan Velu <evelu@redhat.com>
To: Sage Weil <sweil@redhat.com>
Cc: "Adam C. Emerson" <aemerson@redhat.com>,
	The Sacred Order of the Squid Cybernetic
	<ceph-devel@vger.kernel.org>
Subject: Re: About ceph_clock_now()
Date: Tue, 19 Jan 2016 11:17:51 -0500 (EST)	[thread overview]
Message-ID: <1365711662.13730117.1453220271917.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.11.1601130846500.26381@cpach.fuggernut.com>

Before propagating the change to more code base and offer a PR with that, what do you think of this style ?

Is it aligned with the best-pratices of the project ?

https://gist.github.com/ErwanAliasr1/f74f7f046e9300ac2c30

Thanks,

----- Mail original -----
De: "Sage Weil" <sweil@redhat.com>
À: "Erwan Velu" <evelu@redhat.com>
Cc: "Adam C. Emerson" <aemerson@redhat.com>, "The Sacred Order of the Squid Cybernetic" <ceph-devel@vger.kernel.org>
Envoyé: Mercredi 13 Janvier 2016 14:48:00
Objet: Re: About ceph_clock_now()

On Wed, 13 Jan 2016, Erwan Velu wrote:
> >One concern with monotonic clocks, even for elapsed time, is that their epoch is
> >unspecified. You cannot send a monotonic time over the network to another
> >machine nor can you save it to a file and re-read it later. Anything to be
> >serialized must be a real time.
> 
> While speaking about ceph_clock_now(), I was more likely targeting lots of local code like
>   start = ceph_clock_now();
>   ... do_stuff ...
>   elapse_time = ceph_clock_now() - start
> 
> 
> I'm thinking of code like this in void OSD::tick_without_osd_lock():
> Starting at https://github.com/ceph/ceph/blob/master/src/osd/OSD.cc#L4009.
> 
> This code is trying to estimate if a mon is still alive by computing a difference of system time by
> doing a  "if (now - last_pg_stats_sent > max) {" where now & last_pg_stats_sent are the output of "ceph_clock_now()"
> 
> As ceph_clock_now() is using CLOCK_REALTIME, we could have cases where a simple drift caused by a NTP trigger that code.
> As we are only trying to compute a difference of absolute time (and not system time), using a MONOTONIC_* seems much more accurate at my taste.
> 
> I know that's pretty picky but that could exists.

That's a perfect example of where the monotonic time should be used. There 
are a zillion instances of this pattern that could be cleaned up... :)

> >I find it interesting. If you want to change more subsystems to use ceph_time
> >and use monotonic and coarse clocks in appropriate places I think that would be
> >wonderful. It might be worthwhile to focus on the places where we use double to
> >represent a time value.
> >Please read through ceph_time.h and osdc to get a feel for it. If you think it
> >could use improvement, I'd be happy to hear your ideas.
> 
> You mean we could switch some of ceph_clock_now() calls to ceph_time ? 
> We could use coarse_mono_clock to perform that.
> 
> If you agree that switching code like the one I'm speaking is valuable, 
> I can work on it.

That would be great!

sage

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-01-19 16:17 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <177186823.10053087.1452614184109.JavaMail.zimbra@redhat.com>
2016-01-12 15:59 ` About ceph_clock_now() Erwan Velu
2016-01-12 17:32   ` Adam C. Emerson
2016-01-13 10:41     ` Erwan Velu
2016-01-13 13:48       ` Sage Weil
2016-01-13 14:52         ` Matt Benjamin
2016-01-14 16:10         ` Erwan Velu
2016-01-14 16:14           ` Adam C. Emerson
2016-01-19 16:17         ` Erwan Velu [this message]
2016-01-19 16:29           ` Adam C. Emerson
2016-01-19 16:57             ` Erwan Velu
2016-01-21 19:22             ` Erwan Velu
2016-01-22 16:00               ` Erwan Velu
2016-01-22 17:35                 ` Adam C. Emerson
2016-01-26 14:12                   ` Erwan Velu
2016-01-23 11:49                 ` Willem Jan Withagen
2016-01-23 20:20                   ` Matt Benjamin
2016-01-23 21:55                     ` Adam C. Emerson
2016-01-24 11:53                       ` Willem Jan Withagen
2016-01-24 12:51                         ` Willem Jan Withagen
2016-01-25  0:03                           ` Adam C. Emerson
2016-01-25  9:08                             ` Willem Jan Withagen
2016-01-25  9:58                               ` Erwan Velu
2016-01-25 10:57                                 ` Willem Jan Withagen
2016-01-25 17:22                                   ` Adam C. Emerson
     [not found]                                     ` <56A66099.4030501@digiware.nl>
     [not found]                                       ` <1523354716.24670379.1453744826329.JavaMail.zimbra@redhat.com>
2016-01-25 19:38                                         ` Willem Jan Withagen
2016-01-25 20:14                                           ` Adam C. Emerson
2016-01-25 20:18                                             ` Matt Benjamin
2016-01-25 20:22                                             ` Willem Jan Withagen
2016-01-13 15:28       ` Adam C. Emerson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1365711662.13730117.1453220271917.JavaMail.zimbra@redhat.com \
    --to=evelu@redhat.com \
    --cc=aemerson@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=sweil@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.