From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68181C3B18C for ; Thu, 13 Feb 2020 17:08:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 36000206DB for ; Thu, 13 Feb 2020 17:08:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 36000206DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DF97C6B0585; Thu, 13 Feb 2020 12:08:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DD19E6B0586; Thu, 13 Feb 2020 12:08:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CE6DC6B0587; Thu, 13 Feb 2020 12:08:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0160.hostedemail.com [216.40.44.160]) by kanga.kvack.org (Postfix) with ESMTP id B6FFA6B0585 for ; Thu, 13 Feb 2020 12:08:28 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 49A7A180ACEE6 for ; Thu, 13 Feb 2020 17:08:28 +0000 (UTC) X-FDA: 76485737496.19.whip59_66f68ef4a320f X-HE-Tag: whip59_66f68ef4a320f X-Filterd-Recvd-Size: 4765 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Thu, 13 Feb 2020 17:08:27 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id a9so7608506wmj.3 for ; Thu, 13 Feb 2020 09:08:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=IFTjbZrH5PoyWG2b0U3TmFoaGHte+NO5dGEdKJcd8Bk=; b=myPRLLlfoKJatdSjCDADxLFBtR3O2LARBVkb5xPTz9KNms65QRHGSjFWWpgs6oEq3R vvN6mzDMbOvZi/egrUQQ+dPWtp6NlOx4diORWXiwizu+MdHwao9B6zOTc7oRlwSCPn68 08+L8uK6cuuedsx0p3RVGXbJGjPAo4kpao97NPK95Q/MuvJFWEc+xr7Mjt+LLKdINu09 vH9FhTtYHkN6PhG5QixApqXPCCSdzj7szDOE5JC7WO/qExuuNiORPunGJpTstw28I26T 9qC+vMT3ZGgY0s4/wAMiW1hfAj4BTPvwNZfywZAvnfDjy40Z1UUI4kkiN155Wm0RQ+3/ Sa4g== X-Gm-Message-State: APjAAAWVZVqsmgeFMmtRWc07NkdcXSRph65OZFiV6n5LKlgTraCGXN5O 58NCH4Ve+9oMtH8rme+4fLI= X-Google-Smtp-Source: APXvYqw7oRd11X4Q1kuJ+5pTf2fwuFkGJ8uTmvjuljKAOeWSDBuIwdPoNw5zUkKCRJ3W1rq1J9p4YA== X-Received: by 2002:a7b:c8c5:: with SMTP id f5mr6530095wml.44.1581613706455; Thu, 13 Feb 2020 09:08:26 -0800 (PST) Received: from localhost (ip-37-188-133-87.eurotel.cz. [37.188.133.87]) by smtp.gmail.com with ESMTPSA id v17sm3417734wrt.91.2020.02.13.09.08.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Feb 2020 09:08:25 -0800 (PST) Date: Thu, 13 Feb 2020 18:08:24 +0100 From: Michal Hocko To: Matthew Wilcox Cc: Cong Wang , LKML , Andrew Morton , linux-mm , Mel Gorman , Vlastimil Babka Subject: Re: [PATCH] mm: avoid blocking lock_page() in kcompactd Message-ID: <20200213170824.GJ31689@dhcp22.suse.cz> References: <20200126233935.GA11536@bombadil.infradead.org> <20200127150024.GN1183@dhcp22.suse.cz> <20200127190653.GA8708@bombadil.infradead.org> <20200128081712.GA18145@dhcp22.suse.cz> <20200128083044.GB6615@bombadil.infradead.org> <20200128091352.GC18145@dhcp22.suse.cz> <20200128104857.GC6615@bombadil.infradead.org> <20200128113953.GA24244@dhcp22.suse.cz> <20200213074847.GB31689@dhcp22.suse.cz> <20200213164607.GR7778@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200213164607.GR7778@bombadil.infradead.org> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu 13-02-20 08:46:07, Matthew Wilcox wrote: > On Thu, Feb 13, 2020 at 08:48:47AM +0100, Michal Hocko wrote: > > Can we pursue on this please? An explicit NOFS scope annotation with a > > reference to compaction potentially locking up on pages in the readahead > > would be a great start. > > How about this (on top of the current readahead series): > > diff --git a/mm/readahead.c b/mm/readahead.c > index 29ca25c8f01e..32fd32b913da 100644 > --- a/mm/readahead.c > +++ b/mm/readahead.c > @@ -160,6 +160,16 @@ unsigned long page_cache_readahead_limit(struct address_space *mapping, > .nr_pages = 0, > }; > > + /* > + * Partway through the readahead operation, we will have added > + * locked pages to the page cache, but will not yet have submitted > + * them for I/O. Adding another page may need to allocate > + * memory, which can trigger memory migration. Telling the VM I would go with s@migration@compaction@ because it would make it more obvious that this is about high order allocations. The patch looks ok other than that but FS people would be better than me to give it a proper review. It would be great if you could mention that this shouldn't be a real problem for many(/most?) filesystems because they tend to have NOFS like mask in the the mapping but we would love to remove that in future hopefully so this change is really desiable. Thanks! > + * we're in the middle of a filesystem operation will cause it > + * to not touch file-backed pages, preventing a deadlock. > + */ > + unsigned int nofs = memalloc_nofs_save(); > + > /* > * Preallocate as many pages as we will need. > */ > @@ -217,6 +227,7 @@ unsigned long page_cache_readahead_limit(struct address_space *mapping, > */ > read_pages(&rac, &page_pool); > BUG_ON(!list_empty(&page_pool)); > + memalloc_nofs_restore(nofs); > return rac.nr_pages; > } > EXPORT_SYMBOL_GPL(page_cache_readahead_limit); -- Michal Hocko SUSE Labs