From: Maxim Patlasov <mpatlasov@virtuozzo.com>
To: "Nikolaus@rath.org >> Nikolaus Rath" <Nikolaus@rath.org>
Cc: <fuse-devel@lists.sourceforge.net>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>, <mszeredi@redhat.com>
Subject: Re: [fuse-devel] fuse: max_background and congestion_threshold settings
Date: Tue, 22 Nov 2016 15:24:53 -0800 [thread overview]
Message-ID: <8484b43a-881e-5da6-f044-9da6597e76db@virtuozzo.com> (raw)
In-Reply-To: <877f7vcewf.fsf@thinkpad.rath.org>
On 11/22/2016 02:45 PM, Nikolaus Rath wrote:
> On Nov 16 2016, Maxim Patlasov <mpatlasov@virtuozzo.com> wrote:
>> On 11/16/2016 12:19 PM, Nikolaus Rath wrote:
>>
>>> On Nov 16 2016, Maxim Patlasov <mpatlasov@virtuozzo.com> wrote:
>>>> On 11/16/2016 11:19 AM, Nikolaus Rath wrote:
>>>>
>>>>> Hi Maxim,
>>>>>
>>>>> On Nov 15 2016, Maxim Patlasov <mpatlasov@virtuozzo.com> wrote:
>>>>>> On 11/15/2016 08:18 AM, Nikolaus Rath wrote:
>>>>>>> Could someone explain to me the meaning of the max_background and
>>>>>>> congestion_threshold settings of the fuse module?
>>>>>>>
>>>>>>> At first I assumed that max_background specifies the maximum number of
>>>>>>> pending requests (i.e., requests that have been send to userspace but
>>>>>>> for which no reply was received yet). But looking at fs/fuse/dev.c, it
>>>>>>> looks as if not every request is included in this number.
>>>>>> fuse uses max_background for cases where the total number of
>>>>>> simultaneous requests of given type is not limited by some other
>>>>>> natural means. AFAIU, these cases are: 1) async processing of direct
>>>>>> IO; 2) read-ahead. As an example of "natural" limitation: when
>>>>>> userspace process blocks on a sync direct IO read/write, the number of
>>>>>> requests fuse consumed is limited by the number of such processes
>>>>>> (actually their threads). In contrast, if userspace requests 1GB
>>>>>> direct IO read/write, it would be unreasonable to issue 1GB/128K==8192
>>>>>> fuse requests simultaneously. That's where max_background steps in.
>>>>> Ah, that makes sense. Are these two cases meant as examples, or is that
>>>>> an exhaustive list? Because I would have thought that other cases should
>>>>> be writing of cached data (when writeback caching is enabled), and
>>>>> asynchronous I/O from userspace...?
>>>> I think that's exhaustive list, but I can miss something.
>>>>
>>>> As for writing of cached data, that definitely doesn't go through
>>>> background requests. Here we rely on flusher: fuse will allocate as
>>>> many requests as the flusher wants to writeback.
>>>>
>>>> Buffered AIO READs actually block in submit_io until fully
>>>> processed. So it's just another example of "natural" limitation I told
>>>> above.
>>> Not sure I understand. What is it that's blocking? It can't be the
>>> userspace process, because then it wouldn't be asynchronous I/O...
>> Surprise! Alas, Linux kernel does NOT process buffered AIO reads in
>> async manner. You can verify it yourself by strace-ing a simple
>> program looping over io_submit + io_getevents: for direct IO (as
>> expected) io_submit returns immediately while io_getevents waits for
>> actual IO; in contrast, for buffered IO (surprisingly) io_submit waits
>> for actual IO while io_getevents returns immediately. Presumably,
>> people are supposed to use mmap-ed read/writes rather than buffered
>> AIO.
> What about buffered, asynchronous writes when writeback cache is
> disabled? It sounds as if io_submit does not block (so userspace could
> create an unlimited number), nor can the kernel coalesce them (since
> writeback caching is disabled).
I've never looked closely at it. Do you have a particular use case or
concern?
>
> Thanks!
> -Nikolaus
>
next prev parent reply other threads:[~2016-11-23 4:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-15 16:18 fuse: max_background and congestion_threshold settings Nikolaus Rath
2016-11-15 17:38 ` [fuse-devel] " Maxim Patlasov
2016-11-16 19:19 ` Nikolaus Rath
2016-11-16 19:56 ` Maxim Patlasov
2016-11-16 20:19 ` Nikolaus Rath
2016-11-16 20:41 ` Maxim Patlasov
2016-11-22 22:45 ` Nikolaus Rath
2016-11-22 23:24 ` Maxim Patlasov [this message]
2016-11-22 23:43 ` Nikolaus Rath
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=8484b43a-881e-5da6-f044-9da6597e76db@virtuozzo.com \
--to=mpatlasov@virtuozzo.com \
--cc=Nikolaus@rath.org \
--cc=fuse-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mszeredi@redhat.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;
as well as URLs for NNTP newsgroup(s).