Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5241367imm; Tue, 9 Oct 2018 11:51:18 -0700 (PDT) X-Google-Smtp-Source: ACcGV63TNNTFkuG6HdKj2iycalmmL44QToSCDzIYYUOwD7tX7szayO9Pbf6mk3m2DWKzk4efQ8GA X-Received: by 2002:a17:902:b198:: with SMTP id s24-v6mr28659336plr.70.1539111078252; Tue, 09 Oct 2018 11:51:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539111078; cv=none; d=google.com; s=arc-20160816; b=Zg/oSdDe2Ofs9VkEK2tUXzCBlWyahVbCTIAd/rsymcG3FabKq0u5TT/nWk4LuuURYa AV7T3tMpjX+2PCEsdgzK82HDU3RlgrdXgu0SCFpK65mCp/3s4BuS/VuUY0saCp/5j4yy jKKPUGQ34o3wA95Ya+2i1jCQz2RqSBza5890derwAZVeOoFcVOgTlgzWCB4ByikVoSvw msHjpJqR4HKhRAfPHV/WlPx3yRRUbcHX0EZ8WzFd49RKcvraDaRbsyfSQBNjn0PhG/Sk 8loa+V08ScTcvmzG6M8muV+SxssUitSmjLVXg8SzY3G8wcn6mcLdTOWU4cpabLpqAtaQ /+wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tna855SkPJ6zYFOEu1mpIZPvXX+jOZfy3FmFArQWAbk=; b=ll2hX/n26dwUCVIDI252aZlVl5NtYRWRWUpaK8KXh/2QxPvI+MB60qwjK+uiBrqMkw Itc0/jCMeeTZrs01U/yq0WrxZq3bpw3KmNOybMegYnAoQbQN623j/uh1BR0w/yXEwALD 0Nbsi8HtMQgEFo/KoIRilTgGG75Jq0t3ktp7kmRIiTC2ZW8YBmay7j7kFHEPVgZ8dt3T XMbRHTBbcveuZFoWLhs3HehnwiDIFXm/sq/QGrSsGeLeU0Jrl5m8CMmqXhR0gq7bMPrN rLpdbPsW6n8kmOIhgK3DGIpF+hJCGTzCUT4OAO/GCAA1YzDpdEjl7SuweJhlYxiZQKqb eNiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=q1WF876n; 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 e17-v6si18330336pgv.54.2018.10.09.11.51.03; Tue, 09 Oct 2018 11:51:18 -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=q1WF876n; 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 S1727248AbeJJCGi (ORCPT + 99 others); Tue, 9 Oct 2018 22:06:38 -0400 Received: from mail-yb1-f196.google.com ([209.85.219.196]:38324 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726492AbeJJCGg (ORCPT ); Tue, 9 Oct 2018 22:06:36 -0400 Received: by mail-yb1-f196.google.com with SMTP id e190-v6so1105270ybb.5 for ; Tue, 09 Oct 2018 11:48:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tna855SkPJ6zYFOEu1mpIZPvXX+jOZfy3FmFArQWAbk=; b=q1WF876nhlbyKtvMhfR0OHFYV+tN6WzFjXq9mfW/WofE2vNw11mls/DaXKi3PsVf5K Cwsn0hgXBM8SJdQ3Tb6/o/9p0arMyyLmOI5y0p+1a/UxB1iiT1b/T/+UPO4PAptmlKwl Q46Ibp3kVYUyogtr6imYiaJtCKGNWsrsTGMnpemZVR1RxLquBg56ToXyo0jfmJAZyx6Y qcGeVVWmXhW8f+rrJYZ9dXN5fMl7zkkfIpd1+a6yDlkuf0N7M36RWyd8i3PCmbw4ENjl wiZ+kW8DWh5fNvz7cvbM6tznpLhBqCVFx9GhtpLUsU6k/OXQZsl1BAYYIcKehEhGrG8F 5yHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tna855SkPJ6zYFOEu1mpIZPvXX+jOZfy3FmFArQWAbk=; b=d5jdLvYIPElLv822SpioKmWvFfrCI1lillsCXb9F0nKm7hNGByzmRO+MvggB0+I67G 7byAqqv+wB/ZN6BVc41G0xf4kFQ0rm9k/uM1T3pYq6nm/8Ff63MlBcVaK+pvqDrVG73V /QT/eoRFfn930/5JmVJ4jDrKjzfIoAQfemPl3KqIlaK6SXoElqnMFkz0lTk7ut1FWsnK yZye8nW3H/IK0TUoXkJi5oxCA6vu/jr1k4nkv7INviWZo4Oi5gkwCEL4H9szLymWEGdW qezD03J618zqjQ9RDRV1lEpmPal0y4KWFHs/Lt/V1BCvx9nz32kiD+vrZ4Lkk0gsSGbl DC3w== X-Gm-Message-State: ABuFfogBmljaIqHREZDzxZkb4GiRzb5jBnXCvwBhzzEcCRtdZy7QmKBl lyOPAsZI6b/uPUNUNEfiBotEsA== X-Received: by 2002:a25:3a86:: with SMTP id h128-v6mr16695599yba.89.1539110895132; Tue, 09 Oct 2018 11:48:15 -0700 (PDT) Received: from localhost ([2620:10d:c091:200::6:14c5]) by smtp.gmail.com with ESMTPSA id r8-v6sm15176136ywa.56.2018.10.09.11.48.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Oct 2018 11:48:14 -0700 (PDT) From: Johannes Weiner To: Andrew Morton Cc: Rik van Riel , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 1/4] mm: workingset: don't drop refault information prematurely fix Date: Tue, 9 Oct 2018 14:47:30 -0400 Message-Id: <20181009184732.762-2-hannes@cmpxchg.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181009184732.762-1-hannes@cmpxchg.org> References: <20181009184732.762-1-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The shadow shrinker is invoked per NUMA node, but the shadow limit enforced for cgroups is based on the page counter, which isn't NUMA aware. Instead of shrinking shadow pages to desired_size, we end up with desired_size * nr_online_nodes. Switch to NUMA-aware lru and slab counters to approximate cgroup size. Signed-off-by: Johannes Weiner --- mm/workingset.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/mm/workingset.c b/mm/workingset.c index 1d111913929d..e5c70bc94077 100644 --- a/mm/workingset.c +++ b/mm/workingset.c @@ -418,9 +418,15 @@ static unsigned long count_shadow_nodes(struct shrinker *shrinker, * PAGE_SIZE / xa_nodes / node_entries * 8 / PAGE_SIZE */ #ifdef CONFIG_MEMCG - if (sc->memcg) - pages = page_counter_read(&sc->memcg->memory); - else + if (sc->memcg) { + struct lruvec *lruvec; + + pages = mem_cgroup_node_nr_lru_pages(sc->memcg, sc->nid, + LRU_ALL); + lruvec = mem_cgroup_lruvec(NODE_DATA(sc->nid), sc->memcg); + pages += lruvec_page_state(lruvec, NR_SLAB_RECLAIMABLE); + pages += lruvec_page_state(lruvec, NR_SLAB_UNRECLAIMABLE); + } else #endif pages = node_present_pages(sc->nid); -- 2.19.0