]> git.tuebingen.mpg.de Git - paraslash.git/commit
sched: Optimize the case of zero timeouts.
authorAndre Noll <maan@systemlinux.org>
Thu, 21 Jul 2011 17:59:46 +0000 (19:59 +0200)
committerAndre Noll <maan@systemlinux.org>
Sat, 30 Jul 2011 18:27:55 +0000 (20:27 +0200)
commit5d432a27b1e32bf8591d3ea68329c1b1d5bccc1d
tree097b247b24f55fffdbf0ab3e98121abc3d9c7b10
parent7544e25415144894b58e48ab17de21a693ea00c7
sched: Optimize the case of zero timeouts.

If a pre_select method calls sched_min_delay() there is no
point in calling the pre_select hooks of the other tasks since
these can not decrease the timeout any further, and adding file
descriptors to the fd sets makes no sense either. So we may
break out early in sched_preselect() in this case.

If the timeout is zero we may even omit the entire select call as
well as the subsequent gettimeofday() since select() will return
immediately anyway. This patch teaches sched_postselect() to do so
which saves at least two system calls (plus locking in case of
para_server) in a rather hot path.
sched.c