Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753904AbcDZW7p (ORCPT ); Tue, 26 Apr 2016 18:59:45 -0400 Received: from ipmail07.adl2.internode.on.net ([150.101.137.131]:8753 "EHLO ipmail07.adl2.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752610AbcDZW7m (ORCPT ); Tue, 26 Apr 2016 18:59:42 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2CjCABN8h9X/8/E03ZUCoM4gVCCc6J4BowUhWqEEYYJAgIBAQKBO00BAQEBAQFmJ0EOg3IBAQEEOhwjEAgDDgcDCRoLDwUlAyETiCnETAEBAQEGAgEdGYVAhROBIIJ1g1WCKwWSeiWEcY4NjxtFjmtigjaBRyowhi6DAAEBAQ Date: Wed, 27 Apr 2016 08:58:45 +1000 From: Dave Chinner To: Michal Hocko Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Andrew Morton , "Theodore Ts'o" , Chris Mason , Jan Kara , ceph-devel@vger.kernel.org, cluster-devel@redhat.com, linux-nfs@vger.kernel.org, logfs@logfs.org, xfs@oss.sgi.com, linux-ext4@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-mtd@lists.infradead.org, reiserfs-devel@vger.kernel.org, linux-ntfs-dev@lists.sourceforge.net, linux-f2fs-devel@lists.sourceforge.net, linux-afs@lists.infradead.org, LKML , Michal Hocko Subject: Re: [PATCH 2/2] mm, debug: report when GFP_NO{FS,IO} is used explicitly from memalloc_no{fs,io}_{save,restore} context Message-ID: <20160426225845.GF26977@dastard> References: <1461671772-1269-1-git-send-email-mhocko@kernel.org> <1461671772-1269-3-git-send-email-mhocko@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1461671772-1269-3-git-send-email-mhocko@kernel.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1654 Lines: 40 On Tue, Apr 26, 2016 at 01:56:12PM +0200, Michal Hocko wrote: > From: Michal Hocko > > THIS PATCH IS FOR TESTING ONLY AND NOT MEANT TO HIT LINUS TREE > > It is desirable to reduce the direct GFP_NO{FS,IO} usage at minimum and > prefer scope usage defined by memalloc_no{fs,io}_{save,restore} API. > > Let's help this process and add a debugging tool to catch when an > explicit allocation request for GFP_NO{FS,IO} is done from the scope > context. The printed stacktrace should help to identify the caller > and evaluate whether it can be changed to use a wider context or whether > it is called from another potentially dangerous context which needs > a scope protection as well. You're going to get a large number of these from XFS. There are call paths in XFs that get called both inside and outside transaction context, and many of them are marked with GFP_NOFS to prevent issues that have cropped up in the past. Often these are to silence lockdep warnings (e.g. commit b17cb36 ("xfs: fix missing KM_NOFS tags to keep lockdep happy")) because lockdep gets very unhappy about the same functions being called with different reclaim contexts. e.g. directory block mapping might occur from readdir (no transaction context) or within transactions (create/unlink). hence paths like this are tagged with GFP_NOFS to stop lockdep emitting false positive warnings.... Removing the GFP_NOFS flags in situations like this is simply going to restart the flood of false positive lockdep warnings we've silenced over the years, so perhaps lockdep needs to be made smarter as well... Cheers, Dave. -- Dave Chinner david@fromorbit.com