Messages in this thread | | | Date | Wed, 29 Apr 2009 11:16:37 +0200 | From | Ingo Molnar <> | Subject | Re: [PATCH] poll: Avoid extra wakeups in select/poll |
| |
* Eric Dumazet <dada1@cosmosbay.com> wrote:
> @@ -418,8 +429,16 @@ int do_select(int n, fd_set_bits *fds, struct timespec *end_time) > if (file) { > f_op = file->f_op; > mask = DEFAULT_POLLMASK; > - if (f_op && f_op->poll) > + if (f_op && f_op->poll) { > + if (wait) { > + wait->key = POLLEX_SET; > + if (in & bit) > + wait->key |= POLLIN_SET; > + if (out & bit) > + wait->key |= POLLOUT_SET; > + } > mask = (*f_op->poll)(file, retval ? NULL : wait); > + } > fput_light(file, fput_needed); > if ((mask & POLLIN_SET) && (in & bit)) { > res_in |= bit;
Please factor this whole 'if (file)' branch out into a helper. Typical indentation levels go from 1 to 3 tabs - 4 should be avoided if possible and 5 is pretty excessive already. This goes to eight.
Ingo
| |