RFR: 8079315: UseCondCardMark broken in conjunction with CMS precleaning

Andrew Haley aph at redhat.com
Tue May 12 20:19:13 UTC 2015


On 05/12/2015 08:25 PM, Aleksey Shipilev wrote:
> On 12.05.2015 22:03, Andrew Haley wrote:
>> On 05/12/2015 07:54 PM, Aleksey Shipilev wrote:
>>> On 12.05.2015 20:23, Erik Österlund wrote:
>>>> Out of curiosity I patched the thing and my fix can be found here: http://cr.openjdk.java.net/~eosterlund/8079315/webrev.v1/ <http://cr.openjdk.java.net/%7Eeosterlund/8079315/webrev.v1/>
>>>
>>> Wait, how does it work? I presumed you need to poll the serialization page (and then handle the possible trap) in mutator, between storing the reference and reading the card mark. Just mprotect-ing a page does not smell like a serializing event, if you don't actually access the page.
>>
>> I think it is, because the kernel has to interrupt every CPU in that
>> process to flush its write buffer and TLB.  I can't think of any other
>> way of making munmap() work.
> 
> If you have a platform with a software-filled TLB, can't you accurately
> track what CPUs should perform the TLB shootdowns? Or if there is some
> other way for a CPU to communicate the TLB contents back to OS.

There isn't AFAIK: the TLB is always a CPU-local structure.

> If that is in place, then mprotect can only affect the cores that
> actually accessed the serialization page. I feel that relying on the
> premise that page mapping changes are globally synchronized is
> dangerous.

You're probably right about that.  I suppose it would be possible
in theory for there to be a broadcast TLB invalidate event as part
of the cache coherency protocol.

I wonder if the kernel people would be receptive to the idea of a
"execute a memory fence on every CPU" system call.  It would not be
hard to do and it would be very useful.

Andrew.



More information about the hotspot-gc-dev mailing list