Received: by 10.192.165.148 with SMTP id m20csp4876693imm; Tue, 24 Apr 2018 09:48:33 -0700 (PDT) X-Google-Smtp-Source: AIpwx489+0vZyDy6ZPxnULIc4FcTb+mrV08vuuBMgSbvotHPtHeJ41+ELjWw5yE83lmvauynjVGp X-Received: by 10.101.97.136 with SMTP id c8mr5453148pgv.131.1524588513542; Tue, 24 Apr 2018 09:48:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524588513; cv=none; d=google.com; s=arc-20160816; b=IEmVxZxzr4Klq+K6IqO0PBEP1FZEJHYfJPpBOL3QXvXOhmvNaOCBgrDt+xW/hug3FO 4uk9YSAG9BnxYhmPkczmbEGIYiu4204wVLJCpMuym7f1AB+Nl3LEMHz8xbh6jkzZTFHq Qddt/cZ684hLXISfH5ScyrkgsE4/c99OczVbUhyUW6uQmbTyS/mQgS+q1jWpxbstLx7P YHq2IorBy4Tmfvj/FzJx6yys3cqfW3vLudTqnzapBlzx3WGoABa7e4gaCFLLz7XpsI8n i/18wtevN+I1yfNwXagDNRUGgboiaXJaxLkdEYyvrzmlzIekpGjcTgA9F+iHAQ6LzsjH TK7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=gFYB6JziV6hTXw1aCvd0GgWVnLMTc45oAJvD9UOmOyA=; b=C6stiA+TyyYLK1qaOMF6I0KUNo+VOXPPWK99sYoi13u39PtTWG+vpE+sdBy0sR7DVP /NRuD6zyK4Is56qRXY2XQrAJNFARFR99TVmkaZ4ETzIQ40so0hNVh+msbcS5C+JanKau pJY0GfmTI0T06rp5G91J8Z4tRud1fzMJUOlH9MvQmqcbnhv7JOQmPGOSlDnSwptWRj29 ehcUBrzowRmljVKG7J+TDRAUTACj0NaKHmx6Baq1fDgNfvtSxsv5rG2nACejsf5qEgSY 55X6JBSdzAn6ExqNpE1gR97/p8QV8f9mVRfwxfX8NkdwNh0BdoL2l+E5L7TEd+3HrVRO RMJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b73si12245856pga.106.2018.04.24.09.48.18; Tue, 24 Apr 2018 09:48:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751860AbeDXQrD (ORCPT + 99 others); Tue, 24 Apr 2018 12:47:03 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:44808 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751513AbeDXQq7 (ORCPT ); Tue, 24 Apr 2018 12:46:59 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 355A481A88D6; Tue, 24 Apr 2018 16:46:58 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 79C142024CA1; Tue, 24 Apr 2018 16:46:57 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id w3OGkv5l028270; Tue, 24 Apr 2018 12:46:57 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id w3OGkt0L028245; Tue, 24 Apr 2018 12:46:55 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Tue, 24 Apr 2018 12:46:55 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Michal Hocko cc: LKML , Artem Bityutskiy , Richard Weinberger , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Cyrille Pitchen , "Theodore Ts'o" , Andreas Dilger , Steven Whitehouse , Bob Peterson , Trond Myklebust , Anna Schumaker , Adrian Hunter , Philippe Ombredanne , Kate Stewart , linux-mtd@lists.infradead.org, linux-ext4@vger.kernel.org, cluster-devel@redhat.com, linux-nfs@vger.kernel.org, linux-mm@kvack.org Subject: Re: vmalloc with GFP_NOFS In-Reply-To: <20180424162712.GL17484@dhcp22.suse.cz> Message-ID: References: <20180424162712.GL17484@dhcp22.suse.cz> User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 24 Apr 2018 16:46:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 24 Apr 2018 16:46:58 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mpatocka@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 24 Apr 2018, Michal Hocko wrote: > Hi, > it seems that we still have few vmalloc users who perform GFP_NOFS > allocation: > drivers/mtd/ubi/io.c > fs/ext4/xattr.c > fs/gfs2/dir.c > fs/gfs2/quota.c > fs/nfs/blocklayout/extent_tree.c > fs/ubifs/debug.c > fs/ubifs/lprops.c > fs/ubifs/lpt_commit.c > fs/ubifs/orphan.c > > Unfortunatelly vmalloc doesn't suppoer GFP_NOFS semantinc properly > because we do have hardocded GFP_KERNEL allocations deep inside the > vmalloc layers. That means that if GFP_NOFS really protects from > recursion into the fs deadlocks then the vmalloc call is broken. > > What to do about this? Well, there are two things. Firstly, it would be > really great to double check whether the GFP_NOFS is really needed. I > cannot judge that because I am not familiar with the code. It would be > great if the respective maintainers (hopefully get_maintainer.sh pointed > me to all relevant ones). If there is not reclaim recursion issue then > simply use the standard vmalloc (aka GFP_KERNEL request). > > If the use is really valid then we have a way to do the vmalloc > allocation properly. We have memalloc_nofs_{save,restore} scope api. How > does that work? You simply call memalloc_nofs_save when the reclaim > recursion critical section starts (e.g. when you take a lock which is > then used in the reclaim path - e.g. shrinker) and memalloc_nofs_restore > when the critical section ends. _All_ allocations within that scope > will get GFP_NOFS semantic automagically. If you are not sure about the > scope itself then the easiest workaround is to wrap the vmalloc itself > with a big fat comment that this should be revisited. > > Does that sound like something that can be done in a reasonable time? > I have tried to bring this up in the past but our speed is glacial and > there are attempts to do hacks like checking for abusers inside the > vmalloc which is just too ugly to live. > > Please do not hesitate to get back to me if something is not clear. > > Thanks! > -- > Michal Hocko > SUSE Labs I made a patch that adds memalloc_noio/fs_save around these calls a year ago: http://lkml.iu.edu/hypermail/linux/kernel/1707.0/01376.html Mikulas