On Tue, 2013-06-18 at 11:58 +0300, Eliezer Tamir wrote:
@@ -393,6 +394,15 @@ static inline void wait_key_set(poll_table *wait, unsigned long in,
wait->_key |= POLLOUT_SET;
}
+static inline void wait_key_set_lls(poll_table *wait, bool set)
+{
+ if (set)
+ wait->_key |= POLL_LL;
+ else
+ wait->_key &= ~POLL_LL;
+}
+
Instead of "bool set" you could use "unsigned int lls_bit"
and avoid conditional :
wait->_key |= lls_bit;
(you do not need to clear the bit in wait->_key, its already cleared in
wait_key_set())
Alternatively, add a parameter to wait_key_set(), it will be cleaner
@@ -486,6 +504,11 @@ int do_select(int n, fd_set_bits *fds, struct timespec *end_time)
break;
}
+ if (can_poll_ll(ll_time) && can_ll) {
reorder tests to avoid sched_clock() call :
if (can_ll && can_poll_ll(ll_time))
-static inline unsigned int do_pollfd(struct pollfd *pollfd, poll_table *pwait)
+static inline unsigned int do_pollfd(struct pollfd *pollfd, poll_table *pwait,
+ bool *can_ll, bool try_ll)
{
unsigned int mask;
int fd;
@@ -731,7 +755,11 @@ static inline unsigned int do_pollfd(struct pollfd *pollfd, poll_table *pwait)
mask = DEFAULT_POLLMASK;
if (f.file->f_op && f.file->f_op->poll) {
pwait->_key = pollfd->events|POLLERR|POLLHUP;
+ if (try_ll)
+ pwait->_key |= POLL_LL;
Well, why enforce POLL_LL ?
Sure we do this for select() as the API doesn't allow us to add the LL
flag, but poll() can do that.
An application might set POLL_LL flag only on selected fds.
I understand you want nice benchmarks for existing applications,
but I still think that globally enable/disable LLS for the whole host
is not a good thing.
POLL_LL wont be a win once we are over committing cpus (too many sockets
to poll)