net: Track start of busy loop instead of when it should end
This patch flips the logic we were using to determine if the busy polling has timed out. The main motivation for this is that we will need to support two different possible timeout values in the future and by recording the start time rather than when we would want to end we can focus on making the end_time specific to the task be it epoll or socket based polling. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
2b5cd0dfa3
commit
37056719bb
16
fs/select.c
16
fs/select.c
@@ -409,7 +409,7 @@ int do_select(int n, fd_set_bits *fds, struct timespec64 *end_time)
|
||||
int retval, i, timed_out = 0;
|
||||
u64 slack = 0;
|
||||
unsigned int busy_flag = net_busy_loop_on() ? POLL_BUSY_LOOP : 0;
|
||||
unsigned long busy_end = 0;
|
||||
unsigned long busy_start = 0;
|
||||
|
||||
rcu_read_lock();
|
||||
retval = max_select_fd(n, fds);
|
||||
@@ -512,11 +512,11 @@ int do_select(int n, fd_set_bits *fds, struct timespec64 *end_time)
|
||||
|
||||
/* only if found POLL_BUSY_LOOP sockets && not out of time */
|
||||
if (can_busy_loop && !need_resched()) {
|
||||
if (!busy_end) {
|
||||
busy_end = busy_loop_end_time();
|
||||
if (!busy_start) {
|
||||
busy_start = busy_loop_current_time();
|
||||
continue;
|
||||
}
|
||||
if (!busy_loop_timeout(busy_end))
|
||||
if (!busy_loop_timeout(busy_start))
|
||||
continue;
|
||||
}
|
||||
busy_flag = 0;
|
||||
@@ -800,7 +800,7 @@ static int do_poll(struct poll_list *list, struct poll_wqueues *wait,
|
||||
int timed_out = 0, count = 0;
|
||||
u64 slack = 0;
|
||||
unsigned int busy_flag = net_busy_loop_on() ? POLL_BUSY_LOOP : 0;
|
||||
unsigned long busy_end = 0;
|
||||
unsigned long busy_start = 0;
|
||||
|
||||
/* Optimise the no-wait case */
|
||||
if (end_time && !end_time->tv_sec && !end_time->tv_nsec) {
|
||||
@@ -853,11 +853,11 @@ static int do_poll(struct poll_list *list, struct poll_wqueues *wait,
|
||||
|
||||
/* only if found POLL_BUSY_LOOP sockets && not out of time */
|
||||
if (can_busy_loop && !need_resched()) {
|
||||
if (!busy_end) {
|
||||
busy_end = busy_loop_end_time();
|
||||
if (!busy_start) {
|
||||
busy_start = busy_loop_current_time();
|
||||
continue;
|
||||
}
|
||||
if (!busy_loop_timeout(busy_end))
|
||||
if (!busy_loop_timeout(busy_start))
|
||||
continue;
|
||||
}
|
||||
busy_flag = 0;
|
||||
|
||||
Reference in New Issue
Block a user