D.1.1.1 Abolish Asynchronous Grace-Period APIs

The problem with the call_rcu() API is that a single thread can generate an arbitrarily large number of blocks of memory awaiting a grace period, as illustrated by the following:



 1 while (p = kmalloc(sizeof(*p), GFP_ATOMIC))
 2   call_rcu(&p->rcu, f);


In contrast, the analogous code using synchronize_rcu() can have at most a single block of memory per thread awaiting a grace period:



 1 while (p = kmalloc(sizeof(*p),
 2                    GFP_ATOMIC)) {
 3   synchronize_rcu();
 4   kfree(&p->rcu, f);
 5 }


Therefore, SRCU provides an equivalent to synchronize_rcu(), but not to call_rcu().



Paul E. McKenney 2011-12-16