hg: hsx/hotspot-gc/hotspot: 2 new changesets
Igor Veresov
igor.veresov at oracle.com
Mon Aug 8 03:03:04 UTC 2011
It was removed because it seems to have an unintended side effect. It
has an effect of removing a swap reservation. So imagine that you're
running a program on a machine with a heap size very close to the
virtual swap size (phys mem + swap). You do an MADV_DONTNEED on some of
your memory in order to free pages, but then some other program comes
and allocates this freed memory. Now your program will try to touch the
freed region at some point and the OS will try to allocate a page but
will fail (because there's no memory) and your program will segfault. In
other words, the region to which MADV_DONTNEED was applied behaves as if
it was mmap'ed with MAP_NORESERVE. This semantics is not specified in
the man but it seems to behave this way at least on some kernels.
Doing mmap over existing mmap'ed segment has the same effect of freeing
the pages but creates a new segment in the middle, thus producing 3
segments. This could have a negative effect of page fault handling speed
and this is why I wanted to try MADV_DONTNEED in the first place, but it
didn't work out as you can see from the explanation above.
igor
On 8/6/11 2:46 PM, Jason Schroeder wrote:
> Why is the MADV_DONTNEED usage being removed? My reading
> of the kernel sources for swapping indicates the change could/would
> cause a needless page write.
>
> On Sat, Aug 6, 2011 at 3:32 PM, Igor Veresov<igor.veresov at oracle.com> wrote:
>> Yes, but not only that. It basically discards the page, to quote from the
>> man page: "Subsequent accesses of pages in this range will succeed, but will
>> result either in re-loading of the memory contents from the underlying
>> mapped file (see mmap()) or zero-fill-on-demand pages for mappings without
>> an underlying file."
>>
>> igor
>>
>> On 8/6/11 9:24 AM, Jason Schroeder wrote:
>>> I thought the benefit of MADV_DONTNEED was to stop Linux from
>>> writing dirty pages to disk.
>>>
>>> On Sat, Aug 6, 2011 at 6:00 AM,<igor.veresov at oracle.com> wrote:
>>>> Changeset: a20e6e447d3d
>>>> Author: iveresov
>>>> Date: 2011-08-05 16:44 -0700
>>>> URL:
>>>> http://hg.openjdk.java.net/hsx/hotspot-gc/hotspot/rev/a20e6e447d3d
>>>>
>>>> 7060842: UseNUMA crash with UseHugreTLBFS running SPECjvm2008
>>>> Summary: Use mmap() instead of madvise(MADV_DONTNEED) to uncommit pages
>>>> Reviewed-by: ysr
>>>>
>>>> ! src/os/linux/vm/os_linux.cpp
>>>>
>>
More information about the hotspot-gc-dev
mailing list