Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp371061rdb; Fri, 5 Jan 2024 12:43:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IEtcZCrGUIicppPAFfZds1MQCGE8xxxm21aTgXKh/NkiSwpqsgTUaheAcEOD6iPOcPloXO2 X-Received: by 2002:a05:622a:102:b0:429:7b8e:c1d8 with SMTP id u2-20020a05622a010200b004297b8ec1d8mr77451qtw.0.1704487432045; Fri, 05 Jan 2024 12:43:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704487432; cv=none; d=google.com; s=arc-20160816; b=lGDYjuo+SMT55snyGGMvBltcSdI5g2nYLLBVbSJNZ4LO9s0HmG4/yRvJLxKYpYcS1M 7c5FLh04DzYLDhJWWIeUBxb64pNNG92IvTCQXm+rowQrr0zna7nACqZoyUbIQHVaSTxY oCt/dhSWgDeQ3rDLUqVFIk3iI4SFDqI00rc+rLxvI4FUHh+pYeouVeVVY9zq3m6p27fC 8eFOuj/jNy/6PYcVwVrX5xkXiQN7ocAEZPSDhiFpAw4UfwEy+d0bSEzRKlAoOfjh+kcl cDs9N9biSzOwNVVrlT2ZJ3Rvd9qylXVQ73OkluIb1H/HsDwqT7aSVg0iF3KYsnG5gund V+Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=IXoAVCkoEpEA5h3FLI3eSkWAzRef2kLAyGV2xcy6gn4=; fh=ZiQsjyLNcKyHswrAhUjMPAa4zxuCSv0az/kyHVVolcc=; b=USQwlcBwrRYqyLt6RDk3Yn3WX7S97ByDmoTOUYEVU130MeIPZSEPrK7vwQTIhiSJPq u7W8JvAh8+6vzUqx3OXZSiUlMtrdEWaOO7mkKMO3oE84GiR2X3gUNCEKJjbGe2r0Kt1B FTqLWh2kwZMoHNB4GvEa2m9/PE/53rvkCISJYcP5HXs0r2QVpWyvDHYxwUOe/fLHQ1qj lh0pHZPfZ7/fymqFxLSIrAeTCuoUHRo4YgpXWmGznu7b6c0kUtzwAxszbPjNFZd46RGI +cHBvrsj8YpQfFCZNc3hlYS+ypMZo67N76d2I3BRc+5gS5Ep63V3j4BT504CzLzRJS2m B41Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jPvHm4cA; spf=pass (google.com: domain of linux-kernel+bounces-18347-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18347-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id t15-20020a05622a180f00b00427f2996110si2592161qtc.376.2024.01.05.12.43.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 12:43:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18347-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jPvHm4cA; spf=pass (google.com: domain of linux-kernel+bounces-18347-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18347-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C89BA1C235F2 for ; Fri, 5 Jan 2024 20:43:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 01164364C0; Fri, 5 Jan 2024 20:41:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="jPvHm4cA" X-Original-To: linux-kernel@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B91FC20B21 for ; Fri, 5 Jan 2024 20:41:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704487313; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=IXoAVCkoEpEA5h3FLI3eSkWAzRef2kLAyGV2xcy6gn4=; b=jPvHm4cAU6yszFGbmeHtvbrrPdDCk3k/sl2oaaE35IIY+4radox2nREI0p3u9G2+Jbwwv/ WrWmfAa8/3d+f0fzGJCgKvU5WTV3MEVIYewcHVIFLUU5ylCjdAWppz5ORINTG9sSUxfdzW FyrgaJXjPT+S7fJPGyL7dKB5sfiEKZc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-131-4KEFV3L1NWaTJfcbAeu1bw-1; Fri, 05 Jan 2024 15:41:50 -0500 X-MC-Unique: 4KEFV3L1NWaTJfcbAeu1bw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 86F16845DC3; Fri, 5 Jan 2024 20:41:49 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.8.247]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 52B8BC15A0C; Fri, 5 Jan 2024 20:41:49 +0000 (UTC) Received: by fedora.redhat.com (Postfix, from userid 1000) id 9D37728EBDA; Fri, 5 Jan 2024 15:41:48 -0500 (EST) Date: Fri, 5 Jan 2024 15:41:48 -0500 From: Vivek Goyal To: Matthew Wilcox Cc: Hou Tao , linux-fsdevel@vger.kernel.org, Miklos Szeredi , Stefan Hajnoczi , linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, houtao1@huawei.com Subject: Re: [PATCH v2] virtiofs: use GFP_NOFS when enqueuing request through kworker Message-ID: References: <20240105105305.4052672-1-houtao@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 On Fri, Jan 05, 2024 at 08:21:00PM +0000, Matthew Wilcox wrote: > On Fri, Jan 05, 2024 at 03:17:19PM -0500, Vivek Goyal wrote: > > On Fri, Jan 05, 2024 at 06:53:05PM +0800, Hou Tao wrote: > > > From: Hou Tao > > > > > > 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 both the sg array and the bounce buffer may be > > > greater than PAGE_SIZE, use GFP_NOFS instead of GFP_ATOMIC to lower the > > > possibility of memory allocation failure. > > > > > > > What's the practical benefit of this patch. Looks like if memory > > allocation fails, we keep retrying at interval of 1ms and don't > > return error to user space. > > You don't deplete the atomic reserves unnecessarily? Sounds reasonable. With GFP_NOFS specificed, can we still get -ENOMEM? Or this will block indefinitely till memory can be allocated. I am trying to figure out with GFP_NOFS, do we still need to check for -ENOMEM while requeuing the req and asking worker thread to retry after 1ms. Thanks Vivek