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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE26BC433EF for ; Thu, 14 Oct 2021 13:03:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5F41C60FF2 for ; Thu, 14 Oct 2021 13:03:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5F41C60FF2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=techsingularity.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id C141F900002; Thu, 14 Oct 2021 09:03:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B9CEE6B0071; Thu, 14 Oct 2021 09:03:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A3C99900002; Thu, 14 Oct 2021 09:03:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0138.hostedemail.com [216.40.44.138]) by kanga.kvack.org (Postfix) with ESMTP id 9169A6B006C for ; Thu, 14 Oct 2021 09:03:17 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 4AD7D39BAD for ; Thu, 14 Oct 2021 13:03:17 +0000 (UTC) X-FDA: 78695058834.22.E1234F4 Received: from outbound-smtp55.blacknight.com (outbound-smtp55.blacknight.com [46.22.136.239]) by imf08.hostedemail.com (Postfix) with ESMTP id DD8E830000B5 for ; Thu, 14 Oct 2021 13:03:15 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp55.blacknight.com (Postfix) with ESMTPS id E9C53FAC11 for ; Thu, 14 Oct 2021 14:03:14 +0100 (IST) Received: (qmail 518 invoked from network); 14 Oct 2021 13:03:14 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.17.29]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 14 Oct 2021 13:03:14 -0000 Date: Thu, 14 Oct 2021 14:03:12 +0100 From: Mel Gorman To: Vlastimil Babka Cc: Linux-MM , NeilBrown , Theodore Ts'o , Andreas Dilger , "Darrick J . Wong" , Matthew Wilcox , Michal Hocko , Dave Chinner , Rik van Riel , Johannes Weiner , Jonathan Corbet , Linux-fsdevel , LKML Subject: Re: [PATCH 3/8] mm/vmscan: Throttle reclaim when no progress is being made Message-ID: <20211014130312.GA3959@techsingularity.net> References: <20211008135332.19567-1-mgorman@techsingularity.net> <20211008135332.19567-4-mgorman@techsingularity.net> <63336163-e709-65de-6d53-8764facd3924@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <63336163-e709-65de-6d53-8764facd3924@suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: DD8E830000B5 X-Stat-Signature: txy1za7c4q77xbuamt6i31b4sypzga6i Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf08.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.136.239 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-Rspamd-Server: rspam02 X-HE-Tag: 1634216595-982136 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, Oct 14, 2021 at 02:31:17PM +0200, Vlastimil Babka wrote: > On 10/8/21 15:53, Mel Gorman wrote: > > Memcg reclaim throttles on congestion if no reclaim progress is made. > > This makes little sense, it might be due to writeback or a host of > > other factors. > > > > For !memcg reclaim, it's messy. Direct reclaim primarily is throttled > > in the page allocator if it is failing to make progress. Kswapd > > throttles if too many pages are under writeback and marked for > > immediate reclaim. > > > > This patch explicitly throttles if reclaim is failing to make progress. > > > > Signed-off-by: Mel Gorman > ... > > @@ -3769,6 +3797,16 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg, > > trace_mm_vmscan_memcg_reclaim_end(nr_reclaimed); > > set_task_reclaim_state(current, NULL); > > > > + if (!nr_reclaimed) { > > + struct zoneref *z; > > + pg_data_t *pgdat; > > + > > + z = first_zones_zonelist(zonelist, sc.reclaim_idx, sc.nodemask); > > + pgdat = zonelist_zone(z)->zone_pgdat; > > + > > + reclaim_throttle(pgdat, VMSCAN_THROTTLE_NOPROGRESS, HZ/10); > > + } > > Is this necessary? AFAICS here we just returned from: > > do_try_to_free_pages() > shrink_zones() > for_each_zone()... > consider_reclaim_throttle() > > Which already throttles when needed and using the appropriate pgdat, while > here we have to somewhat awkwardly assume the preferred one. > Yes, you're right, consider_reclaim_throttle not only throttles on the appropriate pgdat but takes priority into account. Well spotted! -- Mel Gorman SUSE Labs