mm: shmem: Reschedule by unlocking and relocking RCU because of missing API
authorAngelo G. Del Regno <kholk11@gmail.com>
Tue, 14 Mar 2017 23:56:03 +0000 (00:56 +0100)
committerDanny Wood <danwood76@gmail.com>
Thu, 28 Jan 2021 09:32:01 +0000 (09:32 +0000)
The commit introducing the call to cond_resched_rcu() is backported
from a recent kernel version, which has got some very good updates
to the RCU, including a new function cond_resched_rcu which is
doing not-so-complicated rescheduling stuff.
Kernel 3.10 hasn't got any of these and porting would be overkill.

On our current code base, the RCU management is pretty stupid
compared to newer kernels, so it's just ok to reschedule by just
unlocking the RCU and relocking it: this will allow to update its
status and the drivers will be happy.

Change-Id: Iadf407ccaccee64ffeed5e292d17f6b2f7e6ead4

mm/shmem.c

index 528b2fac34e4d868c14da238731f2884361ef019..28da0348982650d51632d19f2ce45e6160ad5c07 100644 (file)
@@ -1937,7 +1937,8 @@ restart:
                }
 
                if (need_resched()) {
-                       cond_resched_rcu();
+                       rcu_read_unlock();
+                       rcu_read_lock();
                        start = iter.index + 1;
                        goto restart;
                }
@@ -2007,7 +2008,8 @@ restart:
                        spin_unlock_irq(&mapping->tree_lock);
 continue_resched:
                        if (need_resched()) {
-                               cond_resched_rcu();
+                               rcu_read_unlock();
+                               rcu_read_lock();
                                start = iter.index + 1;
                                goto restart;
                        }