Re: Should FUSE set IO_FLUSHER for the userspace process?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 26 Oct 2022 at 13:58, Miklos Szeredi <miklos@xxxxxxxxxx> wrote:
>
> On Tue, 25 Oct 2022 at 17:39, Antonio SJ Musumeci <trapexit@xxxxxxxxxx> wrote:
> >
> > On 9/19/22 05:20, Miklos Szeredi wrote:
> > > On Sun, 18 Sept 2022 at 13:03, Nikolaus Rath <Nikolaus@xxxxxxxx> wrote:
> > >> Hi,
> > >>
> > >> Should the FUSE kernel driver perhaps set PR_SET_IO_FLUSHER for the FUSE
> > >> userspace process daemon when a connection is opened?
> > >>
> > >> If I understand correctly, this is necessary to avoid a deadlocks if the
> > >> kernel needs to reclaim memory that has to be written back through FUSE.
> > > The fuse kernel driver is careful to avoid such deadlocks.  When
> > > memory reclaim happens, it copies data to temporary buffers and
> > > immediately finishes the reclaim from the memory management
> > > subsystem's point of view.   The temp buffers are then sent to
> > > userspace and written back without having to worry about deadlocks.
> > > There are lots of details missing from the above description, but this
> > > is the essence of the writeback deadlock avoidance.
> > >
> > > Thanks,
> > > Miklos
> >
> > Miklos, does this mean that FUSE servers shouldn't bother setting
> > PR_SET_IO_FLUSHER? Are there any benefits to setting it explicitly or
> > detriments to not setting it?
>
> PR_SET_IO_FLUHSER internally sets the process flags PF_MEMALLOC_NOIO
> and PF_LOCAL_THROTTLE.
>
> The former is clear: don't try to initiate I/O when memory needs to be
> reclaimed.  This could be detrimental in low memory situations, since
> the kernel has less choice for freeing up memory.
>
> PF_LOCAL_THROTTLE  seems to mean "don't throttle dirtying pages
> (writes) by this process, since that would throttle the cleaning of
> dirty pages."   This logic seems valid for fuse as well, but it also
> upsets the normal dirty throttling mechanisms, so I'm not sure that
> there aren't any side effects.

Also consider:  when a fuse page is under writeback, it's already
accounted as "clean" for the purposes reclaim and for throttling other
dirtiers.  Throttling of fuse fuse writeback pages (NR_WRITEBACK_TEMP)
is done completely separately.

So I'd say, it's better not to set PR_SET_IO_FLUSHER on the fuse
daemon, although there probably wouldn't be any catastrophic
consequences of setting it.

Thanks,
Miklos



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux