From: "Maxim V. Patlasov" <mpatlasov@parallels.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: <dev@parallels.com>, <xemul@parallels.com>,
<fuse-devel@lists.sourceforge.net>, <bfoster@redhat.com>,
<linux-kernel@vger.kernel.org>, <devel@openvz.org>
Subject: Re: [PATCH 0/3] fuse: fix accounting background requests
Date: Thu, 21 Mar 2013 17:04:46 +0400 [thread overview]
Message-ID: <514B056E.7040802@parallels.com> (raw)
In-Reply-To: <CAJfpegsKDYrZKJ2TLzMfpx+vgF=cNvdBFjVnTZi1zuqTPwd7YA@mail.gmail.com>
02/06/2013 09:12 PM, Miklos Szeredi пишет:
> On Wed, Dec 26, 2012 at 1:44 PM, Maxim Patlasov <mpatlasov@parallels.com> wrote:
>> Hi,
>>
>> The feature was added long time ago (commit 08a53cdc...) with the comment:
>>
>>> A task may have at most one synchronous request allocated. So these requests
>>> need not be otherwise limited.
>>>
>>> However the number of background requests (release, forget, asynchronous
>>> reads, interrupted requests) can grow indefinitely. This can be used by a
>>> malicous user to cause FUSE to allocate arbitrary amounts of unswappable
>>> kernel memory, denying service.
>>>
>>> For this reason add a limit for the number of background requests, and block
>>> allocations of new requests until the number goes bellow the limit.
>> However, the implementation suffers from the following problems:
>>
>> 1. Latency of synchronous requests. As soon as fc->num_background hits the
>> limit, all allocations are blocked: both for synchronous and background
>> requests. This is unnecessary - as the comment cited above states, synchronous
>> requests need not be limited (by fuse). Moreover, sometimes it's very
>> inconvenient. For example, a dozen of tasks aggressively writing to mmap()-ed
>> area may block 'ls' for long while (>1min in my experiments).
>>
>> 2. Thundering herd problem. When fc->num_background falls below the limit,
>> request_end() calls wake_up_all(&fc->blocked_waitq). This wakes up all waiters
>> while it's not impossible that the first waiter getting new request will
>> immediately put it to background increasing fc->num_background again.
>> (experimenting with mmap()-ed writes I observed 2x slowdown as compared with
>> fuse after applying this patch-set)
>>
>> The patch-set re-works fuse_get_req (and its callers) to throttle only requests
>> intended for background processing. Having this done, it becomes possible to
>> use exclusive wakeups in chained manner: request_end() wakes up a waiter,
>> the waiter allocates new request and submits it for background processing,
>> the processing ends in request_end() where another wakeup happens an so on.
> Thanks. These patches look okay.
>
> But they don't apply to for-next. Can you please update them?
Sorry for long delay. I'll send updated patches soon.
Thanks,
Maxim
>
> Thanks,
> Miklos
>
>> Thanks,
>> Maxim
>>
>> ---
>>
>> Maxim Patlasov (3):
>> fuse: make request allocations for background processing explicit
>> fuse: skip blocking on allocations of synchronous requests
>> fuse: implement exclusive wakeup for blocked_waitq
>>
>>
>> fs/fuse/cuse.c | 2 +-
>> fs/fuse/dev.c | 60 +++++++++++++++++++++++++++++++++++++++++-------------
>> fs/fuse/file.c | 5 +++--
>> fs/fuse/fuse_i.h | 3 +++
>> fs/fuse/inode.c | 1 +
>> 5 files changed, 54 insertions(+), 17 deletions(-)
>>
>> --
>> Signature
prev parent reply other threads:[~2013-03-21 13:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-26 12:44 [PATCH 0/3] fuse: fix accounting background requests Maxim Patlasov
2012-12-26 12:44 ` [PATCH 1/3] fuse: make request allocations for background processing explicit Maxim Patlasov
2012-12-26 12:44 ` [PATCH 2/3] fuse: skip blocking on allocations of synchronous requests Maxim Patlasov
2012-12-26 12:45 ` [PATCH 3/3] fuse: implement exclusive wakeup for blocked_waitq Maxim Patlasov
2013-02-06 17:12 ` [PATCH 0/3] fuse: fix accounting background requests Miklos Szeredi
2013-03-21 13:04 ` Maxim V. Patlasov [this message]
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=514B056E.7040802@parallels.com \
--to=mpatlasov@parallels.com \
--cc=bfoster@redhat.com \
--cc=dev@parallels.com \
--cc=devel@openvz.org \
--cc=fuse-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=xemul@parallels.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