Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp293796ybz; Fri, 17 Apr 2020 01:03:52 -0700 (PDT) X-Google-Smtp-Source: APiQypJJZz/w8py/gWn4r40SporpsGrrNZEFkmVfWYEnvTZNelPGEHiQ2ntXMgDcCFws/dH73mUM X-Received: by 2002:a17:906:3291:: with SMTP id 17mr1791557ejw.343.1587110632245; Fri, 17 Apr 2020 01:03:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587110632; cv=none; d=google.com; s=arc-20160816; b=WIGVLUHsgukqhtBqsRJ78XtXx9WLe7DB5PdOSti9zygGecWmUNMNcJiLHcsHdgT7f8 VY3eiHUSoumqnH8RFMX5Rlh5C8BcHNwZqGMwyCZD9XdHxQY3uR4pLvUaYHqEXvmByl5T vnZcJ0bWY/rtTT7w3r4C/EPtgkdMBHKUSR710Z54523JKvPwYsd8bIuqXpUqdoZ4klVv wfUaIB8xHIxyVkclWSiV/Zq9iT7/OE9VX4NPzDVV8b8XoCxLW/XQnHxTl3bG9MpNLV92 aCXxHDPah/bRni/LWd0jEvODCkLRtZ0C3o8lIlLVpQXbWiEKqrA/QWsiqxXV5FZ5xKVj 3WUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=D9Cm8tiUrg/W1Q7McZQji69rvG+FU5ciQYbgQ4VtKtk=; b=soQa2tl/IkxNZ3UlY2Dr/opGg5wHz7gAFyTQeSE1xF2DJdaz6KTpzsEH4huJZbrK/H X/cdsgQFPJkHM8thhJ3buOuWTWkKtrnlwOl+EYlTTeB2CynsFCi1NONDo0u8iKdLVuiN 6kf72ZXa0RbtV1MbPgLbYYKjq4wInGfRJSYr5NefwomSWDLEFuetyQDJqvpiT+aaog9U w+eFJnNWhD+9a+TMec5ij/XdGj6xjdHDlbllKVx3rI8djSncpk37kpm00a9xlvS9Ewoc GkT4PpdJgAsnV9/aHhUUy/IAoR/lokoGjA1rkvKRKCjSNz3TakP2Bfu3XYq9+dd1KV54 tEpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id va12si1856134ejb.227.2020.04.17.01.03.23; Fri, 17 Apr 2020 01:03:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729594AbgDQIAJ (ORCPT + 99 others); Fri, 17 Apr 2020 04:00:09 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:36664 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729254AbgDQIAI (ORCPT ); Fri, 17 Apr 2020 04:00:08 -0400 Received: by mail-wr1-f65.google.com with SMTP id u13so1963694wrp.3; Fri, 17 Apr 2020 01:00:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=D9Cm8tiUrg/W1Q7McZQji69rvG+FU5ciQYbgQ4VtKtk=; b=SGtUVIxXIHi69ASccsLEdEE/+qnOOfvpEvweULjjGP5mAYpVs1YHHJ54wg6S0YQHrM jAisqQXMIjcYaQ1mWOhIMHkrD/CYaYmYlwYSDX16qHz9InCt32YzXDXLM4uoG5N1vDDi VCp+9oSPfqs/Qm1ewiVxPjnruVAF3O5h/W6ahUa9AWyT2qMAh0zob/tbAAmqJwPWXg3e L5fMLluS8bPYreRQ49d57lT6J7Bi98GTuvNKtH/RC60Va3wvNUAUV0bVjwgvRWfl7/6S YPAtgnmxf9YgfVmQK27QqyYnUdUgxn/xOLh74H+Q7ipdjLg11s8gZ9frJsO3DsMqijiR 5CjQ== X-Gm-Message-State: AGi0Puagm0BpAITm1xSzKsQHaXgYfeSH+k+uutDoquuoW+16fpLmT8cY JVnYxP+udB/5mdY2h5Q/899+AuYX X-Received: by 2002:adf:c109:: with SMTP id r9mr2483924wre.265.1587110405815; Fri, 17 Apr 2020 01:00:05 -0700 (PDT) Received: from localhost (ip-37-188-130-62.eurotel.cz. [37.188.130.62]) by smtp.gmail.com with ESMTPSA id n6sm6585346wmc.28.2020.04.17.01.00.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Apr 2020 01:00:05 -0700 (PDT) Date: Fri, 17 Apr 2020 10:00:03 +0200 From: Michal Hocko To: Christoph Hellwig Cc: "Darrick J. Wong" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, LKML , Dave Chinner Subject: Re: implicit AOP_FLAG_NOFS for grab_cache_page_write_begin Message-ID: <20200417080003.GH26707@dhcp22.suse.cz> References: <20200415070228.GW4629@dhcp22.suse.cz> <20200417072931.GA20822@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200417072931.GA20822@infradead.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 17-04-20 00:29:31, Christoph Hellwig wrote: > On Wed, Apr 15, 2020 at 09:02:28AM +0200, Michal Hocko wrote: > > Hi, > > I have just received a bug report about memcg OOM [1]. The underlying > > issue is memcg specific but the stack trace made me look at the write(2) > > patch and I have noticed that iomap_write_begin enforces AOP_FLAG_NOFS > > which means that all the page cache that has to be allocated is > > GFP_NOFS. What is the reason for this? Do all filesystems really need > > the reclaim protection? I was hoping that those filesystems which really > > need NOFS context would be using the scope API > > (memalloc_nofs_{save,restore}. > > This comes from the historic XFS code, and this commit from Dave > in particular: > > commit aea1b9532143218f8599ecedbbd6bfbf812385e1 > Author: Dave Chinner > Date: Tue Jul 20 17:54:12 2010 +1000 > > xfs: use GFP_NOFS for page cache allocation > > Avoid a lockdep warning by preventing page cache allocation from > recursing back into the filesystem during memory reclaim. Thanks for digging this up! The changelog is not really clear whether NOFS is to avoid false possitive lockup warnings or real ones. If the former then we have grown __GFP_NOLOCKDEP flag to workaround the problem if the later then can we use memalloc_nofs_{save,restore} in the xfs specific code please? -- Michal Hocko SUSE Labs