Re: Alternative to signals/sys_membarrier() in liburcu

From: Mathieu Desnoyers
Date: Thu Mar 12 2015 - 16:56:13 EST

(sorry for re-send, my mail client tricked me into posting HTML
to lkml)


Michael Sullivan proposed a clever hack abusing mprotect() to
perform the same effect as sys_membarrier() I submitted a few
years ago ( ).

At that time, the sys_membarrier implementation was deemed
technically sound, but there were not enough users of the system call
to justify its inclusion.

So far, the number of users of liburcu has increased, but liburcu
still appears to be the only direct user of sys_membarrier. On this
front, we could argue that many other system calls have only
one user: glibc. In that respect, liburcu is quite similar to glibc.

So the question as it stands appears to be: would you be comfortable
having users abuse mprotect(), relying on its side-effect of issuing
a smp_mb() on each targeted CPU for the TLB shootdown, as
an effective implementation of process-wide memory barrier ?

Thoughts ?



From: "Michael Sullivan" <sully@xxxxxxxxxx>
To: "Mathieu Desnoyers" <mathieu.desnoyers@xxxxxxxxxxxx>
Cc: lttng-dev@xxxxxxxxxxxxxxx
Sent: Thursday, March 12, 2015 12:04:07 PM
Subject: Re: [lttng-dev] Alternative to signals/sys_membarrier() in liburcu

On Thu, Mar 12, 2015 at 10:57 AM, Mathieu Desnoyers < mathieu.desnoyers@xxxxxxxxxxxx > wrote:

Even though it depends on internal behavior not currently specified by mprotect,
I'd very much like to see the prototype you have,

I ended up posting my code at .
The interesting patch is .

Quick blog post I wrote about it at .
(I talked briefly about sys_membarrier in the post as best as I could piece together from LKML; if my comment on it is inaccurate I can edit the post.)

-Michael Sullivan

Mathieu Desnoyers
EfficiOS Inc.

lttng-dev mailing list
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at