On Thursday 05 November 2015 19:00:36 Amitoj Kaur Chawla wrote:
On Thu, Nov 5, 2015 at 2:44 PM, Arnd Bergmann arnd@arndb.de wrote:
That works, but why not keep the code as it is here? ktime_get_seconds() still adds a little overhead if we call it unconditionally, and the author of the original code apparently felt that it was worth optimizing for.
Oh okay, I sent a v2 thinking that the removal of if condition would work. But since you're saying that the optimising seems necessary. I'll change it to u64 timestamp; if (fcport->stats_status == BFA_STATUS_OK) timestamp = ktime_get_seconds();
Is this fine?
Yes, that looks ok. I'd probably use 'time64_t' instead of 'u64', and 'long' would also work just as well here because it is monotonic time.
Regarding the optimization, I think it is not an important one and it could indeed be removed, but only if you can prove that the code without the optimization is as efficient in practice, and explain that in the changelog text. It's usually easier not to change it then, so you don't have to spend the time figuring out whether that is an improvement or not.
Arnd