RFR: 8207851 JEP Draft: Support ByteBuffer mapped over non-volatile memory

Florian Weimer fw at deneb.enyo.de
Thu Jul 26 19:05:22 UTC 2018


* Andrew Dinn:

>> +    // TODO - remove the following defines
>> +    // for testing we need to define the extra MAP_XXX flags used for
>> +    // persistent memory. they will eventually get defined by the
>> +    // system and included via sys/mman.h
>> 
>> Do you really want to change implementation behavior based on which
>> glibc headers (or kernel headers) were used to build the JDK?  It's
>> likely more appropriate to define the constants yourself if they are
>> not available.  There is some architecture variance for the MAP_*
>> constants, but in case of MAP_SHARED_VALIDATE, even HPPA has the same
>> definition.
>
> No, I guess I don't really want to change implementation behaviour based
> on which glibc headers (or kernel headers) were used to build the JDK.
> So, I think I need to modify this so the constants are always defined by
> FileChannelImpl.c
>
> I have followed the Intel libpmem code in defining the values for these
> constants. Can you provide details of the 'architecture variance' you
> refer to above?

Just a quick note on that: Some of the constants in <sys/mman.h> vary
between the Linux architectures for historic reasons.  However, for
MAP_SHARED_VALIDATE, the constant is consistent across all
architectures supported by glibc and in the mainline kernel.

You could add something like this to be on the safe side:

#ifdef MAP_SHARED_VALIDATE
#if MAP_SHARED_VALIDATE != 3
#error Unexpected value for MAP_SHARED_VALIDATE
#endif
#else /* !MAP_SHARED_VALIDATE */
#define MAP_SHARED_VALIDATE 3
#endif

But I doubt that this is required for this constant.


More information about the core-libs-dev mailing list