On Tue, Mar 26, 2013 at 05:26:04PM -0700, John Stultz wrote:Sorting out how to handle vrange() calls that cross both anonymousDo you have any specific drawback examples?
and file vmas will be interesting, and may have some of the
drawbacks of the vma based approach, but I think it will still be
I'd like to solve it if it is critical and I believe we shouldn't
do that for simpler implementation.
Ok. I'm still working on some changes (been slow this week), but hope to have more to send your way next week.Anyway, that's my current thinkig. You can preview my current attempt here:I saw it roughly and it seems good to me.
http://git.linaro.org/gitweb?p=people/jstultz/android-dev.git;a=shortlog;h=refs/heads/dev/vrange-minchan
I will review it in detail if you send formal patch. :)
As you know well, there are several trial to handle memory management
in userspace. One of example is lowmemory notifier. Kernel just send
signal and user can free pages. Frankly speaking, I don't like that idea.
Because there are several factors to limit userspace daemon's bounded
reaction and could have false-positive alarm if system has streaming data,
mlocked pages or many dirty pages and so on.
Anyway, my point is that I'd like to control page reclaiming in onlyI think on non-shmem file backed pages (case #2) hole punching will be required as well. Though I'm not totally convinced volatile ranges on non-tmpfs files actually makes sense (I still have yet to understand a use case).
kernel itself. For it, userspace can register their volatile or
reclaimable memory ranges to kernel and define to the threshold.
If kernel find memory is below threshold user defined, kernel can
reclaim every pages in registered range freely.
It means kernel has a ownership of page freeing. It makes system more
deterministic and not out-of-control.
So vrange system call's semantic is following as.
1. vrange for anonymous page -> Discard wthout swapout
2. vrange for file-backed page except shmem/tmpfs -> Discard without sync
3. vrange for shmem/tmpfs -> hole punching