Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2974645imu; Mon, 17 Dec 2018 10:55:42 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wpu6q/iWDJsJE6Iu8s44Art37R01uAw2WDEQ+ilc2KLAmQCfpDs4+krGJG2f87pjifXaj0 X-Received: by 2002:a17:902:2bc5:: with SMTP id l63mr13911906plb.107.1545072941991; Mon, 17 Dec 2018 10:55:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545072941; cv=none; d=google.com; s=arc-20160816; b=IKKZREd9TQ3uHVymIyJ2uFheg67aUZ+CrMsqfqigc9Bfg/eyCPTyvGMwxduci8UXdD hp7tXq/FFoKXAG3IMvQl1sMor/feDDDgeBzRMYvgKuMfKU/vR83lKQ32Iw9dK4sGHZgc UecoIOS+1wt2giqeDAxbLf239Zi/OIUPgNkcZbWgJiPAKgsPnBbBKfXajGnP4Rdb05ig 1lh12t7aYB3fCkP56RxFvrC9COqwu+aILNdTYs/6Uc0u+f7p13FDBEJKSB61j7wILBL9 RcaWT1fMcXHL6HpeqAw5N0OTkhIHDOGL5YU/BiEwR1mXW894aZDwzqzcjzBGeuTVIn1K T1ww== 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; bh=CD4YXe0FVagIsTPInQ0e8hEXJLUpvFxMJ/QhGHBjLb4=; b=JZvpU4s+V44ZcnMK9dK6nMFaxnhD/PRcBKiOasIU7pnr3jYMwxMfRlB+RHaAD+RVe8 BUkuygK4Hgwa2cJf3CQPrVYRn240FSKxgSLjyZapsA7I63MoR5KuYNapzhhEBKMz4Tll E6qAqufFdds75Ce2O/vouLgMX3nRrmNqOgFpdoook5hVpnO6S4k417AV2+FK3BVRqE5B AbxOPtboR6XAChw9ZDe8VugGJd33DfcNwHbk1NL7HRhjsZWxdu6RkhD/Ca2epcfITOJY eoeH+UzToXVMCyrmOLmDWJS25WewALs1G1/sZSZ38L9YwTdN5XJd3TfJXVaDwkL6FLe1 jehQ== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j24si11906982pgh.362.2018.12.17.10.55.25; Mon, 17 Dec 2018 10:55:41 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733145AbeLQOtM (ORCPT + 99 others); Mon, 17 Dec 2018 09:49:12 -0500 Received: from mx2.suse.de ([195.135.220.15]:54086 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732489AbeLQOtK (ORCPT ); Mon, 17 Dec 2018 09:49:10 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id AF0EAAC90; Mon, 17 Dec 2018 14:49:08 +0000 (UTC) Date: Mon, 17 Dec 2018 15:49:08 +0100 From: Michal Hocko To: Matthew Wilcox 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: <20181217144908.GQ30879@dhcp22.suse.cz> 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> <20181217144101.GN10600@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181217144101.GN10600@bombadil.infradead.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 17-12-18 06:41:01, Matthew Wilcox wrote: > 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) Isn't FGP_NOWAIT about page lock rather than the allocation context? -- Michal Hocko SUSE Labs