Question about "barrier()" in the SLUB's fast path
Wonhyuk Yang
vvghjk1234 at gmail.com
Fri Nov 12 02:38:55 EST 2021
Hi,
Recently, I had difficulty understanding the meaning of the barrier()
in the slab_alloc_node().
The comments are written like this.
/*
* Irqless object alloc/free algorithm used here depends on sequence
* of fetching cpu_slab's data. tid should be fetched before anything
* on c to guarantee that object and page associated with previous tid
* won't be used with current tid. If we fetch tid first, object and
* page could be one associated with next tid and our alloc/free
* request will be failed. In this case, we will retry. So, no problem.
*/
barrier();
Even if we don't fetch tid first, don't we try again by this_cpu_cmpxchg_double?
I'd really appreciate it if you let me know what I missed!
More information about the Kernelnewbies
mailing list