From patchwork Mon Jan 9 14:25:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Hocko X-Patchwork-Id: 712727 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3txyCr31f1z9sBR for ; Tue, 10 Jan 2017 01:27:20 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S940010AbdAIO0P (ORCPT ); Mon, 9 Jan 2017 09:26:15 -0500 Received: from mx2.suse.de ([195.135.220.15]:53008 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932802AbdAIOZl (ORCPT ); Mon, 9 Jan 2017 09:25:41 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 07A26ACFF; Mon, 9 Jan 2017 14:25:37 +0000 (UTC) Date: Mon, 9 Jan 2017 15:25:36 +0100 From: Michal Hocko To: Vlastimil Babka Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Andrew Morton , Dave Chinner , djwong@kernel.org, Theodore Ts'o , Chris Mason , David Sterba , Jan Kara , ceph-devel@vger.kernel.org, cluster-devel@redhat.com, linux-nfs@vger.kernel.org, logfs@logfs.org, linux-xfs@vger.kernel.org, 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 Subject: Re: [PATCH 4/8] xfs: use memalloc_nofs_{save,restore} instead of memalloc_noio* Message-ID: <20170109142536.GK7495@dhcp22.suse.cz> References: <20170106141107.23953-1-mhocko@kernel.org> <20170106141107.23953-5-mhocko@kernel.org> <18f9363f-144d-0bfd-5116-08d5f4648869@suse.cz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <18f9363f-144d-0bfd-5116-08d5f4648869@suse.cz> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Mon 09-01-17 15:08:27, Vlastimil Babka wrote: > On 01/06/2017 03:11 PM, Michal Hocko wrote: > > From: Michal Hocko > > > > kmem_zalloc_large and _xfs_buf_map_pages use memalloc_noio_{save,restore} > > API to prevent from reclaim recursion into the fs because vmalloc can > > invoke unconditional GFP_KERNEL allocations and these functions might be > > called from the NOFS contexts. The memalloc_noio_save will enforce > > GFP_NOIO context which is even weaker than GFP_NOFS and that seems to be > > unnecessary. Let's use memalloc_nofs_{save,restore} instead as it should > > provide exactly what we need here - implicit GFP_NOFS context. > > > > Changes since v1 > > - s@memalloc_noio_restore@memalloc_nofs_restore@ in _xfs_buf_map_pages > > as per Brian Foster > > > > Signed-off-by: Michal Hocko > > Not a xfs expert, but seems correct. > > Acked-by: Vlastimil Babka Thanks! > > Nit below: > > > --- > > fs/xfs/kmem.c | 10 +++++----- > > fs/xfs/xfs_buf.c | 8 ++++---- > > 2 files changed, 9 insertions(+), 9 deletions(-) > > > > diff --git a/fs/xfs/kmem.c b/fs/xfs/kmem.c > > index a76a05dae96b..d69ed5e76621 100644 > > --- a/fs/xfs/kmem.c > > +++ b/fs/xfs/kmem.c > > @@ -65,7 +65,7 @@ kmem_alloc(size_t size, xfs_km_flags_t flags) > > void * > > kmem_zalloc_large(size_t size, xfs_km_flags_t flags) > > { > > - unsigned noio_flag = 0; > > + unsigned nofs_flag = 0; > > void *ptr; > > gfp_t lflags; > > > > @@ -80,14 +80,14 @@ kmem_zalloc_large(size_t size, xfs_km_flags_t flags) > > * context via PF_MEMALLOC_NOIO to prevent memory reclaim re-entering > > * the filesystem here and potentially deadlocking. > > The comment above is now largely obsolete, or minimally should be > changed to PF_MEMALLOC_NOFS? --- I will fold it into the original patch. Thanks! diff --git a/fs/xfs/kmem.c b/fs/xfs/kmem.c index d69ed5e76621..0c9f94f41b6c 100644 --- a/fs/xfs/kmem.c +++ b/fs/xfs/kmem.c @@ -77,7 +77,7 @@ kmem_zalloc_large(size_t size, xfs_km_flags_t flags) * __vmalloc() will allocate data pages and auxillary structures (e.g. * pagetables) with GFP_KERNEL, yet we may be under GFP_NOFS context * here. Hence we need to tell memory reclaim that we are in such a - * context via PF_MEMALLOC_NOIO to prevent memory reclaim re-entering + * context via PF_MEMALLOC_NOFS to prevent memory reclaim re-entering * the filesystem here and potentially deadlocking. */ if (flags & KM_NOFS)