Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1122375pxf; Fri, 26 Mar 2021 01:18:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9DeXtNpiTW6CyRnTyDqh1NQVUTBdyT7HSMtAy6VK4+p1+cBNNnjbY7UE3vF3V5fgyDQL5 X-Received: by 2002:a17:906:23e9:: with SMTP id j9mr13404662ejg.78.1616746713255; Fri, 26 Mar 2021 01:18:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616746713; cv=none; d=google.com; s=arc-20160816; b=HvjaIG/BUIG2Ca0Du6t9P1gQKkQYfjFbW//e2/eaqNwu1T2Ft/8cTooWmlGdYGcnsj ToggXBpHZDCRCJbJv4x0tkA7I44jTMV/6O0unFyWE2dU6PncwAXT9HmxF+XgHGIuZE38 SikU9gto9xardObQtiwkDSN+0WwZjlJavBBNZ2lPNIMaGxm0DTKkwNrze2ulWuseWWpS EajpYBCu92SQI8cCVpHklUSFicYLI5yyUYQJYZUWQ7VjW8qp7n7PjHpPcuLGVi2h//q2 P0R1JM/Hdft9A73001Q8mhoyhI8WmKJlLCiYXW8Ry7lreabZx/jfxBXeAlzc8keEBfAS rgrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3wWiCP2GdmHrn2OrTkc2vGMcI3kl/aA9xBCE5d/QgWs=; b=C5Fxd6D3i4702v9ozMkxrdtOZiQMILq/vV6Tgwjznb6IHcwYQz3LjBaHmgjhFBA/WI ijfpEnaldy5EgCzNwca3F76biK9AOJQydsp45Gv90NqQOvFOfHf+6FyO3pZV6eFTGm4/ TtemlqOznxNqxu9QQ5mTsppyARMUpAPBAKSo98U3wq563azAF7l+93YQMozQGNkv6Jyj /gmY3tsjA225UFtvbRTH5ROPvtnW99Ec2oUiSs0RvEiRkw1mOiEU3PE3b2P2kzXUKOo9 i8ALpIeYrYSJhvs/BhS27HOaVPkiKRPp7K4WRRKOhDH/IH4/JVIhqY4QmGpIfB/Oy/bh 75RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=pKRnzBkI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hb23si6113767ejb.712.2021.03.26.01.18.09; Fri, 26 Mar 2021 01:18:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=pKRnzBkI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229906AbhCZIQk (ORCPT + 99 others); Fri, 26 Mar 2021 04:16:40 -0400 Received: from mx2.suse.de ([195.135.220.15]:46416 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229738AbhCZIQR (ORCPT ); Fri, 26 Mar 2021 04:16:17 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1616746576; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3wWiCP2GdmHrn2OrTkc2vGMcI3kl/aA9xBCE5d/QgWs=; b=pKRnzBkIj9hAOyLkdwfof7uhc6UajPRLCJeaiP3d8e6Jc3hLh4cT7Z0COqjq+Z0Uaz2o95 zQUSvDSwpKzExw42dnH7xFq+SQi7jZ7Ym0RNJS8ow2ea8vAgX1WZlw3jauiWibb8iSFfIJ FaQcL6N/ktz2N+ofK+Yd7esWrrGkpxE= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id EE2CEADDD; Fri, 26 Mar 2021 08:16:15 +0000 (UTC) Date: Fri, 26 Mar 2021 09:16:12 +0100 From: Michal Hocko To: Aaron Tomlin Cc: linux-mm@kvack.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, Vlastimil Babka Subject: Re: [PATCH] mm/page_alloc: try oom if reclaim is unable to make forward progress Message-ID: References: <20210315165837.789593-1-atomlin@redhat.com> <20210319172901.cror2u53b7caws3a@ava.usersys.com> <20210325210159.r565fvfitoqeuykp@ava.usersys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210325210159.r565fvfitoqeuykp@ava.usersys.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [Cc Vlastimil] On Thu 25-03-21 21:01:59, Aaron Tomlin wrote: > On Mon 2021-03-22 11:47 +0100, Michal Hocko wrote: > > Costly orders already do have heuristics for the retry in place. Could > > you be more specific what kind of problem you see with those? > > If I understand correctly, when the gfp_mask consists of > GFP_KERNEL | __GFP_RETRY_MAYFAIL in particular, an allocation request will > fail, if and only if reclaim is unable to make progress. > > The costly order allocation retry logic is handled primarily in > should_reclaim_retry(). Looking at should_reclaim_retry() we see that the > no progress counter value is always incremented in the costly order case > even when "some" progress has been made which is represented by the value > stored in did_some_progress. > > if (costly_order && !(gfp_mask & __GFP_RETRY_MAYFAIL)) > goto nopage; > > if (should_reclaim_retry(gfp_mask, order, ac, alloc_flags, > did_some_progress > 0, &no_progress_loops)) > goto retry; > > I think after we have tried MAX_RECLAIM_RETRIES in a row without success > and the last known compaction attempt was "skipped", perhaps it would be > better to try and use the OOM killer or fail the allocation attempt? The oom killer is never triggered for costly allocation request. Both reclaim and compaction maintain their own retries counters as they are targeting a different operation. Although the compaction really depends on the reclaim to do some progress. > I encountered a situation when the value of no_progress_loops was found to > be 31,611,688 i.e. significantly over MAX_RECLAIM_RETRIES; the allocation > order was 5. The gfp_mask contained the following: OK, this sound unexpected as it indicates that the reclaim is able to make a forward progress but compaction doesn't want to give up and keeps retrying. Are you able to reproduce this or could you find out which specific condition keeps compaction retrying? I would expect that it is one of the 3 conditions before the max_retries is checked. > #define ___GFP_HIGHMEM 0x02 > #define ___GFP_IO 0x40 > #define ___GFP_FS 0x80 > #define ___GFP_NOWARN 0x200 > #define ___GFP_RETRY_MAYFAIL 0x400 > #define ___GFP_COMP 0x4000 > #define ___GFP_HARDWALL 0x20000 > #define ___GFP_DIRECT_RECLAIM 0x200000 > #define ___GFP_KSWAPD_RECLAIM 0x400000 > > > > -- > Aaron Tomlin > -- Michal Hocko SUSE Labs