[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOQ4uxjpHTerNq70gp+GQP26RijzWOJR1pB+9GxVBSdJyjN1mQ@mail.gmail.com>
Date: Mon, 17 May 2021 16:21:28 +0300
From: Amir Goldstein <amir73il@...il.com>
To: Alessio Balsini <balsini@...roid.com>
Cc: Miklos Szeredi <miklos@...redi.hu>,
Akilesh Kailash <akailash@...gle.com>,
Antonio SJ Musumeci <trapexit@...wn.link>,
David Anderson <dvander@...gle.com>,
Giuseppe Scrivano <gscrivan@...hat.com>,
Jann Horn <jannh@...gle.com>, Jens Axboe <axboe@...nel.dk>,
Martijn Coenen <maco@...roid.com>,
Palmer Dabbelt <palmer@...belt.com>,
Paul Lawrence <paullawrence@...gle.com>,
Peng Tao <bergwolf@...il.com>,
Stefano Duo <duostefano93@...il.com>,
Zimuzo Ezeozue <zezeozue@...gle.com>, wuyan <wu-yan@....com>,
fuse-devel <fuse-devel@...ts.sourceforge.net>,
kernel-team <kernel-team@...roid.com>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RESEND V12 4/8] fuse: Passthrough initialization and release
> I have an ugly patch which uses IDR as Miklos asked, but unfortunately
> I'm facing some performance issues due to the locking mechanisms to keep
> guarantee the RCU consistency. I can post the new patch set as an RFC
> soon for the community to take a look.
> At a glance what happens is:
> - the IDR, one for each fuse_conn, contains pointers to "struct
> fuse_passthrough" containing:
> - fuse_file *: which is using passthrough,
> - file *: native file system file target,
> - cred of the FUSE server,
> - ioctl(PASSTHROUGH_OPEN): updates IDR, requires spinlock:
> - kmalloc(fuse_passthrough), update file and cred,
> - ID = idr_alloc(),
> - return ID,
> - fuse_open reply from FUSE server with passthrough ID: updates IDR,
> requires spinlock:
> - pt = idr_find(ID),
> - update fuse_file with the current fuse_file,
> - update fuse_file->passthrough_id = ID,
> - idr_replace(),
> - read/write/mmap: lock-free IDR read:
> - idr_find(fuse_file::passthrough_id),
> - forward request to lower file system as for the current FUSE
> passthrough patches.
> - ioctl(PASSTHROUGH_CLOSE): updates IDR, requires spinlock:
> - idr_remove();
> - call_rcu(): tell possible open fuse_file user that the ID is no more
> valid and kfree() the allocated struct;
> - close(fuse_file): updates IDR, requires spinlock:
> - ID = fuse_file::passthrough_id
> - idr_find(ID),
> - fuse_passthrough::fuse_file = NULL,
> - idr_replace().
>
> This would be fine if passthrough is activated for a few, big files,
> where the passthrough overhead is dominated by the direct access
> benefits, but if passthrough is enabled for many small files which just
> do one or two read/writes (as what I did for my benchmark of total build
> time for the kernel, where I was passing-through every opened file), the
> overhead becomes a real issue.
>
> If you have any thoughts on how to make this simpler, I'm absolutely
> open to fix this.
>
This IDR namespace usually serves a single process. Right?
It sounds a bit more like a file table, more specifically, like io_file_table.
I may be way off, but this sounds a bit like IORING_REGISTER_FILES.
Is there anything that can be learned from this UAPI?
Maybe even reuse of some of the io_uring file register code?
Thanks,
Amir.
Powered by blists - more mailing lists