Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4611920pxb; Thu, 14 Oct 2021 08:33:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydpOUAP7u2BMQrIyll0ACANKL726V//jLztxpymiTtyM4zn/TZb4BAmrM9hoRH3mFs+mMj X-Received: by 2002:a50:cf48:: with SMTP id d8mr9581538edk.293.1634225602979; Thu, 14 Oct 2021 08:33:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634225602; cv=none; d=google.com; s=arc-20160816; b=HByKU0sVWYlpybhiUNacBrcJ/+UaprFjImAQGV1wyl6vOnu2WlufVCJ9vtW62sa6dz oPXxRBcqHQldowSe0HFhbQxIB+sAZxt+bXqAJSARUsoASQdDqA82Y+m9J+34P86h4qS0 t1GM9qURGfBydNqO1ME8J1iJ0UQxSW81pCAhNxr5FDtdRKEK628T5s/+uzDr25orxLzu zj4S++Ls9fTn6nUlA9tG4OGa2TIyZ5DQiekJ+tHgTR+U0P7dN3oAGuGRFO29EpSU0P9U yk/2EjgM4eLP/Wh7OEnZKVFfL29o/KT3oUIp76uqXvHTc86st2Y9D8vw6cUE4QkG9TKB 5D8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=n40SRtgva50SSKl6eT8u22z5biYkfXHzvY/Tg6OKccQ=; b=I6zIl0o2aQStjvUTAhtfWcTQUtbugA6JiRQio/dng1m/hmw7qJpL5pkg4E5oUPrIz8 BCGCU7lzrTn5Q0dr1IxV6Hx7p6ceSOa2QbbHfENWuzUQEwR0EOrmG4WatdgFsJTNG+Wp PfiIzvTTUcyvi7UYSEd42AiM3s1ulro+fxX8rpBaks6wYWbq3Ey/MuIqT9zy5LduujjE Sfy5knFSCyPvPP4sQ031YsbF7WxIb2begcGbH6l9rQEJKEoFl28TGR0jzttrbE9wALuN gJzqwRZYbgojMBuQiQ/1ZUUytIBXjd+g92M36t4g0Jt65RZeQkSEtrTST+QoRELv+O+B E57g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=0ls32B68; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=SiaZeAb3; 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 qw9si6028217ejc.766.2021.10.14.08.32.59; Thu, 14 Oct 2021 08:33:22 -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.cz header.s=susede2_rsa header.b=0ls32B68; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=SiaZeAb3; 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 S231629AbhJNMdY (ORCPT + 99 others); Thu, 14 Oct 2021 08:33:24 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:60526 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230177AbhJNMdX (ORCPT ); Thu, 14 Oct 2021 08:33:23 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id BB88521981; Thu, 14 Oct 2021 12:31:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1634214677; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n40SRtgva50SSKl6eT8u22z5biYkfXHzvY/Tg6OKccQ=; b=0ls32B682t/neYUSNUr8zXQaacQZqKZclL6GE6565/a7AZ/+/wk6Q+tpohi0dcJgezb5Fd 36rHePtmN0c+xr1bj8a9L6Yf2JvYQRpDOiOB3B4bCzoqmvoK8kP1vG9yKHHfDa+xd3oQ9P ozwK3bq895bxNgnb/Qvfg9RYADmfDGM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1634214677; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n40SRtgva50SSKl6eT8u22z5biYkfXHzvY/Tg6OKccQ=; b=SiaZeAb3Bsc9kDNRP0Y09OL70P79ppmR7mpZvUOqQsqET3kSk537ChPFTjmYmuifeMQDrm 2ORISegYfQ1aMNDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8707E13D8A; Thu, 14 Oct 2021 12:31:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SYk+IBUjaGFLPwAAMHmgww (envelope-from ); Thu, 14 Oct 2021 12:31:17 +0000 Message-ID: <63336163-e709-65de-6d53-8764facd3924@suse.cz> Date: Thu, 14 Oct 2021 14:31:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH 3/8] mm/vmscan: Throttle reclaim when no progress is being made Content-Language: en-US To: Mel Gorman , Linux-MM Cc: 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 References: <20211008135332.19567-1-mgorman@techsingularity.net> <20211008135332.19567-4-mgorman@techsingularity.net> From: Vlastimil Babka In-Reply-To: <20211008135332.19567-4-mgorman@techsingularity.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > + > return nr_reclaimed; > } > #endif >