diff options
author | Chuck Lever | 2009-12-03 15:58:56 -0500 |
---|---|---|
committer | Trond Myklebust | 2009-12-03 15:58:56 -0500 |
commit | 206a134b4d8abf57cd34dffacf993869355b9aac (patch) | |
tree | ffe4724ce1957243de3eaa2e123b25c883c53412 /include/linux/sunrpc | |
parent | dd47f96c077b4516727e497e4b6fd47a06778c0a (diff) |
SUNRPC: Check explicitly for tk_status == 0 in call_transmit_status()
The success case, where task->tk_status == 0, is by far the most
frequent case in call_transmit_status().
The default: arm of the switch statement in call_transmit_status()
handles the 0 case. default: was moved close to the top of the switch
statement in call_transmit_status() under the theory that the compiler
places object code for the earliest arms of a switch statement first,
making the CPU do less work.
The default: arm of a switch statement, however, is executed only
after all the other cases have been checked. Even if the compiler
rearranges the object code, the default: arm is the "last resort",
meaning all of the other cases have been explicitly exhausted. That
makes the current arrangement about as inefficient as it gets for the
common case.
To fix this, add an explicit check for zero before the switch
statement. That forces the compiler to do the zero check first, no
matter what optimizations it might try to do to the switch statement.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'include/linux/sunrpc')
0 files changed, 0 insertions, 0 deletions