From: Rik van Riel <riel@redhat.com>
To: Michel Lespinasse <walken@google.com>
Cc: linux-mm@kvack.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Ying Han <yinghan@google.com>,
linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Hugh Dickins <hughd@google.com>
Subject: Re: [PATCH 2/2] Release mmap_sem when page fault blocks on disk transfer.
Date: Fri, 01 Oct 2010 10:06:59 -0400 [thread overview]
Message-ID: <4CA5EB03.1070403@redhat.com> (raw)
In-Reply-To: <1285909484-30958-3-git-send-email-walken@google.com>
On 10/01/2010 01:04 AM, Michel Lespinasse wrote:
> This change reduces mmap_sem hold times that are caused by waiting for
> disk transfers when accessing file mapped VMAs. It introduces the
> VM_FAULT_RELEASED flag, which indicates that the call site holds mmap_lock
> and wishes for it to be released if blocking on a pending disk transfer.
> In that case, filemap_fault() returns the VM_FAULT_RELEASED status bit
> and do_page_fault() will then re-acquire mmap_sem and retry the page fault.
> It is expected that the retry will hit the same page which will now be cached,
> and thus it will complete with a low mmap_sem hold time.
The concept makes sense. A nitpick, though...
> + if (release_flag) { /* Did not go through a retry */
> + if (fault& VM_FAULT_MAJOR) {
> + tsk->maj_flt++;
> + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0,
> + regs, address);
> + } else {
> + tsk->min_flt++;
> + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0,
> + regs, address);
> + }
> + if (fault& VM_FAULT_RELEASED) {
> + /*
> + * handle_mm_fault() found that the desired page was
> + * locked. We asked for it to release mmap_sem in that
> + * case, so as to avoid holding it for too long.
> + * Retry starting at the mmap_sem acquire, this time
> + * without FAULT_FLAG_RETRY so that we avoid any
> + * risk of starvation.
> + */
> + release_flag = 0;
> + goto retry;
> + }
Do we really want to count a minor page fault when we
got VM_FAULT_RELEASED?
--
All rights reversed
WARNING: multiple messages have this Message-ID (diff)
From: Rik van Riel <riel@redhat.com>
To: Michel Lespinasse <walken@google.com>
Cc: linux-mm@kvack.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Ying Han <yinghan@google.com>,
linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Hugh Dickins <hughd@google.com>
Subject: Re: [PATCH 2/2] Release mmap_sem when page fault blocks on disk transfer.
Date: Fri, 01 Oct 2010 10:06:59 -0400 [thread overview]
Message-ID: <4CA5EB03.1070403@redhat.com> (raw)
In-Reply-To: <1285909484-30958-3-git-send-email-walken@google.com>
On 10/01/2010 01:04 AM, Michel Lespinasse wrote:
> This change reduces mmap_sem hold times that are caused by waiting for
> disk transfers when accessing file mapped VMAs. It introduces the
> VM_FAULT_RELEASED flag, which indicates that the call site holds mmap_lock
> and wishes for it to be released if blocking on a pending disk transfer.
> In that case, filemap_fault() returns the VM_FAULT_RELEASED status bit
> and do_page_fault() will then re-acquire mmap_sem and retry the page fault.
> It is expected that the retry will hit the same page which will now be cached,
> and thus it will complete with a low mmap_sem hold time.
The concept makes sense. A nitpick, though...
> + if (release_flag) { /* Did not go through a retry */
> + if (fault& VM_FAULT_MAJOR) {
> + tsk->maj_flt++;
> + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0,
> + regs, address);
> + } else {
> + tsk->min_flt++;
> + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0,
> + regs, address);
> + }
> + if (fault& VM_FAULT_RELEASED) {
> + /*
> + * handle_mm_fault() found that the desired page was
> + * locked. We asked for it to release mmap_sem in that
> + * case, so as to avoid holding it for too long.
> + * Retry starting at the mmap_sem acquire, this time
> + * without FAULT_FLAG_RETRY so that we avoid any
> + * risk of starvation.
> + */
> + release_flag = 0;
> + goto retry;
> + }
Do we really want to count a minor page fault when we
got VM_FAULT_RELEASED?
--
All rights reversed
--
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:[~2010-10-01 14:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-01 5:04 [PATCH 0/2] Reduce mmap_sem hold times during file backed page faults Michel Lespinasse
2010-10-01 5:04 ` Michel Lespinasse
2010-10-01 5:04 ` [PATCH 1/2] Unique path for locking page in filemap_fault() Michel Lespinasse
2010-10-01 5:04 ` Michel Lespinasse
2010-10-01 5:04 ` [PATCH 2/2] Release mmap_sem when page fault blocks on disk transfer Michel Lespinasse
2010-10-01 5:04 ` Michel Lespinasse
2010-10-01 14:06 ` Rik van Riel [this message]
2010-10-01 14:06 ` Rik van Riel
2010-10-01 15:31 ` Linus Torvalds
2010-10-01 15:31 ` Linus Torvalds
2010-10-01 23:06 ` Michel Lespinasse
2010-10-01 23:06 ` Michel Lespinasse
2010-10-02 0:02 ` Linus Torvalds
2010-10-02 0:02 ` Linus Torvalds
2010-10-01 12:07 ` [PATCH 0/2] Reduce mmap_sem hold times during file backed page faults Rik van Riel
2010-10-01 12:07 ` Rik van Riel
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=4CA5EB03.1070403@redhat.com \
--to=riel@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterz@infradead.org \
--cc=torvalds@linux-foundation.org \
--cc=walken@google.com \
--cc=yinghan@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.