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=-1.0 required=3.0 tests=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 245D9C2BA83 for ; Thu, 13 Feb 2020 07:48:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E1A0C20873 for ; Thu, 13 Feb 2020 07:48:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E1A0C20873 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 7D63C6B051D; Thu, 13 Feb 2020 02:48:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 787166B051F; Thu, 13 Feb 2020 02:48:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 628026B0520; Thu, 13 Feb 2020 02:48:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0018.hostedemail.com [216.40.44.18]) by kanga.kvack.org (Postfix) with ESMTP id 464396B051D for ; Thu, 13 Feb 2020 02:48:51 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id E3BF3247A for ; Thu, 13 Feb 2020 07:48:50 +0000 (UTC) X-FDA: 76484327220.30.pull55_12fe94a1efb5d X-HE-Tag: pull55_12fe94a1efb5d X-Filterd-Recvd-Size: 6705 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Thu, 13 Feb 2020 07:48:50 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id t14so5419556wmi.5 for ; Wed, 12 Feb 2020 23:48:50 -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=HBD1ZB0zWqswLTDRQo7TRqSq+Yo01aL64QJ9zoMi6fY=; b=JX2yrwaiHqMwLVWNODnxWxZ8u3UzRRHb70889Q8Lg+vB5LJMhBcOQXqsHfyJ47yYNz xx/XYmKS0l4obkXaVdXZ57ehI6u+bec7nYzEp8zEE5nBCsih5077xgOPQd9Q/fvQP9IQ GTbMSSkImZxX/3gUEFhyqFQhQybwh3SUZio/18jsJRonHxPJKMEbCLWhxPhmqTidmloY HH+PjwaZzUV5OzWdckbvbUrrTvzP/a/GHqA1eTMuH+efMCUXCzGt1RbSNyqBHBN0znKx h6BPVz0WbLEMOdmqJZZblIAmKtpOu6Ezd5WPntW/GvYqWxnDnXX+LBlRT4V70lTB4FkV o/cA== X-Gm-Message-State: APjAAAWdZEy1itDnLzz+apzyxXkRvnWS0PkiGtGiupUhqGHhIFXwJa18 lCpVvcdSV9b0da7ES6SMY3g= X-Google-Smtp-Source: APXvYqzdgn+czh+92nzqAyeowfjf8/VqsClD6Ydsest9INQfDJ80i8wriM68Q3W8L+ANJ7a3yZrDKQ== X-Received: by 2002:a7b:c14e:: with SMTP id z14mr4146049wmi.58.1581580129310; Wed, 12 Feb 2020 23:48:49 -0800 (PST) Received: from localhost (ip-37-188-133-87.eurotel.cz. [37.188.133.87]) by smtp.gmail.com with ESMTPSA id c77sm1877694wmd.12.2020.02.12.23.48.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2020 23:48:48 -0800 (PST) Date: Thu, 13 Feb 2020 08:48:47 +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: <20200213074847.GB31689@dhcp22.suse.cz> References: <20200121090048.GG29276@dhcp22.suse.cz> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200128113953.GA24244@dhcp22.suse.cz> 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 Tue 28-01-20 12:39:55, Michal Hocko wrote: > On Tue 28-01-20 02:48:57, Matthew Wilcox wrote: > > On Tue, Jan 28, 2020 at 10:13:52AM +0100, Michal Hocko wrote: > > > On Tue 28-01-20 00:30:44, Matthew Wilcox wrote: > > > > On Tue, Jan 28, 2020 at 09:17:12AM +0100, Michal Hocko wrote: > > > > > On Mon 27-01-20 11:06:53, Matthew Wilcox wrote: > > > > > > On Mon, Jan 27, 2020 at 04:00:24PM +0100, Michal Hocko wrote: > > > > > > > On Sun 26-01-20 15:39:35, Matthew Wilcox wrote: > > > > > > > > On Sun, Jan 26, 2020 at 11:53:55AM -0800, Cong Wang wrote: > > > > > > > > > I suspect the process gets stuck in the retry loop in try_charge(), as > > > > > > > > > the _shortest_ stacktrace of the perf samples indicated: > > > > > > > > > > > > > > > > > > cycles:ppp: > > > > > > > > > ffffffffa72963db mem_cgroup_iter > > > > > > > > > ffffffffa72980ca mem_cgroup_oom_unlock > > > > > > > > > ffffffffa7298c15 try_charge > > > > > > > > > ffffffffa729a886 mem_cgroup_try_charge > > > > > > > > > ffffffffa720ec03 __add_to_page_cache_locked > > > > > > > > > ffffffffa720ee3a add_to_page_cache_lru > > > > > > > > > ffffffffa7312ddb iomap_readpages_actor > > > > > > > > > ffffffffa73133f7 iomap_apply > > > > > > > > > ffffffffa73135da iomap_readpages > > > > > > > > > ffffffffa722062e read_pages > > > > > > > > > ffffffffa7220b3f __do_page_cache_readahead > > > > > > > > > ffffffffa7210554 filemap_fault > > > > > > > > > ffffffffc039e41f __xfs_filemap_fault > > > > > > > > > ffffffffa724f5e7 __do_fault > > > > > > > > > ffffffffa724c5f2 __handle_mm_fault > > > > > > > > > ffffffffa724cbc6 handle_mm_fault > > > > > > > > > ffffffffa70a313e __do_page_fault > > > > > > > > > ffffffffa7a00dfe page_fault > > > > > > > > > > I am not deeply familiar with the readahead code. But is there really a > > > > > high oerder allocation (order > 1) that would trigger compaction in the > > > > > phase when pages are locked? > > > > > > > > Thanks to sl*b, yes: > > > > > > > > radix_tree_node 80890 102536 584 28 4 : tunables 0 0 0 : slabdata 3662 3662 0 > > > > > > > > so it's allocating 4 pages for an allocation of a 576 byte node. > > > > > > I am not really sure that we do sync migration for costly orders. > > > > Doesn't the stack trace above indicate that we're doing migration as > > the result of an allocation in add_to_page_cache_lru()? > > Which stack trace do you refer to? Because the one above doesn't show > much more beyond mem_cgroup_iter and likewise others in this email > thread. I do not really remember any stack with lock_page on the trace. > > > > > > > Btw. the compaction rejects to consider file backed pages when __GFP_FS > > > > > is not present AFAIR. > > > > > > > > Ah, that would save us. > > > > > > So the NOFS comes from the mapping GFP mask, right? That is something I > > > was hoping to get rid of eventually :/ Anyway it would be better to have > > > an explicit NOFS with a comment explaining why we need that. If for > > > nothing else then for documentation. > > > > I'd also like to see the mapping GFP mask go away, but rather than seeing > > an explicit GFP_NOFS here, I'd rather see the memalloc_nofs API used. > > Completely agreed agree here. The proper place for the scope would be > the place where pages are locked with an explanation that there are > other allocations down the line which might invoke sync migration and > that would be dangerous. Having that explicitly documented is clearly an > improvement. 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. -- Michal Hocko SUSE Labs