From 0d23b97ed70e1d2a8544a2412e1e6c0221b3e488 Mon Sep 17 00:00:00 2001 From: "Angelo G. Del Regno" Date: Wed, 15 Mar 2017 00:56:03 +0100 Subject: [PATCH] mm: shmem: Reschedule by unlocking and relocking RCU because of missing API 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. --- mm/shmem.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 4f552f01557f..ccba85ed1be9 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1926,7 +1926,8 @@ restart: } if (need_resched()) { - cond_resched_rcu(); + rcu_read_unlock(); + rcu_read_lock(); start = iter.index + 1; goto restart; } @@ -1996,7 +1997,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; }