Received: by 10.213.65.68 with SMTP id h4csp1177100imn; Wed, 21 Mar 2018 04:44:14 -0700 (PDT) X-Google-Smtp-Source: AG47ELt4RD/CC6qxpJueioiOqi+Bb65kEqEWb0hWRxg1uJE+wBkR2uWfuh7n68yUyCdI/n8LwcDD X-Received: by 10.99.131.73 with SMTP id h70mr14566039pge.195.1521632654306; Wed, 21 Mar 2018 04:44:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521632654; cv=none; d=google.com; s=arc-20160816; b=pFvKxTAljY4wyVK7my5yUPC157MiGFE9HWbveNR81jmvScup8Bal69xddsW5UhIctE Y3/zny3ZkmyBunpx4fX/1MtQGFwm+BIABLXh6HbJilEPedOSRoV/0YBwOtoxeZf3f/w0 YKqTPwdqhF30puR60uDDdIOnyWcpSGk1IVu0Z/1a3HGlCFokHMGX2PVa9TZ8ENZXnf2d pgsBlnIPmcqPbqNfiFYTzH9GAdaNJILvD0ERgqsHcP97IYumOVQsNcgCvkMaG1DO7YLF unaozyVWrpnLMcmfJba5ib8T1rwPdcjGQdEbNT5Jz228j8pr2ggQOy4PFpSKn9g/L87b bKQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=fMreoy48BNzeT7P4gfrrom8fOIiZDzLClqgWKxD91PI=; b=r0e1QK1E0c5Fw9TWdiOePl6+SLchjP3Mzgmska8KVqNN6PJbXbznulIevXPjNR40PQ JBN4opWALuckopJIoJC9D0mV4nQ1PviFR/zSUQs1dxyV30aqDyzmnnQxxWmMuXvmdkgy cmsxlGRWhOYNnXS0/BFD2xg+Zsj9/MbE0ca2B6wbVXVeooKmQpSXsdYueHNWxm3YJJUO KDfRqmxesrTUpl8O94z2XSr03YlzBXY0dJYa63KjPdo9KOKhbqmP76H/vCSlRX8s9kbl v+Rxsef5nraQK2eYWB4APlWvWy1Nv8QZfaLircmA+tBMzP9V4jP4VL3zLCUp7iW2CJxi iYpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b11si2615501pgr.603.2018.03.21.04.43.58; Wed, 21 Mar 2018 04:44:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751541AbeCULnF (ORCPT + 99 others); Wed, 21 Mar 2018 07:43:05 -0400 Received: from mx2.suse.de ([195.135.220.15]:36463 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751405AbeCULnE (ORCPT ); Wed, 21 Mar 2018 07:43:04 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A6BD5AD8E; Wed, 21 Mar 2018 11:43:02 +0000 (UTC) Date: Wed, 21 Mar 2018 12:43:01 +0100 From: Michal Hocko To: Andrey Ryabinin Cc: Andrew Morton , Mel Gorman , Tejun Heo , Johannes Weiner , linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Subject: Re: [PATCH 6/6] mm/vmscan: Don't mess with pgdat->flags in memcg reclaim. Message-ID: <20180321114301.GH23100@dhcp22.suse.cz> References: <20180315164553.17856-1-aryabinin@virtuozzo.com> <20180315164553.17856-6-aryabinin@virtuozzo.com> <20180320152903.GA23100@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 21-03-18 14:14:35, Andrey Ryabinin wrote: > > > On 03/20/2018 06:29 PM, Michal Hocko wrote: > > >> Leave all pgdat->flags manipulations to kswapd. kswapd scans the whole > >> pgdat, so it's reasonable to leave all decisions about node stat > >> to kswapd. Also add per-cgroup congestion state to avoid needlessly > >> burning CPU in cgroup reclaim if heavy congestion is observed. > >> > >> Currently there is no need in per-cgroup PGDAT_WRITEBACK and PGDAT_DIRTY > >> bits since they alter only kswapd behavior. > >> > >> The problem could be easily demonstrated by creating heavy congestion > >> in one cgroup: > >> > >> echo "+memory" > /sys/fs/cgroup/cgroup.subtree_control > >> mkdir -p /sys/fs/cgroup/congester > >> echo 512M > /sys/fs/cgroup/congester/memory.max > >> echo $$ > /sys/fs/cgroup/congester/cgroup.procs > >> /* generate a lot of diry data on slow HDD */ > >> while true; do dd if=/dev/zero of=/mnt/sdb/zeroes bs=1M count=1024; done & > >> .... > >> while true; do dd if=/dev/zero of=/mnt/sdb/zeroes bs=1M count=1024; done & > >> > >> and some job in another cgroup: > >> > >> mkdir /sys/fs/cgroup/victim > >> echo 128M > /sys/fs/cgroup/victim/memory.max > >> > >> # time cat /dev/sda > /dev/null > >> real 10m15.054s > >> user 0m0.487s > >> sys 1m8.505s > >> > >> According to the tracepoint in wait_iff_congested(), the 'cat' spent 50% > >> of the time sleeping there. > >> > >> With the patch, cat don't waste time anymore: > >> > >> # time cat /dev/sda > /dev/null > >> real 5m32.911s > >> user 0m0.411s > >> sys 0m56.664s > >> > >> Signed-off-by: Andrey Ryabinin > >> --- > >> include/linux/backing-dev.h | 2 +- > >> include/linux/memcontrol.h | 2 ++ > >> mm/backing-dev.c | 19 ++++------ > >> mm/vmscan.c | 84 ++++++++++++++++++++++++++++++++------------- > >> 4 files changed, 70 insertions(+), 37 deletions(-) > > > > This patch seems overly complicated. Why don't you simply reduce the whole > > pgdat_flags handling to global_reclaim()? > > > > In that case cgroup2 reclaim wouldn't have any way of throttling if > cgroup is full of congested dirty pages. It's been some time since I've looked into the throttling code so pardon my ignorance. Don't cgroup v2 users get throttled in the write path to not dirty too many pages in the first place? In other words, is your patch trying to fix two different things? One is per-memcg reclaim influencing the global pgdat state, which is clearly wrng, and cgroup v2 reclaim throttling that is not pgdat based? -- Michal Hocko SUSE Labs