From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [RFC] fuse writable mmap design
Date: Thu, 15 Nov 2007 20:22:10 +0100 [thread overview]
Message-ID: <1195154530.22457.16.camel@lappy> (raw)
In-Reply-To: <E1IshIR-0000fE-00@dorka.pomaz.szeredi.hu>
On Thu, 2007-11-15 at 17:10 +0100, Miklos Szeredi wrote:
> Fuse page writeback design
> --------------------------
>
> fuse_writepage() allocates a new temporary page with
> GFP_NOFS|__GFP_HIGHMEM. It copies the contents of the original page,
> and queues a WRITE request to the userspace filesystem using this temp
> page.
>
> From the VM's point of view, the writeback is finished instantly: the
> page is removed from the radix trees, and the PageDirty and
> PageWriteback flags are cleared.
>
> The per-bdi writeback count is not decremented until the writeback
> truly completes. And there's a new 'nr_writeback_temp' counter, that
> is used to track the global count of these writebacks instead of the
> per-zone NR_WRITEBACK (it could be a new per-zone counter in vm_stat,
> but for simplicity, current code just uses a single atomic counter).
>
> If the writeout was due to memory pressure, in effect this migrates
> data from a full zone to a less full zone.
>
> On dirtying the page, fuse waits for a previous write to finish before
> proceeding. This makes sure, there can only be one temporary page used
> at a time for one cached page.
>
> This approach is wasteful in both memory and CPU bandwidth, so why is
> this complication needed?
>
> The basic problem is that there can be no guarantee about the time in
> which the userspace filesystem will complete a write. It may be buggy
> or even malicious, and fail to complete WRITE requests. We don't want
> unrelated parts of the system to grind to a halt in such cases.
>
> Also a filesystem may need additional resources (particularly memory)
> to complete a WRITE request. There's a great danger of a deadlock if
> that allocation may wait for the writepage to finish.
>
> Currently there are several cases where the kernel can block on page
> writeback:
>
> - allocation order is larger than PAGE_ALLOC_COSTLY_ORDER
> - page migration
> - throttle_vm_writeout (through NR_WRITEBACK)
> - sync(2)
>
> Of course in some cases (fsync, msync) we explicitly want to allow
> blocking. So for these cases new code has to be added to fuse, since
> the VM is not tracking writeback pages for us any more.
I'm somewhat confused by the complexity. Currently we can already have a
lot of dirty pages from FUSE (up to the per BDI dirty limit - so
basically up to the total dirty limit).
How is having them dirty from mmap'ed writes different?
--
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:[~2007-11-15 19:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-15 16:10 Miklos Szeredi
2007-11-15 19:22 ` Peter Zijlstra [this message]
2007-11-15 19:37 ` Miklos Szeredi
2007-11-15 19:42 ` Peter Zijlstra
2007-11-15 19:57 ` Miklos Szeredi
2007-11-15 20:01 ` Peter Zijlstra
2007-11-15 20:11 ` Miklos Szeredi
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=1195154530.22457.16.camel@lappy \
--to=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=miklos@szeredi.hu \
/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