Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp110064ybg; Tue, 22 Oct 2019 17:03:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPUqxYut4FgJTtEgZI+DI6piCOkV7JaCl0qjoy+WgwD4x6zS/xk6uqzh+lUWlGB4utu9NT X-Received: by 2002:a05:6402:21c2:: with SMTP id bi2mr34241595edb.8.1571789020698; Tue, 22 Oct 2019 17:03:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571789020; cv=none; d=google.com; s=arc-20160816; b=yuaL3fJBiJZ94NnnEoc4OZkwVJfwwcca5WnRyRx2ujlJ98s/jSpfO9g8uA00Frfn9v IfhZ9gmvbPjiF/aYZAIN+TT/D7UOw2Z7go2Gdkm0xG0SB4wDtZWaWQ/UhPVSUGydMUaM 4Kzxex1veK3wsA4n2p9+k0mgZs+ABGJaF1AldLqrEAkFcngsf1zAKoBWNHCsS62ZV8km ytIlj/5QvaUIVVAzG912R1zd/N8fOdC9olX3FX2wMb1AvIjbyM9utA6O4OiYRqIEi+gb TzjRyKJWfeCi8+v3Fvo17q5IZp7nf/qo9WwLK8AcdHJy+Np8IyAXCuY4LwSfHWyhnb38 +TGw== 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:dkim-signature; bh=UkVKcIoIjwq/4A0nvuIrRwIJe7BfuWm5uRD47GZUEfM=; b=Viv5dz7N76fe6AZQ0YLo9zkqs9b4rcxUb5sYVCo1nEbxgWDFV7KAfnq/Qrsrw56Zq8 A9Ox+K6hmvGTpVsSYcuR4u6jCLX/4tBpobFdH4OYVcKA525ChNQp9hpJ6mRZ34Gc29gy Zsy7sHY24kJLb73RWqbDU0MLi2105dnRKorYpQSch/Niwg9iwId4BDaDQPEBT4CMIRWx O+ROlonoAd4LobhtIzmCCd74YO8rTJw1gv9XEILu3wkIxKno5KTmtfVdME6Tqe3GXWLn 6jyPPvxhARxOXTMYlEa+ypRPFefkqLWB0G7nZHA3cz1EzX3CWGUb5Q/Y4/InTap86nyG R2LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=RH2e1j+T; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pv13si11971094ejb.79.2019.10.22.17.03.16; Tue, 22 Oct 2019 17:03:40 -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; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=RH2e1j+T; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733162AbfJVVmx (ORCPT + 99 others); Tue, 22 Oct 2019 17:42:53 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:40026 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731559AbfJVVmx (ORCPT ); Tue, 22 Oct 2019 17:42:53 -0400 Received: by mail-qt1-f193.google.com with SMTP id o49so21317557qta.7 for ; Tue, 22 Oct 2019 14:42:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=UkVKcIoIjwq/4A0nvuIrRwIJe7BfuWm5uRD47GZUEfM=; b=RH2e1j+TaBj5hLQezyCMTCJMMgTJv8iyXFP6oi7yBda7boYLxE/75IqlCvdSqkfjKo UI0vJQI+QQgcRd86+pdAoij4fnL4PuIwY/xMdr7ya84mJKI0lQl+3HHjmDEiOVGMS4UY FGtgYoOm+eWSvAhmhs/crmTiyzht0NFTlsEAjD5ZNL99YfRZhBz50+Lqf9f80deynnWG Wx1Su905GSpJZxfD/2akXjNl4UKi9cWGl9eZccJhfeO16I/VQoWCRLH7nqV1MWwqgVVr l/LP3JAJr5reGl4bakvVttU+XEWyxTVQtiUne915oAXSj34XHfRjYFmxaI2K1135QTii ZlbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=UkVKcIoIjwq/4A0nvuIrRwIJe7BfuWm5uRD47GZUEfM=; b=f6jXtaekJmdcSJfvyGH17rA8wC/3VAblorxJACmSX5qXIQlz15OB8mYqZbzNIelZTH YgQstRyKOXtunXvs3hLxNQmH4F11kjAKmB/HATAf/vJzR4Etz6U63yI0Sk2F2K2eKDAG 0MvxxbqjaPM0DBQjc8ElEOa96Aher/oOADX1Cx/X5z5MhRHACPyBvh1vsS28ooLMBeYq mXXbHAA5OX6syIg1OpTxOf0rKHKrsYYuDg7173+TCuSCPoY196L1EcNEs5UXB6A7m8Fg jPVMjBEMNVq2edPKijibJnGsSNm1pmCM3s7rBXGkgSqD4UWf3KJFrR4STNkH9UKkm7+x iDtQ== X-Gm-Message-State: APjAAAVRvH8Hkzgi19YKQxDIzSf9eiqAc9hOu7WCXsqItRd85WERpLco EGmGfa9VD7Wwbd1xJED7toZNGw== X-Received: by 2002:a0c:f952:: with SMTP id i18mr5363328qvo.131.1571780570446; Tue, 22 Oct 2019 14:42:50 -0700 (PDT) Received: from localhost ([2620:10d:c091:500::3:869e]) by smtp.gmail.com with ESMTPSA id n4sm10492844qkc.61.2019.10.22.14.42.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 14:42:49 -0700 (PDT) Date: Tue, 22 Oct 2019 17:42:49 -0400 From: Johannes Weiner To: Roman Gushchin Cc: Andrew Morton , Michal Hocko , "linux-mm@kvack.org" , "cgroups@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Kernel Team Subject: Re: [PATCH 5/8] mm: vmscan: replace shrink_node() loop with a retry jump Message-ID: <20191022214249.GB361040@cmpxchg.org> References: <20191022144803.302233-1-hannes@cmpxchg.org> <20191022144803.302233-6-hannes@cmpxchg.org> <20191022195629.GA24142@tower.DHCP.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191022195629.GA24142@tower.DHCP.thefacebook.com> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 22, 2019 at 07:56:33PM +0000, Roman Gushchin wrote: > On Tue, Oct 22, 2019 at 10:48:00AM -0400, Johannes Weiner wrote: > > - /* Record the group's reclaim efficiency */ > > - vmpressure(sc->gfp_mask, memcg, false, > > - sc->nr_scanned - scanned, > > - sc->nr_reclaimed - reclaimed); > > - > > - } while ((memcg = mem_cgroup_iter(root, memcg, NULL))); > > + reclaimed = sc->nr_reclaimed; > > + scanned = sc->nr_scanned; > > + shrink_node_memcg(pgdat, memcg, sc); > > > > - if (reclaim_state) { > > - sc->nr_reclaimed += reclaim_state->reclaimed_slab; > > - reclaim_state->reclaimed_slab = 0; > > - } > > + shrink_slab(sc->gfp_mask, pgdat->node_id, memcg, > > + sc->priority); > > > > - /* Record the subtree's reclaim efficiency */ > > - vmpressure(sc->gfp_mask, sc->target_mem_cgroup, true, > > - sc->nr_scanned - nr_scanned, > > - sc->nr_reclaimed - nr_reclaimed); > > + /* Record the group's reclaim efficiency */ > > + vmpressure(sc->gfp_mask, memcg, false, > > + sc->nr_scanned - scanned, > > + sc->nr_reclaimed - reclaimed); > > It doesn't look as a trivial change. I'd add some comments to the commit message > why it's safe to do. It's an equivalent change - it's just really misleading because the +++ lines are not the counter-part of the --- lines here! There are two vmpressure calls in this function: one against the individual cgroups, and one against the tree. The diff puts them adjacent here, but the counter-part for the --- lines is here: > > + /* Record the subtree's reclaim efficiency */ > > + vmpressure(sc->gfp_mask, sc->target_mem_cgroup, true, > > + sc->nr_scanned - nr_scanned, > > + sc->nr_reclaimed - nr_reclaimed); And the counter-part to the +++ lines is further up (beginning of the quoted diff).