From patchwork Fri Dec 31 21:10:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12702055 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89094C433EF for ; Fri, 31 Dec 2021 21:10:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BA6126B0071; Fri, 31 Dec 2021 16:10:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B561B6B0073; Fri, 31 Dec 2021 16:10:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A1E326B0074; Fri, 31 Dec 2021 16:10:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0101.hostedemail.com [216.40.44.101]) by kanga.kvack.org (Postfix) with ESMTP id 8EF0F6B0071 for ; Fri, 31 Dec 2021 16:10:15 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 3F3271815113D for ; Fri, 31 Dec 2021 21:10:15 +0000 (UTC) X-FDA: 78979332390.26.F3B25E4 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf01.hostedemail.com (Postfix) with ESMTP id 356B140002 for ; Fri, 31 Dec 2021 21:10:03 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 19129B81DDA; Fri, 31 Dec 2021 21:10:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A4B4C36AEA; Fri, 31 Dec 2021 21:10:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1640985011; bh=eCydJAVVq+jmgyyGS+Rvi2JTJOavb+huUaMEhv49O6Y=; h=Date:From:To:Subject:From; b=steKzcw5WdnrO6mFcDnRKBRXPI9gF7CLhJ5C7lSeQkskflNQYqu2hXRv8Tt8ygQ/Q qLrHoCJETrCU/XFHxLEgh7S/bbEPNKZygwV6/fJjnzN+3XQ8FJBnQrcCcUUOzlvHOx 73Unlhq3chVak4rFjtinsYrKOShez+mUgj7X3MOI= Date: Fri, 31 Dec 2021 13:10:09 -0800 From: akpm@linux-foundation.org To: vbabka@suse.cz, shakeelb@google.com, riel@surriel.com, mhocko@suse.com, hughd@google.com, efault@gmx.de, djwong@kernel.org, mgorman@techsingularity.net, akpm@linux-foundation.org, linux-mm@kvack.org, mm-commits@vger.kernel.org, torvalds@linux-foundation.org Subject: [patch 1/1] mm: vmscan: reduce throttling due to a failure to make progress -fix Message-ID: <20211231211009.5by9X%akpm@linux-foundation.org> User-Agent: s-nail v14.9.10 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 356B140002 X-Stat-Signature: hea8fsokinidp9yyb59yhe1fpu7tsbgj Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=steKzcw5; spf=pass (imf01.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-HE-Tag: 1640985003-775042 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: From: Mel Gorman Subject: mm: vmscan: reduce throttling due to a failure to make progress -fix Hugh Dickins reported the following My tmpfs swapping load (tweaked to use huge pages more heavily than in real life) is far from being a realistic load: but it was notably slowed down by your throttling mods in 5.16-rc, and this patch makes it well again - thanks. But: it very quickly hit NULL pointer until I changed that last line to if (first_pgdat) consider_reclaim_throttle(first_pgdat, sc); The likely issue is that huge pages are a major component of the test workload. When this is the case, first_pgdat may never get set if compaction is ready to continue due to this check if (IS_ENABLED(CONFIG_COMPACTION) && sc->order > PAGE_ALLOC_COSTLY_ORDER && compaction_ready(zone, sc)) { sc->compaction_ready = true; continue; } If this was true for every zone in the zonelist, first_pgdat would never get set resulting in a NULL pointer exception. Link: https://lkml.kernel.org/r/20211209095453.GM3366@techsingularity.net Fixes: 1b4e3f26f9f75 ("mm: vmscan: Reduce throttling due to a failure to make progress") Signed-off-by: Mel Gorman Reported-by: Hugh Dickins Cc: Michal Hocko Cc: Vlastimil Babka Cc: Rik van Riel Cc: Mike Galbraith Cc: Darrick J. Wong Cc: Shakeel Butt Signed-off-by: Andrew Morton --- mm/vmscan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/mm/vmscan.c~mm-vmscan-reduce-throttling-due-to-a-failure-to-make-progress-fix +++ a/mm/vmscan.c @@ -3530,7 +3530,8 @@ static void shrink_zones(struct zonelist shrink_node(zone->zone_pgdat, sc); } - consider_reclaim_throttle(first_pgdat, sc); + if (first_pgdat) + consider_reclaim_throttle(first_pgdat, sc); /* * Restore to original mask to avoid the impact on the caller if we