[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5253544f-9855-af61-1d67-69b599ddefb9@huaweicloud.com>
Date: Sat, 11 May 2024 09:09:53 +0800
From: Hou Tao <houtao@...weicloud.com>
To: Miklos Szeredi <miklos@...redi.hu>
Cc: linux-fsdevel@...r.kernel.org, Vivek Goyal <vgoyal@...hat.com>,
Stefan Hajnoczi <stefanha@...hat.com>,
Bernd Schubert <bernd.schubert@...tmail.fm>,
"Michael S . Tsirkin" <mst@...hat.com>, Matthew Wilcox
<willy@...radead.org>, Benjamin Coddington <bcodding@...hat.com>,
linux-kernel@...r.kernel.org, virtualization@...ts.linux.dev,
houtao1@...wei.com
Subject: Re: [PATCH v3 2/2] virtiofs: use GFP_NOFS when enqueuing request
through kworker
Hi,
On 5/10/2024 7:19 PM, Miklos Szeredi wrote:
> On Fri, 26 Apr 2024 at 16:38, Hou Tao <houtao@...weicloud.com> wrote:
>> From: Hou Tao <houtao1@...wei.com>
>>
>> When invoking virtio_fs_enqueue_req() through kworker, both the
>> allocation of the sg array and the bounce buffer still use GFP_ATOMIC.
>> Considering the size of the sg array may be greater than PAGE_SIZE, use
>> GFP_NOFS instead of GFP_ATOMIC to lower the possibility of memory
>> allocation failure and to avoid unnecessarily depleting the atomic
>> reserves. GFP_NOFS is not passed to virtio_fs_enqueue_req() directly,
>> GFP_KERNEL and memalloc_nofs_{save|restore} helpers are used instead.
> Makes sense.
>
> However, I don't understand why the GFP_NOFS behavior is optional. It
> should work when queuing the request for the first time as well, no?
No. fuse_request_queue_background() may call queue_request_and_unlock()
with fc->bg_lock being held and bg_lock is a spin-lock, so as for now it
is bad to call kmalloc(GFP_NOFS) with a spin-lock being held. The
acquisition of fc->bg_lock inĀ fuse_request_queue_background() may could
be optimized, but I will leave it for future work.
> Thanks,
> Miklos
> .
Powered by blists - more mailing lists