Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4491810pxb; Thu, 14 Oct 2021 06:19:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygeZTXB+if7UDU7bUc4BYPLZF3wQfVUsLtblg9LjNGqJdnvPYDOH+DLPGq3n65iHbD9Elp X-Received: by 2002:a63:d40a:: with SMTP id a10mr4232166pgh.7.1634217586891; Thu, 14 Oct 2021 06:19:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634217586; cv=none; d=google.com; s=arc-20160816; b=LQI7mH+eRMZjzrwRhBdN2ZBXll/BtWbfU7ggwYrGmzyPHOrjMgzG0YDiAamb8CesYt O8H/o3EWNN9+yubWGNZeHkFmDZ0x0EOPecUgGXgxB0rUiqVZnFOaf15Sn8KlYoQ36lKd RLkOjVrjFDTWuOEJ6eesQkBonzxSUzwVsILihmG5yfjg2IwXB2kSD3SO1QYXwhLbmUi7 W4dCizoofsYHuxYITkb/RZn0W4ORdirIl0PA65RU+HsPS8V1SezOUdeM5jeA8RSP6DO9 Efw41OuT/P+wZe+teEF84Rbav0uMHguw0hTayDjs77B+VhWwhhuyYozb35QhTAjx1Jbn me2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=IptpPLVogJuQ23XRiRttQxVylKEJy4rO+1mS+MVeAB8=; b=T9cAfvafUQGiJvgx8GFs7mS562nmNTFcePO46RUXb4avJpV8gdAfrSMymEvZQyc+rk t/r3uBxA3Vss616i95ABqqWJ/ePVf8l1gkYXfPg+63C7BeClAJvznJk4aujdsiq6xhVF HKrRa3STmXC7ww61FtjXSUFXcqyjBMyO+8/mDk0evxO3bDNP3AK/H44Tndl88jxGMS+Z eBhZUigxjGXVW9l8N4oxY6cck1Ow/W5nNvYaEdaSybih8Pxd/Mb+UJjLRHy6gVh8Myfy gKftfpe2nZ/jy7UZgKjUPGrT7OBDKJyI+5ORvXaHlBVEQOhLYfwmGmdcw0O2doshV0NM 6SbA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m23si3305666pgv.246.2021.10.14.06.19.33; Thu, 14 Oct 2021 06:19:46 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230288AbhJNNFW (ORCPT + 99 others); Thu, 14 Oct 2021 09:05:22 -0400 Received: from outbound-smtp08.blacknight.com ([46.22.139.13]:41017 "EHLO outbound-smtp08.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231300AbhJNNFV (ORCPT ); Thu, 14 Oct 2021 09:05:21 -0400 Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp08.blacknight.com (Postfix) with ESMTPS id 0C6291C3DBB for ; Thu, 14 Oct 2021 14:03:15 +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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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