Skip to contentSkip to conversation

ktime: Get rid of the union

tip:timers/urgent Peter Zijlstra 3 participants 4 messages Jan 3, 2017 – Jan 4, 2017 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 9 lines · tip-bot for Thomas Gleixner
Commit-ID:  64dac5c9e0f5a933e4520f0cb689b7b143925207
Gitweb:     http://git.kernel.org/tip/64dac5c9e0f5a933e4520f0cb689b7b143925207
Author:     Thomas Gleixner <[email protected]>
AuthorDate: Sun, 25 Dec 2016 11:38:40 +0100
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Sun, 25 Dec 2016 13:11:50 +0100

ktime: Get rid of the union

Quoted 7 lines

ktime is a union because the initial implementation stored the time in scalar nanoseconds on 64 bit machine and in a endianess optimized timespec variant for 32bit machines. The Y2038 cleanup removed the timespec variant and switched everything to scalar nanoseconds. The union remained, but become completely pointless.

Get rid of the union and just keep ktime_t as simple typedef of type s64.

All good stuff. One question that remains is why keep the type while removing the cycles_t type?

#2 lore raw
Quoted 16 lines · Peter Zijlstra
Quoted 15 lines · tip-bot for Thomas Gleixner
Commit-ID:  64dac5c9e0f5a933e4520f0cb689b7b143925207
Gitweb:     http://git.kernel.org/tip/64dac5c9e0f5a933e4520f0cb689b7b143925207
Author:     Thomas Gleixner <[email protected]>
AuthorDate: Sun, 25 Dec 2016 11:38:40 +0100
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Sun, 25 Dec 2016 13:11:50 +0100

ktime: Get rid of the union

ktime is a union because the initial implementation stored the time in scalar nanoseconds on 64 bit machine and in a endianess optimized timespec variant for 32bit machines. The Y2038 cleanup removed the timespec variant and switched everything to scalar nanoseconds. The union remained, but become completely pointless.

Quoted 4 lines
Quoted 1 line

Get rid of the union and just keep ktime_t as simple typedef of type s64.

All good stuff. One question that remains is why keep the type while removing the cycles_t type?

That would have been a massive surgery which I was not able to pull off on top of the other changes.

Thanks,

tglx

#3 lore raw
Quoted 9 lines · Thomas Gleixner
Quoted 4 lines · Peter Zijlstra
Quoted 1 line

Get rid of the union and just keep ktime_t as simple typedef of type s64.

All good stuff. One question that remains is why keep the type while removing the cycles_t type?

That would have been a massive surgery which I was not able to pull off on top of the other changes.

And the reason ktime needs be s64 is because 0 is at boot, and we need to represent time before boot, right? Might want to stick that in a comment somewhere near that typedef, so I don't keep asking this ;-)

#4 lore raw

2017-01-04 10:39 GMT+01:00 Peter Zijlstra <[email protected]>:

Quoted 8 lines · Thomas Gleixner
Quoted 7 lines · Peter Zijlstra
Quoted 5 lines
Quoted 2 lines

Get rid of the union and just keep ktime_t as simple typedef of type s64.

All good stuff. One question that remains is why keep the type while removing the cycles_t type?

Quoted 6 lines
Quoted 2 lines

That would have been a massive surgery which I was not able to pull off on top of the other changes.

And the reason ktime needs be s64 is because 0 is at boot, and we need to represent time before boot, right? Might want to stick that in a comment somewhere near that typedef, so I don't keep asking this ;-)

Aaah, that confused me as well :-)