Fix performance regression on lmbench select benchmark
Christian Borntraeger reported that reinstating cond_resched() with CONFIG_PREEMPT caused a performance regression on lmbench: For example select file 500: 23 microseconds 32 microseconds and that's really because we totally unnecessarily do the cond_resched() in the innermost loop of select(), which is just silly. This moves it out from the innermost loop (which only ever loops ove the bits in a single "unsigned long" anyway), which makes the performance regression go away. Reported-and-tested-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
481c5346d0
commit
55d8538498
|
@ -249,7 +249,6 @@ int do_select(int n, fd_set_bits *fds, s64 *timeout)
|
||||||
retval++;
|
retval++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cond_resched();
|
|
||||||
}
|
}
|
||||||
if (res_in)
|
if (res_in)
|
||||||
*rinp = res_in;
|
*rinp = res_in;
|
||||||
|
@ -257,6 +256,7 @@ int do_select(int n, fd_set_bits *fds, s64 *timeout)
|
||||||
*routp = res_out;
|
*routp = res_out;
|
||||||
if (res_ex)
|
if (res_ex)
|
||||||
*rexp = res_ex;
|
*rexp = res_ex;
|
||||||
|
cond_resched();
|
||||||
}
|
}
|
||||||
wait = NULL;
|
wait = NULL;
|
||||||
if (retval || !*timeout || signal_pending(current))
|
if (retval || !*timeout || signal_pending(current))
|
||||||
|
|
Loading…
Reference in New Issue