|| ||Linus Torvalds <torvalds-AT-linux-foundation.org> |
|| ||Andreas Schwab <schwab-AT-redhat.com> |
|| ||Re: Q: sys_futex() && timespec_valid() |
|| ||Mon, 28 Jun 2010 09:04:41 -0700|
|| ||Ulrich Drepper <drepper-AT-redhat.com>,
Thomas Gleixner <tglx-AT-linutronix.de>,
Darren Hart <dvhltc-AT-us.ibm.com>, Ingo Molnar <mingo-AT-elte.hu>,
Peter Zijlstra <a.p.zijlstra-AT-chello.nl>,
Danny Feng <dfeng-AT-redhat.com>,
Jakub Jelinek <jakub-AT-redhat.com>, linux-kernel-AT-vger.kernel.org,
Oleg Nesterov <oleg-AT-redhat.com>|
|| ||Article, Thread
On Mon, Jun 28, 2010 at 8:29 AM, Andreas Schwab <email@example.com> wrote:
> Linus Torvalds <firstname.lastname@example.org> writes:
>> We know it's not a valid absolute timeout, since there's no way
>> somebody is "waiting" for something that happened in the sixties.
> Should it reject timestamps from the seventies?
Conceptually, we could certainly say "any timeouts from before the
boot of the machine are obviously bogus". It would be stupid and
complicated, and it would be a total pain for anybody who wants to do
migration or anything like that, so we shouldn't do it, but I could
imagine some system that rejected such timeouts as "crazy".
At the same time, for us, there's simply no _reason_ to do that. A
positive time_t value is well-defined. In contrast, a negative tv_sec
value is inherently suspect. Traditionally, you couldn't even know if
time_t was a signed quantity to begin with! And on 32-bit machines, a
negative time_t is quite often the result of overflow (no, you don't
have to get to 2038 to see it - you can get overflows from simply
doing large relative timeouts etc).
So there is no _reason_ to reject timestamps from the seventies. Why
would we care about a specific date? In contrast, negative timestamps
make no sense for absolute timeouts, and they are inherently much less
trustworthy. So it's not about 1970 per se, it's more an issue about
the fundamental representation of time.
In other words, think of negative tv_sec values as a "hmm, I wonder
what the thing is thinking - let's reject it, because I don't want to
guess what the heck is wrong with this guy".
And it's also what we've apparently been doing for a long time, so
changing it had better had some serious reason.
There are certainly cases where negative tv_sec makes sense. Dates on
files, things like that. But why would it make sense to have a
negative tv_sec for an absolute timeout? (Side note: for a _relative_
timeout a negative value makes much more sense: it happens quite
naturally when you end up subtracting two times from each other - but
Ulrich seems to explicitly want negative time for the case where it
makes _less_ sense)
to post comments)