---
name: "synchronize_srcu"
section: "9"
platform: "linux"
package: "linux-manual-3.16"
version: "3.16.56-1+deb8u1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/synchronize_srcu"
---

# synchronize\_srcu(9)

wait for prior SRCU read-side critical-section completion

## NAME

synchronize\_srcu - wait for prior SRCU read-side critical-section completion

## SYNOPSIS

**void synchronize\_srcu(struct srcu\_struct \*** *sp***);**

## ARGUMENTS

*sp*

srcu\_struct with which to synchronize.

## DESCRIPTION

Wait for the count to drain to zero of both indexes. To avoid the possible starvation of **synchronize\_srcu**, it waits for the count of the index=((-\>completed & 1) ^ 1) to drain to zero at first, and then flip the completed and wait for the count of the other index.

Can block; must be called from process context.

Note that it is illegal to call **synchronize\_srcu** from the corresponding SRCU read-side critical section; doing so will result in deadlock. However, it is perfectly legal to call **synchronize\_srcu** on one srcu\_struct from some other srcu\_struct's read-side critical section, as long as the resulting graph of srcu\_structs is acyclic.

There are memory-ordering constraints implied by **synchronize\_srcu**. On systems with more than one CPU, when **synchronize\_srcu** returns, each CPU is guaranteed to have executed a full memory barrier since the end of its last corresponding SRCU-sched read-side critical section whose beginning preceded the call to **synchronize\_srcu**. In addition, each CPU having an SRCU read-side critical section that extends beyond the return from **synchronize\_srcu** is guaranteed to have executed a full memory barrier after the beginning of **synchronize\_srcu** and before the beginning of that SRCU read-side critical section. Note that these guarantees include CPUs that are offline, idle, or executing in user mode, as well as CPUs that are executing in the kernel.

Furthermore, if CPU A invoked **synchronize\_srcu**, which returned to its caller on CPU B, then both CPU A and CPU B are guaranteed to have executed a full memory barrier during the execution of **synchronize\_srcu**. This guarantee applies even if CPU A and CPU B are the same CPU, but again only if the system has more than one CPU.

Of course, these memory-ordering guarantees apply only when **synchronize\_srcu**, **srcu\_read\_lock**, and **srcu\_read\_unlock** are passed the same srcu\_struct structure.

## COPYRIGHT
