linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michel Lespinasse <walken@google.com>
To: linux-mm <linux-mm@kvack.org>
Subject: Re: RFC: reviving mlock isolation dead code
Date: Sat, 30 Oct 2010 05:48:36 -0700	[thread overview]
Message-ID: <AANLkTikrgUhVNqM0OmZAjA-YXn_WRNPpdtFWKB+H3iDR@mail.gmail.com> (raw)
In-Reply-To: <AANLkTik4NM5YOgh48bOWDQZuUKmEHLH6Ja10eOzn-_tj@mail.gmail.com>

On Sat, Oct 30, 2010 at 3:16 AM, Michel Lespinasse <walken@google.com> wrote:
> The following code at the bottom of try_to_unmap_one appears to be dead:
>
>  out_mlock:
>        pte_unmap_unlock(pte, ptl);
>
>        /*
>         * We need mmap_sem locking, Otherwise VM_LOCKED check makes
>         * unstable result and race. Plus, We can't wait here because
>         * we now hold anon_vma->lock or mapping->i_mmap_lock.
>         * if trylock failed, the page remain in evictable lru and later
>         * vmscan could retry to move the page to unevictable lru if the
>         * page is actually mlocked.
>         */
>        if (down_read_trylock(&vma->vm_mm->mmap_sem)) {
>                if (vma->vm_flags & VM_LOCKED) {
>                        mlock_vma_page(page);
>                        ret = SWAP_MLOCK;
>                }
>                up_read(&vma->vm_mm->mmap_sem);
>        }
>        return ret;

All right, not entirely dead - Documentation/vm/unevictable-lru.txt
actually explains this very well.

But still, the problem remains that lazy mlocking doesn't work while
mmap_sem is exclusively held by a long-running mlock().

> One approach I am considering would be to modify
> __mlock_vma_pages_range() and it call sites so the mmap sem is only
> read-owned while __mlock_vma_pages_range() runs. The mlock handling
> code in try_to_unmap_one() would then be able to acquire the
> mmap_sem() and help, as it is designed to do.

I'm still looking for any comments people might have about this :)

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2010-10-30 12:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-30 10:16 RFC: reviving mlock isolation dead code Michel Lespinasse
2010-10-30 12:48 ` Michel Lespinasse [this message]
2010-11-01  7:05 ` KOSAKI Motohiro
2010-11-09  4:34   ` KOSAKI Motohiro
2010-11-10 12:21     ` Michel Lespinasse
2010-11-14  5:07       ` KOSAKI Motohiro
2010-11-16  1:44         ` Hugh Dickins
2010-11-16  6:50           ` Michel Lespinasse
2010-11-16 23:28             ` Hugh Dickins
2010-11-18 11:16               ` Michel Lespinasse

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=AANLkTikrgUhVNqM0OmZAjA-YXn_WRNPpdtFWKB+H3iDR@mail.gmail.com \
    --to=walken@google.com \
    --cc=linux-mm@kvack.org \
    /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;
as well as URLs for NNTP newsgroup(s).