Suggested fix for JDK-4724038 (Add unmap method to MappedByteBuffer)

David Holmes david.holmes at oracle.com
Fri Sep 11 10:00:57 UTC 2015


On 11/09/2015 6:37 PM, Andrew Haley wrote:
> On 09/11/2015 07:15 AM, David Holmes wrote:
>> On 11/09/2015 12:56 AM, Vitaly Davidovich wrote:
>>>>
>>>> Sure, if you like, but that's a detail.  We are arguing about what
>>>> colour to paint the bike shed.  :)
>>>
>>>
>>> The reason it may be more than just a bikeshed is because if this requires
>>> more cleverness in the segfault handler, then it's yet more work to make
>>> this happen.  I agree it's an implementation detail, but I don't think it's
>>> trivial (unless someone comes along and says that modifying the trap
>>> handler to account for this type of scenario is trivial).  One would also
>>> need to modify the safepoint code in the VM to allow skipping all the
>>> housekeeping it does typically, but I suspect this part is fairly easy.
>>
>> Not sure how the safepoint code is supposed to know this particular
>> safepoint is "special".
>
> I guess I don't know what the problem is: when you request a safepoint you
> also pass a code saying what you want to happen.

There are actions that can also happen at a safepoint that are not part 
of the VMOperation for which the safepoint was initiated:

// Various cleaning tasks that should be done periodically at safepoints
void SafepointSynchronize::do_cleanup_tasks() {
   {
     TraceTime t1("deflating idle monitors", TraceSafepointCleanupTime);
     ObjectSynchronizer::deflate_idle_monitors();
   }

   {
     TraceTime t2("updating inline caches", TraceSafepointCleanupTime);
     InlineCacheBuffer::update_inline_caches();
   }
   {
     TraceTime t3("compilation policy safepoint handler", 
TraceSafepointCleanupTime);
     CompilationPolicy::policy()->do_safepoint_work();
   }

   {
     TraceTime t4("mark nmethods", TraceSafepointCleanupTime);
     NMethodSweeper::mark_active_nmethods();
   }

   if (SymbolTable::needs_rehashing()) {
     TraceTime t5("rehashing symbol table", TraceSafepointCleanupTime);
     SymbolTable::rehash_table();
   }

   if (StringTable::needs_rehashing()) {
     TraceTime t6("rehashing string table", TraceSafepointCleanupTime);
     StringTable::rehash_table();
   }

   // rotate log files?
   if (UseGCLogFileRotation) {
     gclog_or_tty->rotate_log(false);
   }

   {
     // CMS delays purging the CLDG until the beginning of the next 
safepoint and to
     // make sure concurrent sweep is done
     TraceTime t7("purging class loader data graph", 
TraceSafepointCleanupTime);
     ClassLoaderDataGraph::purge_if_needed();
   }
}

All the above happens at the end of SafepointSynchronize::begin, before 
the VMOperation is processed.

David
-----


> Andrew.
>



More information about the core-libs-dev mailing list