From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D444CE7B10 for ; Thu, 28 Sep 2023 09:22:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231778AbjI1JWv (ORCPT ); Thu, 28 Sep 2023 05:22:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231535AbjI1JWi (ORCPT ); Thu, 28 Sep 2023 05:22:38 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFD6F1FE9; Thu, 28 Sep 2023 02:22:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=/LbGuJS6p8ohAFxyUvYH7JE8uergoje10e9hBkx1drM=; b=FiJsRqJBMchqjwD4JGykDKK8Wr TFIgSWtM+AqF2kjFV3aHNcGwx5mUY4vl/nLmcPZvW9n472XQNhpEML524OSjbNZIxLgDTCADZJOKh hdUYnHZvtOY7Cz0AI8UYneHj9mayCZwlOoDSMFRa/C8nClo9DWFaRJ4s1AjjLj+kh3NaGUrhCTfhb BjD3bVXryUf+57o7ckyOzkmOWgzTgvZVh63iiO6aLGbxSEp1PqzpDcrKMCKtsDXQ8xsuvYxCWmC8L iuio9M0LPZYfTF/Ww/WPFVQsN4sxecHeOPimeRCa/RH0YyGpE83SDNRtjY+pnTPc+gEGUUyaIQTGi VznkQPMg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qlnDd-001f5z-Cx; Thu, 28 Sep 2023 09:22:01 +0000 Date: Thu, 28 Sep 2023 10:22:01 +0100 From: Matthew Wilcox To: Amir Goldstein Cc: Jens Axboe , Miklos Szeredi , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-unionfs@vger.kernel.org, Jiufei Xue Subject: Re: [PATCH] ovl: punt write aio completion to workqueue Message-ID: References: <20230928064636.487317-1-amir73il@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-unionfs@vger.kernel.org On Thu, Sep 28, 2023 at 12:15:00PM +0300, Amir Goldstein wrote: > On Thu, Sep 28, 2023 at 10:08 AM Jens Axboe wrote: > > On 9/28/23 12:46 AM, Amir Goldstein wrote: > > > ret = -ENOMEM; > > > aio_req = kmem_cache_zalloc(ovl_aio_request_cachep, GFP_KERNEL); > > > if (!aio_req) > > > > Unrelated to this patch, but is this safe? You're allocating an aio_req > > from within the ->write_iter() handler, yet it's GFP_KERNEL? Seems like > > that should at least be GFP_NOFS, no? > > I could be wrong, but since overlayfs does not have any page cache > of its own, I don't think memory reclaim poses a risk. Use the scoped APIs, people! GFP_NOFS needs to die. If your filesystem cannot tolerate being reentered, call memalloc_nofs_save() / restore() when it can tolerate being reentered. > > That aside, punting to a workqueue is a very heavy handed solution to > > the problem. Maybe it's the only one you have, didn't look too closely > > at it, but it's definitely not going to increase your performance... > > I bet it won't... but I need to worry about correctness. > > What I would like to know, and that is something that I tried > to ask you in the Link: discussion, but perhaps I wasn't clear - > Are there any IOCB flags that the completion caller may set, > that will hint the submitter that completion is not from interrupt > context and that punting to workqueue is not needed? I'd really like page cache write completions to not be handled in the interrupt handler. Then we could make the i_pages lock not an interrupt-disabling lock any more. I think that'd best be handled in a workqueue too, but maybe there's a better solution nowadays.