]> asedeno.scripts.mit.edu Git - linux.git/blob - kernel/rcu/srcu.c
srcu: Implement more-efficient reader counts
[linux.git] / kernel / rcu / srcu.c
1 /*
2  * Sleepable Read-Copy Update mechanism for mutual exclusion.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, you can access it online at
16  * http://www.gnu.org/licenses/gpl-2.0.html.
17  *
18  * Copyright (C) IBM Corporation, 2006
19  * Copyright (C) Fujitsu, 2012
20  *
21  * Author: Paul McKenney <paulmck@us.ibm.com>
22  *         Lai Jiangshan <laijs@cn.fujitsu.com>
23  *
24  * For detailed explanation of Read-Copy Update mechanism see -
25  *              Documentation/RCU/ *.txt
26  *
27  */
28
29 #include <linux/export.h>
30 #include <linux/mutex.h>
31 #include <linux/percpu.h>
32 #include <linux/preempt.h>
33 #include <linux/rcupdate.h>
34 #include <linux/sched.h>
35 #include <linux/smp.h>
36 #include <linux/delay.h>
37 #include <linux/srcu.h>
38
39 #include "rcu.h"
40
41 /*
42  * Initialize an rcu_batch structure to empty.
43  */
44 static inline void rcu_batch_init(struct rcu_batch *b)
45 {
46         b->head = NULL;
47         b->tail = &b->head;
48 }
49
50 /*
51  * Enqueue a callback onto the tail of the specified rcu_batch structure.
52  */
53 static inline void rcu_batch_queue(struct rcu_batch *b, struct rcu_head *head)
54 {
55         *b->tail = head;
56         b->tail = &head->next;
57 }
58
59 /*
60  * Is the specified rcu_batch structure empty?
61  */
62 static inline bool rcu_batch_empty(struct rcu_batch *b)
63 {
64         return b->tail == &b->head;
65 }
66
67 /*
68  * Remove the callback at the head of the specified rcu_batch structure
69  * and return a pointer to it, or return NULL if the structure is empty.
70  */
71 static inline struct rcu_head *rcu_batch_dequeue(struct rcu_batch *b)
72 {
73         struct rcu_head *head;
74
75         if (rcu_batch_empty(b))
76                 return NULL;
77
78         head = b->head;
79         b->head = head->next;
80         if (b->tail == &head->next)
81                 rcu_batch_init(b);
82
83         return head;
84 }
85
86 /*
87  * Move all callbacks from the rcu_batch structure specified by "from" to
88  * the structure specified by "to".
89  */
90 static inline void rcu_batch_move(struct rcu_batch *to, struct rcu_batch *from)
91 {
92         if (!rcu_batch_empty(from)) {
93                 *to->tail = from->head;
94                 to->tail = from->tail;
95                 rcu_batch_init(from);
96         }
97 }
98
99 static int init_srcu_struct_fields(struct srcu_struct *sp)
100 {
101         sp->completed = 0;
102         spin_lock_init(&sp->queue_lock);
103         sp->running = false;
104         rcu_batch_init(&sp->batch_queue);
105         rcu_batch_init(&sp->batch_check0);
106         rcu_batch_init(&sp->batch_check1);
107         rcu_batch_init(&sp->batch_done);
108         INIT_DELAYED_WORK(&sp->work, process_srcu);
109         sp->per_cpu_ref = alloc_percpu(struct srcu_array);
110         return sp->per_cpu_ref ? 0 : -ENOMEM;
111 }
112
113 #ifdef CONFIG_DEBUG_LOCK_ALLOC
114
115 int __init_srcu_struct(struct srcu_struct *sp, const char *name,
116                        struct lock_class_key *key)
117 {
118         /* Don't re-initialize a lock while it is held. */
119         debug_check_no_locks_freed((void *)sp, sizeof(*sp));
120         lockdep_init_map(&sp->dep_map, name, key, 0);
121         return init_srcu_struct_fields(sp);
122 }
123 EXPORT_SYMBOL_GPL(__init_srcu_struct);
124
125 #else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
126
127 /**
128  * init_srcu_struct - initialize a sleep-RCU structure
129  * @sp: structure to initialize.
130  *
131  * Must invoke this on a given srcu_struct before passing that srcu_struct
132  * to any other function.  Each srcu_struct represents a separate domain
133  * of SRCU protection.
134  */
135 int init_srcu_struct(struct srcu_struct *sp)
136 {
137         return init_srcu_struct_fields(sp);
138 }
139 EXPORT_SYMBOL_GPL(init_srcu_struct);
140
141 #endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
142
143 /*
144  * Returns approximate total of the readers' ->lock_count[] values for the
145  * rank of per-CPU counters specified by idx.
146  */
147 static unsigned long srcu_readers_lock_idx(struct srcu_struct *sp, int idx)
148 {
149         int cpu;
150         unsigned long sum = 0;
151
152         for_each_possible_cpu(cpu) {
153                 struct srcu_array *cpuc = per_cpu_ptr(sp->per_cpu_ref, cpu);
154
155                 sum += READ_ONCE(cpuc->lock_count[idx]);
156         }
157         return sum;
158 }
159
160 /*
161  * Returns approximate total of the readers' ->unlock_count[] values for the
162  * rank of per-CPU counters specified by idx.
163  */
164 static unsigned long srcu_readers_unlock_idx(struct srcu_struct *sp, int idx)
165 {
166         int cpu;
167         unsigned long sum = 0;
168
169         for_each_possible_cpu(cpu) {
170                 struct srcu_array *cpuc = per_cpu_ptr(sp->per_cpu_ref, cpu);
171
172                 sum += READ_ONCE(cpuc->unlock_count[idx]);
173         }
174         return sum;
175 }
176
177 /*
178  * Return true if the number of pre-existing readers is determined to
179  * be zero.
180  */
181 static bool srcu_readers_active_idx_check(struct srcu_struct *sp, int idx)
182 {
183         unsigned long unlocks;
184
185         unlocks = srcu_readers_unlock_idx(sp, idx);
186
187         /*
188          * Make sure that a lock is always counted if the corresponding unlock
189          * is counted. Needs to be a smp_mb() as the read side may contain a
190          * read from a variable that is written to before the synchronize_srcu()
191          * in the write side. In this case smp_mb()s A and B act like the store
192          * buffering pattern.
193          *
194          * This smp_mb() also pairs with smp_mb() C to prevent accesses after the
195          * synchronize_srcu() from being executed before the grace period ends.
196          */
197         smp_mb(); /* A */
198
199         /*
200          * If the locks are the same as the unlocks, then there must have
201          * been no readers on this index at some time in between. This does not
202          * mean that there are no more readers, as one could have read the
203          * current index but not have incremented the lock counter yet.
204          *
205          * Possible bug: There is no guarantee that there haven't been ULONG_MAX
206          * increments of ->lock_count[] since the unlocks were counted, meaning
207          * that this could return true even if there are still active readers.
208          * Since there are no memory barriers around srcu_flip(), the CPU is not
209          * required to increment ->completed before running
210          * srcu_readers_unlock_idx(), which means that there could be an
211          * arbitrarily large number of critical sections that execute after
212          * srcu_readers_unlock_idx() but use the old value of ->completed.
213          */
214         return srcu_readers_lock_idx(sp, idx) == unlocks;
215 }
216
217 /**
218  * srcu_readers_active - returns true if there are readers. and false
219  *                       otherwise
220  * @sp: which srcu_struct to count active readers (holding srcu_read_lock).
221  *
222  * Note that this is not an atomic primitive, and can therefore suffer
223  * severe errors when invoked on an active srcu_struct.  That said, it
224  * can be useful as an error check at cleanup time.
225  */
226 static bool srcu_readers_active(struct srcu_struct *sp)
227 {
228         int cpu;
229         unsigned long sum = 0;
230
231         for_each_possible_cpu(cpu) {
232                 struct srcu_array *cpuc = per_cpu_ptr(sp->per_cpu_ref, cpu);
233
234                 sum += READ_ONCE(cpuc->lock_count[0]);
235                 sum += READ_ONCE(cpuc->lock_count[1]);
236                 sum -= READ_ONCE(cpuc->unlock_count[0]);
237                 sum -= READ_ONCE(cpuc->unlock_count[1]);
238         }
239         return sum;
240 }
241
242 /**
243  * cleanup_srcu_struct - deconstruct a sleep-RCU structure
244  * @sp: structure to clean up.
245  *
246  * Must invoke this after you are finished using a given srcu_struct that
247  * was initialized via init_srcu_struct(), else you leak memory.
248  */
249 void cleanup_srcu_struct(struct srcu_struct *sp)
250 {
251         if (WARN_ON(srcu_readers_active(sp)))
252                 return; /* Leakage unless caller handles error. */
253         free_percpu(sp->per_cpu_ref);
254         sp->per_cpu_ref = NULL;
255 }
256 EXPORT_SYMBOL_GPL(cleanup_srcu_struct);
257
258 /*
259  * Counts the new reader in the appropriate per-CPU element of the
260  * srcu_struct.  Must be called from process context.
261  * Returns an index that must be passed to the matching srcu_read_unlock().
262  */
263 int __srcu_read_lock(struct srcu_struct *sp)
264 {
265         int idx;
266
267         idx = READ_ONCE(sp->completed) & 0x1;
268         __this_cpu_inc(sp->per_cpu_ref->lock_count[idx]);
269         smp_mb(); /* B */  /* Avoid leaking the critical section. */
270         return idx;
271 }
272 EXPORT_SYMBOL_GPL(__srcu_read_lock);
273
274 /*
275  * Removes the count for the old reader from the appropriate per-CPU
276  * element of the srcu_struct.  Note that this may well be a different
277  * CPU than that which was incremented by the corresponding srcu_read_lock().
278  * Must be called from process context.
279  */
280 void __srcu_read_unlock(struct srcu_struct *sp, int idx)
281 {
282         smp_mb(); /* C */  /* Avoid leaking the critical section. */
283         this_cpu_inc(sp->per_cpu_ref->unlock_count[idx]);
284 }
285 EXPORT_SYMBOL_GPL(__srcu_read_unlock);
286
287 /*
288  * We use an adaptive strategy for synchronize_srcu() and especially for
289  * synchronize_srcu_expedited().  We spin for a fixed time period
290  * (defined below) to allow SRCU readers to exit their read-side critical
291  * sections.  If there are still some readers after 10 microseconds,
292  * we repeatedly block for 1-millisecond time periods.  This approach
293  * has done well in testing, so there is no need for a config parameter.
294  */
295 #define SRCU_RETRY_CHECK_DELAY          5
296 #define SYNCHRONIZE_SRCU_TRYCOUNT       2
297 #define SYNCHRONIZE_SRCU_EXP_TRYCOUNT   12
298
299 /*
300  * @@@ Wait until all pre-existing readers complete.  Such readers
301  * will have used the index specified by "idx".
302  * the caller should ensures the ->completed is not changed while checking
303  * and idx = (->completed & 1) ^ 1
304  */
305 static bool try_check_zero(struct srcu_struct *sp, int idx, int trycount)
306 {
307         for (;;) {
308                 if (srcu_readers_active_idx_check(sp, idx))
309                         return true;
310                 if (--trycount <= 0)
311                         return false;
312                 udelay(SRCU_RETRY_CHECK_DELAY);
313         }
314 }
315
316 /*
317  * Increment the ->completed counter so that future SRCU readers will
318  * use the other rank of the ->(un)lock_count[] arrays.  This allows
319  * us to wait for pre-existing readers in a starvation-free manner.
320  */
321 static void srcu_flip(struct srcu_struct *sp)
322 {
323         sp->completed++;
324 }
325
326 /*
327  * Enqueue an SRCU callback on the specified srcu_struct structure,
328  * initiating grace-period processing if it is not already running.
329  *
330  * Note that all CPUs must agree that the grace period extended beyond
331  * all pre-existing SRCU read-side critical section.  On systems with
332  * more than one CPU, this means that when "func()" is invoked, each CPU
333  * is guaranteed to have executed a full memory barrier since the end of
334  * its last corresponding SRCU read-side critical section whose beginning
335  * preceded the call to call_rcu().  It also means that each CPU executing
336  * an SRCU read-side critical section that continues beyond the start of
337  * "func()" must have executed a memory barrier after the call_rcu()
338  * but before the beginning of that SRCU read-side critical section.
339  * Note that these guarantees include CPUs that are offline, idle, or
340  * executing in user mode, as well as CPUs that are executing in the kernel.
341  *
342  * Furthermore, if CPU A invoked call_rcu() and CPU B invoked the
343  * resulting SRCU callback function "func()", then both CPU A and CPU
344  * B are guaranteed to execute a full memory barrier during the time
345  * interval between the call to call_rcu() and the invocation of "func()".
346  * This guarantee applies even if CPU A and CPU B are the same CPU (but
347  * again only if the system has more than one CPU).
348  *
349  * Of course, these guarantees apply only for invocations of call_srcu(),
350  * srcu_read_lock(), and srcu_read_unlock() that are all passed the same
351  * srcu_struct structure.
352  */
353 void call_srcu(struct srcu_struct *sp, struct rcu_head *head,
354                rcu_callback_t func)
355 {
356         unsigned long flags;
357
358         head->next = NULL;
359         head->func = func;
360         spin_lock_irqsave(&sp->queue_lock, flags);
361         rcu_batch_queue(&sp->batch_queue, head);
362         if (!sp->running) {
363                 sp->running = true;
364                 queue_delayed_work(system_power_efficient_wq, &sp->work, 0);
365         }
366         spin_unlock_irqrestore(&sp->queue_lock, flags);
367 }
368 EXPORT_SYMBOL_GPL(call_srcu);
369
370 static void srcu_advance_batches(struct srcu_struct *sp, int trycount);
371 static void srcu_reschedule(struct srcu_struct *sp);
372
373 /*
374  * Helper function for synchronize_srcu() and synchronize_srcu_expedited().
375  */
376 static void __synchronize_srcu(struct srcu_struct *sp, int trycount)
377 {
378         struct rcu_synchronize rcu;
379         struct rcu_head *head = &rcu.head;
380         bool done = false;
381
382         RCU_LOCKDEP_WARN(lock_is_held(&sp->dep_map) ||
383                          lock_is_held(&rcu_bh_lock_map) ||
384                          lock_is_held(&rcu_lock_map) ||
385                          lock_is_held(&rcu_sched_lock_map),
386                          "Illegal synchronize_srcu() in same-type SRCU (or in RCU) read-side critical section");
387
388         might_sleep();
389         init_completion(&rcu.completion);
390
391         head->next = NULL;
392         head->func = wakeme_after_rcu;
393         spin_lock_irq(&sp->queue_lock);
394         if (!sp->running) {
395                 /* steal the processing owner */
396                 sp->running = true;
397                 rcu_batch_queue(&sp->batch_check0, head);
398                 spin_unlock_irq(&sp->queue_lock);
399
400                 srcu_advance_batches(sp, trycount);
401                 if (!rcu_batch_empty(&sp->batch_done)) {
402                         BUG_ON(sp->batch_done.head != head);
403                         rcu_batch_dequeue(&sp->batch_done);
404                         done = true;
405                 }
406                 /* give the processing owner to work_struct */
407                 srcu_reschedule(sp);
408         } else {
409                 rcu_batch_queue(&sp->batch_queue, head);
410                 spin_unlock_irq(&sp->queue_lock);
411         }
412
413         if (!done)
414                 wait_for_completion(&rcu.completion);
415 }
416
417 /**
418  * synchronize_srcu - wait for prior SRCU read-side critical-section completion
419  * @sp: srcu_struct with which to synchronize.
420  *
421  * Wait for the count to drain to zero of both indexes. To avoid the
422  * possible starvation of synchronize_srcu(), it waits for the count of
423  * the index=((->completed & 1) ^ 1) to drain to zero at first,
424  * and then flip the completed and wait for the count of the other index.
425  *
426  * Can block; must be called from process context.
427  *
428  * Note that it is illegal to call synchronize_srcu() from the corresponding
429  * SRCU read-side critical section; doing so will result in deadlock.
430  * However, it is perfectly legal to call synchronize_srcu() on one
431  * srcu_struct from some other srcu_struct's read-side critical section,
432  * as long as the resulting graph of srcu_structs is acyclic.
433  *
434  * There are memory-ordering constraints implied by synchronize_srcu().
435  * On systems with more than one CPU, when synchronize_srcu() returns,
436  * each CPU is guaranteed to have executed a full memory barrier since
437  * the end of its last corresponding SRCU-sched read-side critical section
438  * whose beginning preceded the call to synchronize_srcu().  In addition,
439  * each CPU having an SRCU read-side critical section that extends beyond
440  * the return from synchronize_srcu() is guaranteed to have executed a
441  * full memory barrier after the beginning of synchronize_srcu() and before
442  * the beginning of that SRCU read-side critical section.  Note that these
443  * guarantees include CPUs that are offline, idle, or executing in user mode,
444  * as well as CPUs that are executing in the kernel.
445  *
446  * Furthermore, if CPU A invoked synchronize_srcu(), which returned
447  * to its caller on CPU B, then both CPU A and CPU B are guaranteed
448  * to have executed a full memory barrier during the execution of
449  * synchronize_srcu().  This guarantee applies even if CPU A and CPU B
450  * are the same CPU, but again only if the system has more than one CPU.
451  *
452  * Of course, these memory-ordering guarantees apply only when
453  * synchronize_srcu(), srcu_read_lock(), and srcu_read_unlock() are
454  * passed the same srcu_struct structure.
455  */
456 void synchronize_srcu(struct srcu_struct *sp)
457 {
458         __synchronize_srcu(sp, (rcu_gp_is_expedited() && !rcu_gp_is_normal())
459                            ? SYNCHRONIZE_SRCU_EXP_TRYCOUNT
460                            : SYNCHRONIZE_SRCU_TRYCOUNT);
461 }
462 EXPORT_SYMBOL_GPL(synchronize_srcu);
463
464 /**
465  * synchronize_srcu_expedited - Brute-force SRCU grace period
466  * @sp: srcu_struct with which to synchronize.
467  *
468  * Wait for an SRCU grace period to elapse, but be more aggressive about
469  * spinning rather than blocking when waiting.
470  *
471  * Note that synchronize_srcu_expedited() has the same deadlock and
472  * memory-ordering properties as does synchronize_srcu().
473  */
474 void synchronize_srcu_expedited(struct srcu_struct *sp)
475 {
476         __synchronize_srcu(sp, SYNCHRONIZE_SRCU_EXP_TRYCOUNT);
477 }
478 EXPORT_SYMBOL_GPL(synchronize_srcu_expedited);
479
480 /**
481  * srcu_barrier - Wait until all in-flight call_srcu() callbacks complete.
482  * @sp: srcu_struct on which to wait for in-flight callbacks.
483  */
484 void srcu_barrier(struct srcu_struct *sp)
485 {
486         synchronize_srcu(sp);
487 }
488 EXPORT_SYMBOL_GPL(srcu_barrier);
489
490 /**
491  * srcu_batches_completed - return batches completed.
492  * @sp: srcu_struct on which to report batch completion.
493  *
494  * Report the number of batches, correlated with, but not necessarily
495  * precisely the same as, the number of grace periods that have elapsed.
496  */
497 unsigned long srcu_batches_completed(struct srcu_struct *sp)
498 {
499         return sp->completed;
500 }
501 EXPORT_SYMBOL_GPL(srcu_batches_completed);
502
503 #define SRCU_CALLBACK_BATCH     10
504 #define SRCU_INTERVAL           1
505
506 /*
507  * Move any new SRCU callbacks to the first stage of the SRCU grace
508  * period pipeline.
509  */
510 static void srcu_collect_new(struct srcu_struct *sp)
511 {
512         if (!rcu_batch_empty(&sp->batch_queue)) {
513                 spin_lock_irq(&sp->queue_lock);
514                 rcu_batch_move(&sp->batch_check0, &sp->batch_queue);
515                 spin_unlock_irq(&sp->queue_lock);
516         }
517 }
518
519 /*
520  * Core SRCU state machine.  Advance callbacks from ->batch_check0 to
521  * ->batch_check1 and then to ->batch_done as readers drain.
522  */
523 static void srcu_advance_batches(struct srcu_struct *sp, int trycount)
524 {
525         int idx = 1 ^ (sp->completed & 1);
526
527         /*
528          * Because readers might be delayed for an extended period after
529          * fetching ->completed for their index, at any point in time there
530          * might well be readers using both idx=0 and idx=1.  We therefore
531          * need to wait for readers to clear from both index values before
532          * invoking a callback.
533          */
534
535         if (rcu_batch_empty(&sp->batch_check0) &&
536             rcu_batch_empty(&sp->batch_check1))
537                 return; /* no callbacks need to be advanced */
538
539         if (!try_check_zero(sp, idx, trycount))
540                 return; /* failed to advance, will try after SRCU_INTERVAL */
541
542         /*
543          * The callbacks in ->batch_check1 have already done with their
544          * first zero check and flip back when they were enqueued on
545          * ->batch_check0 in a previous invocation of srcu_advance_batches().
546          * (Presumably try_check_zero() returned false during that
547          * invocation, leaving the callbacks stranded on ->batch_check1.)
548          * They are therefore ready to invoke, so move them to ->batch_done.
549          */
550         rcu_batch_move(&sp->batch_done, &sp->batch_check1);
551
552         if (rcu_batch_empty(&sp->batch_check0))
553                 return; /* no callbacks need to be advanced */
554         srcu_flip(sp);
555
556         /*
557          * The callbacks in ->batch_check0 just finished their
558          * first check zero and flip, so move them to ->batch_check1
559          * for future checking on the other idx.
560          */
561         rcu_batch_move(&sp->batch_check1, &sp->batch_check0);
562
563         /*
564          * SRCU read-side critical sections are normally short, so check
565          * at least twice in quick succession after a flip.
566          */
567         trycount = trycount < 2 ? 2 : trycount;
568         if (!try_check_zero(sp, idx^1, trycount))
569                 return; /* failed to advance, will try after SRCU_INTERVAL */
570
571         /*
572          * The callbacks in ->batch_check1 have now waited for all
573          * pre-existing readers using both idx values.  They are therefore
574          * ready to invoke, so move them to ->batch_done.
575          */
576         rcu_batch_move(&sp->batch_done, &sp->batch_check1);
577 }
578
579 /*
580  * Invoke a limited number of SRCU callbacks that have passed through
581  * their grace period.  If there are more to do, SRCU will reschedule
582  * the workqueue.
583  */
584 static void srcu_invoke_callbacks(struct srcu_struct *sp)
585 {
586         int i;
587         struct rcu_head *head;
588
589         for (i = 0; i < SRCU_CALLBACK_BATCH; i++) {
590                 head = rcu_batch_dequeue(&sp->batch_done);
591                 if (!head)
592                         break;
593                 local_bh_disable();
594                 head->func(head);
595                 local_bh_enable();
596         }
597 }
598
599 /*
600  * Finished one round of SRCU grace period.  Start another if there are
601  * more SRCU callbacks queued, otherwise put SRCU into not-running state.
602  */
603 static void srcu_reschedule(struct srcu_struct *sp)
604 {
605         bool pending = true;
606
607         if (rcu_batch_empty(&sp->batch_done) &&
608             rcu_batch_empty(&sp->batch_check1) &&
609             rcu_batch_empty(&sp->batch_check0) &&
610             rcu_batch_empty(&sp->batch_queue)) {
611                 spin_lock_irq(&sp->queue_lock);
612                 if (rcu_batch_empty(&sp->batch_done) &&
613                     rcu_batch_empty(&sp->batch_check1) &&
614                     rcu_batch_empty(&sp->batch_check0) &&
615                     rcu_batch_empty(&sp->batch_queue)) {
616                         sp->running = false;
617                         pending = false;
618                 }
619                 spin_unlock_irq(&sp->queue_lock);
620         }
621
622         if (pending)
623                 queue_delayed_work(system_power_efficient_wq,
624                                    &sp->work, SRCU_INTERVAL);
625 }
626
627 /*
628  * This is the work-queue function that handles SRCU grace periods.
629  */
630 void process_srcu(struct work_struct *work)
631 {
632         struct srcu_struct *sp;
633
634         sp = container_of(work, struct srcu_struct, work.work);
635
636         srcu_collect_new(sp);
637         srcu_advance_batches(sp, 1);
638         srcu_invoke_callbacks(sp);
639         srcu_reschedule(sp);
640 }
641 EXPORT_SYMBOL_GPL(process_srcu);