All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: Dave Chinner <david@fromorbit.com>
Cc: Jan Kara <jack@suse.cz>, linux-fsdevel@vger.kernel.org
Subject: Re: hole-punch vs fault
Date: Fri, 29 Nov 2013 06:11:55 -0700	[thread overview]
Message-ID: <20131129131154.GA11106@parisc-linux.org> (raw)
In-Reply-To: <20131128221246.GQ8803@dastard>

On Fri, Nov 29, 2013 at 09:12:46AM +1100, Dave Chinner wrote:
> Indeed, we've already discussed this at length - if we are going to
> introduce a new method of synchronisation between mmap and
> holepunch, then we cannot ignore all the other mmap vs IO
> synchronisation problems we have that are caused by the same issue.
> Hacking workarounds into the holepunch/mmap paths is not a robust or
> maintainable solution.

This isn't hacking in a workaround.  This is a solution to the problem
that assumes holepunches are rare, and it's OK to make the fault path retry
if a holepunch happened.  I agree it needs to be documented and the exact
details of what is protected by i_damaged_mutex needs to be clear.

> 	a) it is a entire file lock and truncate/holepunch do not
> 	   affect the entire scope of the file. i.e. there is no
> 	   reason why holepunch cannot run concurrently with IO if
> 	   they are to different ranges of a file.

Yes, if we care about the scalability of truncate and holepunch.  I really
don't think that's an important workload.

> 	b) it increases the struct inode by at least 5%. If we are
> 	   going to increase the inode by that much, we better make
> 	   sure we solve more than one isolated, relatively rare
> 	   corner case behaviour.

About 7% (568 -> 608 bytes) with my .config (SMP, SPIN_ON_OWNER,
!DEBUG_MUTEXES, !DEBUG_LOCK_ALLOC).  I rearranged the order (thanks,
pahole!) to put i_damage in the hole created by private_lock.

I'm solving two cases here, one is holepunch vs fault for regular files.
The other is truncate vs fault for XIP files, which is probably
a little less rare.  I think the same mechanism can be used when a
filesystem is doing a defragment or otherwise moving blocks around on
an XIP block device.  Look, I'm not attached to the i_damage solution,
but I do need something to protect against truncate vs fault on XIP.
Fixing holepunch vs fault too just felt like the right thing to do.

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

  reply	other threads:[~2013-11-29 13:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-27 13:48 hole-punch vs fault Matthew Wilcox
2013-11-27 22:19 ` Jan Kara
2013-11-28  2:33   ` Matthew Wilcox
2013-11-28  3:30     ` Matthew Wilcox
2013-11-28  4:22     ` Dave Chinner
2013-11-28  4:44     ` Matthew Wilcox
2013-11-28 12:24       ` Matthew Wilcox
2013-11-28 22:12       ` Dave Chinner
2013-11-29 13:11         ` Matthew Wilcox [this message]
2013-12-01 21:52           ` Dave Chinner
2013-12-02  8:33             ` Jan Kara
2013-12-02 15:58               ` Matthew Wilcox
2013-12-02 20:11                 ` Jan Kara
2013-12-02 20:13                 ` Matthew Wilcox
2013-12-02 23:13                   ` Jan Kara

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=20131129131154.GA11106@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=david@fromorbit.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.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 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.