linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] virtiofs: fix the warning for kernel direct IO
@ 2024-04-26 14:39 Hou Tao
  2024-04-26 14:39 ` [PATCH v3 1/2] virtiofs: use pages instead of pointer " Hou Tao
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Hou Tao @ 2024-04-26 14:39 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Miklos Szeredi, Vivek Goyal, Stefan Hajnoczi, Bernd Schubert,
	Michael S . Tsirkin, Matthew Wilcox, Benjamin Coddington,
	linux-kernel, virtualization, houtao1

From: Hou Tao <houtao1@huawei.com>

Hi,

The patch set aims to fix the warning related to an abnormal size
parameter of kmalloc() in virtiofs. Patch #1 fixes it by introducing
use_pages_for_kvec_io option in fuse_conn and enabling it in virtiofs.
Beside the abnormal size parameter for kmalloc, the gfp parameter is
also questionable: GFP_ATOMIC is used even when the allocation occurs
in a kworker context. Patch #2 fixes it by using GFP_NOFS when the
allocation is initiated by the kworker. For more details, please check
the individual patches.

As usual, comments are always welcome.

Change Log:

v3:
 * introduce use_pages_for_kvec_io for virtiofs. When the option is
   enabled, fuse will use iov_iter_extract_pages() to construct a page
   array and pass the pages array instead of a pointer to virtiofs.
   The benefit is twofold: the length of the data passed to virtiofs is
   limited by max_pages, and there is no memory copy compared with v2.

v2: https://lore.kernel.org/linux-fsdevel/20240228144126.2864064-1-houtao@huaweicloud.com/
  * limit the length of ITER_KVEC dio by max_pages instead of the
    newly-introduced max_nopage_rw. Using max_pages make the ITER_KVEC
    dio being consistent with other rw operations.
  * replace kmalloc-allocated bounce buffer by using a bounce buffer
    backed by scattered pages when the length of the bounce buffer for
    KVEC_ITER dio is larger than PAG_SIZE, so even on hosts with
    fragmented memory, the KVEC_ITER dio can be handled normally by
    virtiofs. (Bernd Schubert)
  * merge the GFP_NOFS patch [1] into this patch-set and use
    memalloc_nofs_{save|restore}+GFP_KERNEL instead of GFP_NOFS
    (Benjamin Coddington)

v1: https://lore.kernel.org/linux-fsdevel/20240103105929.1902658-1-houtao@huaweicloud.com/

[1]: https://lore.kernel.org/linux-fsdevel/20240105105305.4052672-1-houtao@huaweicloud.com/

Hou Tao (2):
  virtiofs: use pages instead of pointer for kernel direct IO
  virtiofs: use GFP_NOFS when enqueuing request through kworker

 fs/fuse/file.c      | 12 ++++++++----
 fs/fuse/fuse_i.h    |  3 +++
 fs/fuse/virtio_fs.c | 25 ++++++++++++++++---------
 3 files changed, 27 insertions(+), 13 deletions(-)

-- 
2.29.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-08-14  7:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-26 14:39 [PATCH v3 0/2] virtiofs: fix the warning for kernel direct IO Hou Tao
2024-04-26 14:39 ` [PATCH v3 1/2] virtiofs: use pages instead of pointer " Hou Tao
2024-05-06  8:01   ` Hou Tao
2024-04-26 14:39 ` [PATCH v3 2/2] virtiofs: use GFP_NOFS when enqueuing request through kworker Hou Tao
2024-05-10 11:19   ` Miklos Szeredi
2024-05-11  1:09     ` Hou Tao
2024-08-14  6:34 ` [PATCH v3 0/2] virtiofs: fix the warning for kernel direct IO Jingbo Xu
2024-08-14  7:46   ` Hou Tao
2024-08-14  7:49     ` Jingbo Xu

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).