aboutsummaryrefslogtreecommitdiffstats
path: root/fs/select.c
diff options
context:
space:
mode:
authorEliezer Tamir <eliezer.tamir@linux.intel.com>2013-07-09 06:09:21 -0400
committerDavid S. Miller <davem@davemloft.net>2013-07-09 15:33:04 -0400
commit76b1e9b9813e412bde7446525f6c299803713545 (patch)
treef062c481d287f1c3b186a9ede8d61abffcf06f8f /fs/select.c
parentcbf55001b2ddb814329735641be5d29b08c82b08 (diff)
net/fs: change busy poll time accounting
Suggested by Linus: Changed time accounting for busy-poll: - Make it microsecond based. - Use unsigned longs. - Revert back to use time_after instead of time_in_range. Reorder poll/select busy loop conditions: - Clear busy_flag after one time we can't busy-poll. - Only init busy_end if we actually are going to busy-poll. Added one more missing need_resched() test. Signed-off-by: Eliezer Tamir <eliezer.tamir@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'fs/select.c')
-rw-r--r--fs/select.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/fs/select.c b/fs/select.c
index 25cac5faf6d6..50a804b6839f 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -403,8 +403,7 @@ int do_select(int n, fd_set_bits *fds, struct timespec *end_time)
403 int retval, i, timed_out = 0; 403 int retval, i, timed_out = 0;
404 unsigned long slack = 0; 404 unsigned long slack = 0;
405 unsigned int busy_flag = net_busy_loop_on() ? POLL_BUSY_LOOP : 0; 405 unsigned int busy_flag = net_busy_loop_on() ? POLL_BUSY_LOOP : 0;
406 u64 busy_start = busy_loop_start_time(busy_flag); 406 unsigned long busy_end = 0;
407 u64 busy_end = busy_loop_end_time();
408 407
409 rcu_read_lock(); 408 rcu_read_lock();
410 retval = max_select_fd(n, fds); 409 retval = max_select_fd(n, fds);
@@ -506,9 +505,15 @@ int do_select(int n, fd_set_bits *fds, struct timespec *end_time)
506 } 505 }
507 506
508 /* only if found POLL_BUSY_LOOP sockets && not out of time */ 507 /* only if found POLL_BUSY_LOOP sockets && not out of time */
509 if (!need_resched() && can_busy_loop && 508 if (can_busy_loop && !need_resched()) {
510 busy_loop_range(busy_start, busy_end)) 509 if (!busy_end) {
511 continue; 510 busy_end = busy_loop_end_time();
511 continue;
512 }
513 if (!busy_loop_timeout(busy_end))
514 continue;
515 }
516 busy_flag = 0;
512 517
513 /* 518 /*
514 * If this is the first loop and we have a timeout 519 * If this is the first loop and we have a timeout
@@ -780,9 +785,7 @@ static int do_poll(unsigned int nfds, struct poll_list *list,
780 int timed_out = 0, count = 0; 785 int timed_out = 0, count = 0;
781 unsigned long slack = 0; 786 unsigned long slack = 0;
782 unsigned int busy_flag = net_busy_loop_on() ? POLL_BUSY_LOOP : 0; 787 unsigned int busy_flag = net_busy_loop_on() ? POLL_BUSY_LOOP : 0;
783 u64 busy_start = busy_loop_start_time(busy_flag); 788 unsigned long busy_end = 0;
784 u64 busy_end = busy_loop_end_time();
785
786 789
787 /* Optimise the no-wait case */ 790 /* Optimise the no-wait case */
788 if (end_time && !end_time->tv_sec && !end_time->tv_nsec) { 791 if (end_time && !end_time->tv_sec && !end_time->tv_nsec) {
@@ -834,9 +837,15 @@ static int do_poll(unsigned int nfds, struct poll_list *list,
834 break; 837 break;
835 838
836 /* only if found POLL_BUSY_LOOP sockets && not out of time */ 839 /* only if found POLL_BUSY_LOOP sockets && not out of time */
837 if (!need_resched() && can_busy_loop && 840 if (can_busy_loop && !need_resched()) {
838 busy_loop_range(busy_start, busy_end)) 841 if (!busy_end) {
839 continue; 842 busy_end = busy_loop_end_time();
843 continue;
844 }
845 if (!busy_loop_timeout(busy_end))
846 continue;
847 }
848 busy_flag = 0;
840 849
841 /* 850 /*
842 * If this is the first loop and we have a timeout 851 * If this is the first loop and we have a timeout