From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Cc: kosaki.motohiro@jp.fujitsu.com,
Andrew Morton <akpm@linux-foundation.org>,
Izik Eidus <ieidus@redhat.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Nick Piggin <npiggin@suse.de>, Rik van Riel <riel@redhat.com>,
Lee Schermerhorn <Lee.Schermerhorn@hp.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 2/6] mm: mlocking in try_to_unmap_one
Date: Wed, 11 Nov 2009 16:56:28 +0900 (JST) [thread overview]
Message-ID: <20091111102400.FD36.A69D9226@jp.fujitsu.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0911102151500.2816@sister.anvils>
Hi Hugh
> @@ -1081,45 +1053,23 @@ static int try_to_unmap_file(struct page
> unsigned long max_nl_cursor = 0;
> unsigned long max_nl_size = 0;
> unsigned int mapcount;
> - unsigned int mlocked = 0;
> - int unlock = TTU_ACTION(flags) == TTU_MUNLOCK;
> -
> - if (MLOCK_PAGES && unlikely(unlock))
> - ret = SWAP_SUCCESS; /* default for try_to_munlock() */
>
> spin_lock(&mapping->i_mmap_lock);
> vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, pgoff, pgoff) {
> - if (MLOCK_PAGES && unlikely(unlock)) {
> - if (!((vma->vm_flags & VM_LOCKED) &&
> - page_mapped_in_vma(page, vma)))
> - continue; /* must visit all vmas */
> - ret = SWAP_MLOCK;
> - } else {
> - ret = try_to_unmap_one(page, vma, flags);
> - if (ret == SWAP_FAIL || !page_mapped(page))
> - goto out;
> - }
> - if (ret == SWAP_MLOCK) {
> - mlocked = try_to_mlock_page(page, vma);
> - if (mlocked)
> - break; /* stop if actually mlocked page */
> - }
> + ret = try_to_unmap_one(page, vma, flags);
> + if (ret != SWAP_AGAIN || !page_mapped(page))
> + goto out;
> }
>
> - if (mlocked)
> + if (list_empty(&mapping->i_mmap_nonlinear))
> goto out;
>
> - if (list_empty(&mapping->i_mmap_nonlinear))
> + /* We don't bother to try to find the munlocked page in nonlinears */
> + if (MLOCK_PAGES && TTU_ACTION(flags) == TTU_MUNLOCK)
> goto out;
I have dumb question.
Does this shortcut exiting code makes any behavior change?
>
> list_for_each_entry(vma, &mapping->i_mmap_nonlinear,
> shared.vm_set.list) {
> - if (MLOCK_PAGES && unlikely(unlock)) {
> - if (!(vma->vm_flags & VM_LOCKED))
> - continue; /* must visit all vmas */
> - ret = SWAP_MLOCK; /* leave mlocked == 0 */
> - goto out; /* no need to look further */
> - }
> if (!MLOCK_PAGES && !(flags & TTU_IGNORE_MLOCK) &&
> (vma->vm_flags & VM_LOCKED))
> continue;
> @@ -1161,10 +1111,9 @@ static int try_to_unmap_file(struct page
> cursor = (unsigned long) vma->vm_private_data;
> while ( cursor < max_nl_cursor &&
> cursor < vma->vm_end - vma->vm_start) {
> - ret = try_to_unmap_cluster(cursor, &mapcount,
> - vma, page);
> - if (ret == SWAP_MLOCK)
> - mlocked = 2; /* to return below */
> + if (try_to_unmap_cluster(cursor, &mapcount,
> + vma, page) == SWAP_MLOCK)
> + ret = SWAP_MLOCK;
> cursor += CLUSTER_SIZE;
> vma->vm_private_data = (void *) cursor;
> if ((int)mapcount <= 0)
> @@ -1185,10 +1134,6 @@ static int try_to_unmap_file(struct page
> vma->vm_private_data = NULL;
> out:
> spin_unlock(&mapping->i_mmap_lock);
> - if (mlocked)
> - ret = SWAP_MLOCK; /* actually mlocked the page */
> - else if (ret == SWAP_MLOCK)
> - ret = SWAP_AGAIN; /* saw VM_LOCKED vma */
> return ret;
> }
>
--
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>
next prev parent reply other threads:[~2009-11-11 7:56 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-10 21:50 [PATCH 0/6] mm: prepare for ksm swapping Hugh Dickins
2009-11-10 21:51 ` [PATCH 1/6] mm: define PAGE_MAPPING_FLAGS Hugh Dickins
2009-11-19 0:25 ` Rik van Riel
2009-11-10 21:55 ` [PATCH 2/6] mm: mlocking in try_to_unmap_one Hugh Dickins
2009-11-11 7:56 ` KOSAKI Motohiro [this message]
2009-11-11 11:36 ` Hugh Dickins
2009-11-13 8:16 ` KOSAKI Motohiro
2009-11-13 8:26 ` KOSAKI Motohiro
2009-11-13 11:50 ` Andrea Arcangeli
2009-11-13 18:00 ` KOSAKI Motohiro
2009-11-15 22:37 ` Hugh Dickins
2009-11-17 2:00 ` KOSAKI Motohiro
2009-11-18 16:32 ` Hugh Dickins
2009-11-13 6:30 ` KOSAKI Motohiro
2009-11-15 22:16 ` Hugh Dickins
2009-11-16 23:34 ` KOSAKI Motohiro
2009-11-10 21:59 ` [PATCH 3/6] mm: CONFIG_MMU for PG_mlocked Hugh Dickins
2009-11-11 1:22 ` KOSAKI Motohiro
2009-11-11 10:48 ` Hugh Dickins
2009-11-11 12:38 ` Andi Kleen
2009-11-10 22:00 ` [PATCH 4/6] mm: pass address down to rmap ones Hugh Dickins
2009-11-10 22:02 ` [PATCH 5/6] mm: stop ptlock enlarging struct page Hugh Dickins
2009-11-10 22:09 ` Peter Zijlstra
2009-11-10 22:24 ` Hugh Dickins
2009-11-10 22:14 ` Peter Zijlstra
2009-11-10 22:29 ` Hugh Dickins
2009-11-10 22:06 ` [PATCH 6/6] mm: sigbus instead of abusing oom Hugh Dickins
2009-11-11 2:37 ` KAMEZAWA Hiroyuki
2009-11-11 2:42 ` KOSAKI Motohiro
2009-11-11 4:35 ` Wu Fengguang
2009-11-11 5:51 ` Minchan Kim
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=20091111102400.FD36.A69D9226@jp.fujitsu.com \
--to=kosaki.motohiro@jp.fujitsu.com \
--cc=Lee.Schermerhorn@hp.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hugh.dickins@tiscali.co.uk \
--cc=ieidus@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=npiggin@suse.de \
--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