This still is [RFC v3] because just passed my simple testI still need to really read and understand the patch, but at a high level I'm not sure how this works. So does the VOLATILE flag get cleared on any access, even if the pages have not been discarded? What happens if an application wants to store non-volatile data in an area that was once marked volatile. If there was never memory pressure, it seems the volatility would persist with no way of removing it.
with TCMalloc tweaking.
I hope more inputs from user-space allocator people and test patch
with their allocator because it might need design change of arena
management design for getting real vaule.
Changelog from v2
* Removing madvise(addr, length, MADV_NOVOLATILE).
* add vmstat about the number of discarded volatile pages
* discard volatile pages without promotion in reclaim path
This is based on v3.6.
- What's the madvise(addr, length, MADV_VOLATILE)?
It's a hint that user deliver to kernel so kernel can *discard*
pages in a range anytime.
- What happens if user access page(ie, virtual address) discarded
by kernel?
The user can see zero-fill-on-demand pages as if madvise(DONTNEED).
- What happens if user access page(ie, virtual address) doesn't
discarded by kernel?
The user can see old data without page fault.
- What's different with madvise(DONTNEED)?
System call semantic
DONTNEED makes sure user always can see zero-fill pages after
he calls madvise while VOLATILE can see zero-fill pages or
old data.