Re: [PATCH 0/8][for -mm] mem_notify v6

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Daniel Spång <daniel.spang@...>
Cc: KOSAKI Motohiro <kosaki.motohiro@...>, <linux-mm@...>, <linux-kernel@...>
Date: Wednesday, April 30, 2008 - 10:07 pm

On Wed, Apr 23, 2008 at 1:27 AM, Daniel Spång <daniel.spang@gmail.com> wrote:

Hi Daniel,

You're saying the program's in-core text pages serve as a reserve that
the kernel can discard when it needs some memory, correct?  And that
even if the kernel discards them, it will page them back in as a
matter of course as the program runs, to maintain the reserve?  That
certainly makes sense.

In my case of a Java virtual machine, where I originally saw the
problem, most of the code is interpreted byte codes or jit-compiled
native code, all of which resides not in the text segment but in
anonymous pages that aren't backed by a file, and there is no swap
space.  The actual text segment working set can be very small (memory
allocation, garbage collection, synchronization, other random native
code).  And, as KOSAKI Motohiro pointed out, it may be wise to mlock
these areas.  So the text working set doesn't make an adequate
reserve.

However, I can maintain a reserve of cached and/or mapped memory by
touching pages in the text segment (or any mapped file) as the final
step of low memory notification handling, if the cached page count is
getting low.  For my purposes, this is nearly the same as having an
additional threshold-based notification, since it forces notifications
to occur while the kernel still has some memory to satisfy allocations
while userspace code works to free memory.  And it's simple.

Unfortunately, this is more expensive than it could be since the pages
need to be read in from some device (mapping /dev/zero doesn't cause
pages to be allocated). What I'm looking for now is a cheap way to
populate the cache with pages that the kernel can throw away when it
needs to reclaim memory.

Thanks,
.tom
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/8][for -mm] mem_notify v6, KOSAKI Motohiro, (Sat Feb 9, 11:19 am)
Re: [PATCH 0/8][for -mm] mem_notify v6, Tom May, (Tue Apr 1, 7:35 pm)
Re: [PATCH 0/8][for -mm] mem_notify v6, KOSAKI Motohiro, (Wed Apr 2, 3:31 am)
Re: [PATCH 0/8][for -mm] mem_notify v6, Tom May, (Mon Apr 14, 8:16 pm)
Re: [PATCH 0/8][for -mm] mem_notify v6, KOSAKI Motohiro, (Thu Apr 17, 5:30 am)
Re: [PATCH 0/8][for -mm] mem_notify v6, Tom May, (Thu Apr 17, 3:23 pm)
Re: [PATCH 0/8][for -mm] mem_notify v6, Daniel Spång, (Wed Apr 23, 4:27 am)
Re: [PATCH 0/8][for -mm] mem_notify v6, Tom May, (Wed Apr 30, 10:07 pm)
Re: [PATCH 0/8][for -mm] mem_notify v6, KOSAKI Motohiro, (Thu May 1, 11:06 am)
Re: [PATCH 0/8][for -mm] mem_notify v6, Tom May, (Fri May 2, 6:21 pm)
Re: [PATCH 0/8][for -mm] mem_notify v6, KOSAKI Motohiro, (Sat May 3, 8:26 am)
Re: [PATCH 0/8][for -mm] mem_notify v6, Tom May, (Tue May 6, 1:22 am)
Re: [PATCH 0/8][for -mm] mem_notify v6, KOSAKI Motohiro, (Fri Apr 18, 6:07 am)
Re: [PATCH 0/8][for -mm] mem_notify v6, Tom May, (Mon Apr 21, 4:32 pm)
Re: [PATCH 0/8][for -mm] mem_notify v6, KOSAKI Motohiro, (Tue Apr 15, 10:30 pm)
Re: [PATCH 0/8][for -mm] mem_notify v6, Tom May, (Wed Apr 2, 1:45 pm)
Re: [PATCH 0/8][for -mm] mem_notify v6, Paul Jackson, (Sun Feb 17, 10:49 am)
Re: [PATCH 0/8][for -mm] mem_notify v6, KOSAKI Motohiro, (Tue Feb 19, 3:36 am)
Re: [PATCH 0/8][for -mm] mem_notify v6, Paul Jackson, (Tue Feb 19, 11:00 am)
Re: [PATCH 0/8][for -mm] mem_notify v6, Pavel Machek, (Tue Feb 19, 6:28 pm)
Re: [PATCH 0/8][for -mm] mem_notify v6, Rik van Riel, (Tue Feb 19, 10:07 pm)
Re: [PATCH 0/8][for -mm] mem_notify v6, Paul Jackson, (Wed Feb 20, 12:36 am)
Re: [PATCH 0/8][for -mm] mem_notify v6, KOSAKI Motohiro, (Tue Feb 19, 10:48 pm)
Re: [PATCH 0/8][for -mm] mem_notify v6, Paul Jackson, (Wed Feb 20, 12:57 am)
Re: [PATCH 0/8][for -mm] mem_notify v6, KOSAKI Motohiro, (Wed Feb 20, 1:21 am)
Re: [PATCH 0/8][for -mm] mem_notify v6, Paul Jackson, (Tue Feb 19, 9:54 pm)
Re: [PATCH 0/8][for -mm] mem_notify v6, Rik van Riel, (Tue Feb 19, 3:02 pm)
Re: [PATCH 0/8][for -mm] mem_notify v6, Paul Jackson, (Tue Feb 19, 4:18 pm)
Re: [PATCH 0/8][for -mm] mem_notify v6, Paul Jackson, (Tue Feb 19, 4:43 pm)
[PATCH 0/8][for -mm] mem_notify v6, Jonathan Corbet, (Mon Feb 11, 11:36 am)
Re: [PATCH 0/8][for -mm] mem_notify v6, KOSAKI Motohiro, (Mon Feb 11, 11:46 am)
Re: [PATCH 0/8][for -mm] mem_notify v6, Jon Masters, (Sat Feb 9, 12:02 pm)
Re: [PATCH 0/8][for -mm] mem_notify v6, KOSAKI Motohiro, (Sat Feb 9, 12:33 pm)
Re: [PATCH 0/8][for -mm] mem_notify v6, Rik van Riel, (Sat Feb 9, 12:43 pm)
Re: [PATCH 0/8][for -mm] mem_notify v6, KOSAKI Motohiro, (Sat Feb 9, 12:49 pm)