linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: lsf-pc@lists.linux-foundation.org
Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org
Subject: [LSF/MM TOPIC] mmap_sem in ->fault and ->page_mkwrite
Date: Thu, 31 Jan 2013 23:23:35 +0100	[thread overview]
Message-ID: <20130131222335.GA13525@quack.suse.cz> (raw)

  Hi,

  I'm not sure if this is such a great topic but it's a question which
I came across a few times already and LSF/MM is a good place for
brainstorming somewhat crazy ideas ;).

So currently ->fault() and ->page_mkwrite() are called under mmap_sem held
for reading. Now this creates sometimes unpleasant locking dependencies for
filesystems (modern filesystems have to do an equivalent of ->write_begin
in ->page_mkwrite and that is a non-trivial operation). Just to mention my
last itch, I had to split reader side of filesystem freezing lock into two
locks - one which ranks above mmap_sem and one which ranks below it. Then
writer side has to wait for both locks. It works but ...

So I was wondering: Would it be somehow possible we could drop mmap_sem in
these two callbacks (especially ->page_mkwrite())? I understand process'
mapping can change under us once we drop the semaphore so we'd have to
somehow recheck we have still the right page after re-taking mmap_sem. Like
if we protected VMAs with SRCU so that they don't disappear under us once
we drop mmap_sem and after retaking mmap_sem we would recheck whether VMA
still applies to our fault.

And I know there's VM_FAULT_RETRY but that really seems like a special hack
for x86 architecture page fault code. Making it work for all architectures
and callers such as get_user_pages() didn't really seem plausible to me.

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

--
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:[~2013-01-31 22:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-31 22:23 Jan Kara [this message]
2013-01-31 23:03 ` [LSF/MM TOPIC] mmap_sem in ->fault and ->page_mkwrite Al Viro
2013-02-04 18:04   ` Jan Kara
2013-02-09  5:51     ` 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=20130131222335.GA13525@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lsf-pc@lists.linux-foundation.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).