Received: by 2002:a05:6a10:144:0:0:0:0 with SMTP id 4csp6948pxw; Thu, 7 Apr 2022 22:36:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGWCw/qRy8P9l1XGblx3se2mNdfnzti0UbpXyaYsFnhkmiyUPp8ioSt/qBbhq4vVlLpc9P X-Received: by 2002:a17:902:8f94:b0:154:839b:809f with SMTP id z20-20020a1709028f9400b00154839b809fmr17336340plo.150.1649396208188; Thu, 07 Apr 2022 22:36:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649396208; cv=none; d=google.com; s=arc-20160816; b=V+Ou3X9JrBXJYmJt9VR41LWcnMvWC4UmbLGFJ+yUvf28m+tA6QNQGOnU1Oo7NPBhbT s1D3WZWMlDryPfLLsmFE+eeGCf27wxUrdE8YudtT/MHVaQ3eBOAmjdDz6C4mdWXUFss/ v0INmobAsMdO5+i20gqylLUVu87CFNAJ63QN2RqMLif2PoShU6/y7CS33q0I0uSjxDXl BoR0gISEheu8eEyzMPbaX+GoPfBms1Zbh+0en+Ib3jK+omY1XGRjo5Q38S9UhETWB9PK pPn73G5yxL98lMafQbhCHdD7BL/fyFiKsf/f4t4EmBxy7zwoztnyxvaz6Xn0Ij0dNftm 3uiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=HmMDKV1dONhUyuBd3gUACdUNOPG78waSeYX6me+0qbI=; b=vlyq5cftqCKwJtnrOsKr1VrB3oNUW8DBOmlqDj2NfeOCoxzC0d18BzUGjmAQyd4kp9 laUnOFbwENx8wekbjzlr/pRzyyoY5ceO84AEbzmfnGyc8gKGwVJELtTmJIxj0vKdSQAH lnBvjUgOj/ujNZT0puqm3S9LYVPxnkUyS6vBov9/oRffSm9v+OP41/XhYmSAsXhEu5Cj bYhCwJtubw7vLvG5vsIxIt3r845p0MvJ0/MMoZcjTqg1j/GfYpRyflupGzgdSaBwIMkJ vQ5tpviOv0Vgox5IdBPek5xm+hGbC6XEBoWuTL2is/0UxGt0O/2zERlZlGlq88VGKn7V XYhg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id mu14-20020a17090b388e00b001c6570bf8cbsi430694pjb.7.2022.04.07.22.36.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 22:36:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 34D511F3A5D; Thu, 7 Apr 2022 22:03:38 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234495AbiDHFFa (ORCPT + 99 others); Fri, 8 Apr 2022 01:05:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234545AbiDHFF3 (ORCPT ); Fri, 8 Apr 2022 01:05:29 -0400 Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F19921A5906; Thu, 7 Apr 2022 22:03:26 -0700 (PDT) Received: from dread.disaster.area (pa49-186-233-190.pa.vic.optusnet.com.au [49.186.233.190]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id D55325343FA; Fri, 8 Apr 2022 15:03:23 +1000 (AEST) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1ncgmH-00F7iB-6G; Fri, 08 Apr 2022 15:03:21 +1000 Date: Fri, 8 Apr 2022 15:03:21 +1000 From: Dave Chinner To: NeilBrown Cc: Trond Myklebust , "bfields@fieldses.org" , "linux-nfs@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "chuck.lever@oracle.com" Subject: Re: sporadic hangs on generic/186 Message-ID: <20220408050321.GF1609613@dread.disaster.area> References: <20220406195424.GA1242@fieldses.org> <20220407001453.GE1609613@dread.disaster.area> <164929126156.10985.11316778982526844125@noble.neil.brown.name> <164929437439.10985.5253499040284089154@noble.neil.brown.name> <164930468885.10985.9905950866720150663@noble.neil.brown.name> <43aace26d3a09f868f732b2ad94ca2dbf90f50bd.camel@hammerspace.com> <164938596863.10985.998515507989861871@noble.neil.brown.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <164938596863.10985.998515507989861871@noble.neil.brown.name> X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.4 cv=VuxAv86n c=1 sm=1 tr=0 ts=624fc21d a=bHAvQTfMiaNt/bo4vVGwyA==:117 a=bHAvQTfMiaNt/bo4vVGwyA==:17 a=kj9zAlcOel0A:10 a=z0gMJWrwH1QA:10 a=7-415B0cAAAA:8 a=d5fOfDb67WCC2U-2ANoA:9 a=CjuIK1q_8ugA:10 a=biEYGPWJfzWAr4FL6Ov7:22 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Fri, Apr 08, 2022 at 12:46:08PM +1000, NeilBrown wrote: > On Thu, 07 Apr 2022, Trond Myklebust wrote: > > The bottom line is that we use ordinary GFP_KERNEL memory allocations > > where we can. The new code follows that rule, breaking it only in cases > > where the specific rules of rpciod/xprtiod/nfsiod make it impossible to > > wait forever in the memory manager. > > It is not safe to use GFP_KERNEL for an allocation that is needed in > order to free memory - and so any allocation that is needed to write out > data from the page cache. Except that same page cache writeback path can be called from syscall context (e.g. fsync()) which has nothing to do with memory reclaim. In that case GFP_KERNEL is the correct allocation context to use because there are no constraints on what memory reclaim can be performed from this path. IOWs, if the context initiating data writeback doesn't allow GFP_KERNEL allocations, then it should be calling memalloc_nofs_save() or memalloc_noio_save() to constrain all allocations to the required context. We should not be requiring the filesystem (or any other subsystem) to magically infer that the IO is being done in a constrained allocation context and modify the context they use appropriately. If we this, then all filesystems would simply use GFP_NOIO everywhere because the loop device layers the entire filesystem IO path under block device context (i.e. requiring GFP_NOIO allocation context). We don't do this - the loop device sets PF_MEMALLOC_NOIO instead so all allocations in that path run with at least GFP_NOIO constraints and filesystems are none the wiser about the constraints of the calling context. IOWs, GFP_KERNEL is generally right context to be using in filesystem IO paths and callers need to restrict allocation contexts via task flags if they cannot allow certain types of reclaim recursion to occur... Cheers, Dave. -- Dave Chinner david@fromorbit.com