Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2717594imu; Mon, 17 Dec 2018 06:45:27 -0800 (PST) X-Google-Smtp-Source: AFSGD/VUkiflg1OzOJ4SzX7k2EGQWN8cHtR/3hEEP0+pxGNPU3F4CzIJ3zjODOhMhYDLlF6u+Y31 X-Received: by 2002:a62:1212:: with SMTP id a18mr13506764pfj.217.1545057927251; Mon, 17 Dec 2018 06:45:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545057927; cv=none; d=google.com; s=arc-20160816; b=zFBbErezj9WwIDwYT3N8mKHWmryL/BRXOnlosj6xZEUNbMnVhQ2159XQJ8AfzEC4Im uBtLvtOcwBfkHvJ5FDDn4j35hKjUWnMmRJ5J0ttlgated6Et+f2GWehG9lLF9q/HIPUl r/3QpTXEhIQ6Z3r/IR6oeq3Aaa27ZtFRwpPwXh9oByoyipKo5UEwmCResBNJP9vmJ/da PoJCUOX3yBoVF2gVk6u94Ag28RwuaFHFs3LjKymoQgv07Wz3zBzfO+ZHfqVU0sTdF6hD sRFcbHqTj5KTL2kLG5EukZSo5dBvl7ZEhlxYSzxCa/sBqBQLp2AtmONYgmLfoSQ7XOQN +98w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=nZZ4uT7zaATupA8MtYGiN52I8EDHkuRogXWMUDrqNP8=; b=sl/Kh2/T+g6yStp06WH4BWSDj1+jwhFTU8drso0+5BR4ueuSIjabLr9wGDXlaUNe75 nFnlAZmqQyRVvKDa0PsS0AX92gEfIh2mtBl2p7ylqeETRrXHT+bUDyeSGcB2o3/n42Nx KJAhcA33iw8eC4dOvb7fCu02Nvi076xed5l9T2+rCArOYS/tthkDbR+034xkhEZhddw/ ioHdPvSBdzauPKIBC0BK6hi17Xue1TwF69aaDUJqLfCg3lLTjbM7AK8eCR78ShvkmoRX EE8eaDbUwOnIY2wHwCKv72YkT025aK3xoD7ro1RVcxfT3ao9Ws/rfK0eEJrJc3TAXpCF 61cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=GCD1mTQf; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m142si12104246pfd.171.2018.12.17.06.45.11; Mon, 17 Dec 2018 06:45:27 -0800 (PST) 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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=GCD1mTQf; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732601AbeLQOlL (ORCPT + 99 others); Mon, 17 Dec 2018 09:41:11 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:37580 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726887AbeLQOlK (ORCPT ); Mon, 17 Dec 2018 09:41:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=nZZ4uT7zaATupA8MtYGiN52I8EDHkuRogXWMUDrqNP8=; b=GCD1mTQf4iesza7o2dkc2JY2u /1sQKjL2HsK8PcKHTCneirvS5eCkh0QV4ljbr7hax77lC21b9q8HdtWO18LihRq8tskytX8ckursp 72a3pyNBO3h3ZZAuEsGvf3xC6WkzCckcTftXWkLNrNAyLZUmXg50Q0MIXmRaI8fAeBMhYwvdo0AE4 SoTCAREaPY/W/nqbCwJA7hAez49AscrYDIWnt2hqABJlAodZeOktDAfdkLPmY/3IUchX/jmOqWbbW IoiG7EZanbeojlGqGkgO1G6Ihx1sKD4o4WgtCsX2c74wu1pQkUXGhuxZ5tFOCA5KzuZAkb7oETFpx VlDhyEtig==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gYu4r-0005Z5-Ud; Mon, 17 Dec 2018 14:41:01 +0000 Date: Mon, 17 Dec 2018 06:41:01 -0800 From: Matthew Wilcox To: Michal Hocko Cc: Tetsuo Handa , Hou Tao , phillip@squashfs.org.uk, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] squashfs: enable __GFP_FS in ->readpage to prevent hang in mem alloc Message-ID: <20181217144101.GN10600@bombadil.infradead.org> References: <20181204020840.49576-1-houtao1@huawei.com> <20181215143824.GJ10600@bombadil.infradead.org> <69457a5a-79c9-4950-37ae-eff7fa4f949a@huawei.com> <20181217035157.GK10600@bombadil.infradead.org> <20181217093337.GC30879@dhcp22.suse.cz> <00ff5d2d-a50f-4730-db8a-cea3d7a3eef7@I-love.SAKURA.ne.jp> <20181217122546.GL10600@bombadil.infradead.org> <20181217141044.GP30879@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181217141044.GP30879@dhcp22.suse.cz> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 17, 2018 at 03:10:44PM +0100, Michal Hocko wrote: > On Mon 17-12-18 04:25:46, Matthew Wilcox wrote: > > It's worth noticing that squashfs _is_ in fact holding a page locked in > > squashfs_copy_cache() when it calls grab_cache_page_nowait(). I'm not > > sure if this will lead to trouble or not because I'm insufficiently > > familiar with the reclaim path. > > Hmm, this is more interesting then. If there is any memcg accounted > allocation down that path _and_ the squashfs writeout can lock more > pages and mark them writeback before they are really sent to the storage > then we have a problem. See [1] > > [1] http://lkml.kernel.org/r/20181213092221.27270-1-mhocko@kernel.org Squashfs is read only, so it'll never have dirty pages and never do writeout. But ... maybe the GFP flags being used for grab_cache_page_nowait() are wrong. It does, after all, say "nowait". Perhaps it shouldn't be trying direct reclaim at all, but rather fail earlier. Like this: +++ b/mm/filemap.c @@ -1550,6 +1550,8 @@ struct page *pagecache_get_page(struct address_space *mapping, pgoff_t offset, gfp_mask |= __GFP_WRITE; if (fgp_flags & FGP_NOFS) gfp_mask &= ~__GFP_FS; + if (fgp_flags & FGP_NOWAIT) + gfp_mask &= ~__GFP_DIRECT_RECLAIM; page = __page_cache_alloc(gfp_mask); if (!page)