public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Martin J. Bligh" <mbligh@mbligh.org>
To: Christoph Hellwig <hch@infradead.org>,
	Christoph Lameter <clameter@sgi.com>,
	linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	Nick Piggin <nickpiggin@yahoo.com.au>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Rik van Riel <riel@redhat.com>
Subject: Re: [RFC] Tracking mlocked pages and moving them off the LRU
Date: Sat, 03 Feb 2007 07:35:59 -0800	[thread overview]
Message-ID: <45C4ABDF.9050701@mbligh.org> (raw)
In-Reply-To: <20070203101628.GB28806@infradead.org>

Christoph Hellwig wrote:
> On Fri, Feb 02, 2007 at 10:20:12PM -0800, Christoph Lameter wrote:
>> This is a new variation on the earlier RFC for tracking mlocked pages.
>> We now mark a mlocked page with a bit in the page flags and remove
>> them from the LRU. Pages get moved back when no vma that references
>> the page has VM_LOCKED set anymore.
>>
>> This means that vmscan no longer uselessly cycles over large amounts
>> of mlocked memory should someone attempt to mlock large amounts of
>> memory (may even result in a livelock on large systems).
>>
>> Synchronization is build around state changes of the PageMlocked bit.
>> The NR_MLOCK counter is incremented and decremented based on
>> state transitions of PageMlocked. So the count is accurate.
>>
>> There is still some unfinished business:
>>
>> 1. We use the 21st page flag and we only have 20 on 32 bit NUMA platforms.
>>
>> 2. Since mlocked pages are now off the LRU page migration will no longer
>>    move them.
>>
>> 3. Use NR_MLOCK to tune various VM behaviors so that the VM does not 
>>    longer fall due to too many mlocked pages in certain areas.
> 
> This patch seems to not handle the cases where more than one process mlocks
> a page and you really need a pincount in the page to not release it before
> all processes have munlock it or died.  I did a similar patch a while
> ago and tried to handle it by overloading the lru lists pointers with
> a pincount, but at some point I gave up because I couldn't get that part
> right.

Doesn't matter - you can just do it lazily. If you find a page that is
locked, move it to the locked list. when unlocking a page you *always*
move it back to the normal list. If someone else is still locking it,
we'll move it back to the lock list on next reclaim pass.

I have a half-finished patch from 6 months ago that does this, but never
found time to complete it ;-(

M.

  reply	other threads:[~2007-02-03 15:36 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-03  6:20 [RFC] Tracking mlocked pages and moving them off the LRU Christoph Lameter
2007-02-03  8:53 ` Andrew Morton
2007-02-03 17:56   ` Christoph Lameter
2007-02-03 18:04     ` Arjan van de Ven
2007-02-03 18:09       ` Christoph Lameter
2007-02-03 18:55       ` Christoph Lameter
2007-02-03 19:03       ` Christoph Lameter
2007-02-04  1:22         ` Andrew Morton
2007-02-04  1:49           ` Christoph Lameter
2007-02-04  8:16             ` Arjan van de Ven
2007-02-05  6:45               ` Christoph Lameter
2007-02-06 22:05                 ` Nate Diller
2007-02-07  8:02                   ` Christoph Lameter
2007-02-07 18:39                     ` Nate Diller
2007-02-05  7:57               ` Christoph Lameter
2007-02-05  8:39                 ` Arjan van de Ven
2007-02-05 16:38                   ` Matt Mackall
2007-02-05 17:34                     ` Christoph Lameter
2007-02-05 19:04                     ` Christoph Lameter
2007-02-05 17:33                   ` Christoph Lameter
2007-02-03 22:58   ` Nigel Cunningham
2007-02-03 10:16 ` Christoph Hellwig
2007-02-03 15:35   ` Martin J. Bligh [this message]
2007-02-03 17:59     ` Christoph Lameter
2007-02-03 17:33   ` Christoph Lameter
2007-02-03 22:56 ` Nigel Cunningham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45C4ABDF.9050701@mbligh.org \
    --to=mbligh@mbligh.org \
    --cc=akpm@linux-foundation.org \
    --cc=clameter@sgi.com \
    --cc=hch@infradead.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=riel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox