]> Pileus Git - ~andy/linux/blobdiff - fs/select.c
ARM: 7791/1: a.out: remove partial a.out support
[~andy/linux] / fs / select.c
index 25cac5faf6d69a4aea55eb3408b544afc104920f..35d4adc749d9616f4bb2a7cd6d952eb18b5579b4 100644 (file)
@@ -27,7 +27,8 @@
 #include <linux/rcupdate.h>
 #include <linux/hrtimer.h>
 #include <linux/sched/rt.h>
-#include <net/ll_poll.h>
+#include <linux/freezer.h>
+#include <net/busy_poll.h>
 
 #include <asm/uaccess.h>
 
@@ -237,7 +238,8 @@ int poll_schedule_timeout(struct poll_wqueues *pwq, int state,
 
        set_current_state(state);
        if (!pwq->triggered)
-               rc = schedule_hrtimeout_range(expires, slack, HRTIMER_MODE_ABS);
+               rc = freezable_schedule_hrtimeout_range(expires, slack,
+                                                       HRTIMER_MODE_ABS);
        __set_current_state(TASK_RUNNING);
 
        /*
@@ -403,8 +405,7 @@ int do_select(int n, fd_set_bits *fds, struct timespec *end_time)
        int retval, i, timed_out = 0;
        unsigned long slack = 0;
        unsigned int busy_flag = net_busy_loop_on() ? POLL_BUSY_LOOP : 0;
-       u64 busy_start = busy_loop_start_time(busy_flag);
-       u64 busy_end = busy_loop_end_time();
+       unsigned long busy_end = 0;
 
        rcu_read_lock();
        retval = max_select_fd(n, fds);
@@ -506,9 +507,15 @@ int do_select(int n, fd_set_bits *fds, struct timespec *end_time)
                }
 
                /* only if found POLL_BUSY_LOOP sockets && not out of time */
-               if (!need_resched() && can_busy_loop &&
-                   busy_loop_range(busy_start, busy_end))
-                       continue;
+               if (can_busy_loop && !need_resched()) {
+                       if (!busy_end) {
+                               busy_end = busy_loop_end_time();
+                               continue;
+                       }
+                       if (!busy_loop_timeout(busy_end))
+                               continue;
+               }
+               busy_flag = 0;
 
                /*
                 * If this is the first loop and we have a timeout
@@ -780,9 +787,7 @@ static int do_poll(unsigned int nfds,  struct poll_list *list,
        int timed_out = 0, count = 0;
        unsigned long slack = 0;
        unsigned int busy_flag = net_busy_loop_on() ? POLL_BUSY_LOOP : 0;
-       u64 busy_start = busy_loop_start_time(busy_flag);
-       u64 busy_end = busy_loop_end_time();
-
+       unsigned long busy_end = 0;
 
        /* Optimise the no-wait case */
        if (end_time && !end_time->tv_sec && !end_time->tv_nsec) {
@@ -834,9 +839,15 @@ static int do_poll(unsigned int nfds,  struct poll_list *list,
                        break;
 
                /* only if found POLL_BUSY_LOOP sockets && not out of time */
-               if (!need_resched() && can_busy_loop &&
-                   busy_loop_range(busy_start, busy_end))
-                       continue;
+               if (can_busy_loop && !need_resched()) {
+                       if (!busy_end) {
+                               busy_end = busy_loop_end_time();
+                               continue;
+                       }
+                       if (!busy_loop_timeout(busy_end))
+                               continue;
+               }
+               busy_flag = 0;
 
                /*
                 * If this is the first loop and we have a timeout