Received: by 10.192.165.148 with SMTP id m20csp3530713imm; Mon, 7 May 2018 14:02:23 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrQgzSkeJak6CSekr5ppDw4AO966KqGKaKnxzSsOi25K7wg5Xx2s3m7YyTO0jDRMImutNYV X-Received: by 10.98.155.141 with SMTP id e13mr37824060pfk.157.1525726943516; Mon, 07 May 2018 14:02:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525726943; cv=none; d=google.com; s=arc-20160816; b=cGNibSTIrMBZnwJXpGERVCMzQ4DozFfTXaJXhqjvv7BW69WFgosQ/VEON3SVOG0P6B /ukUA/aCfHsnbRfHdyz12iLZlYJqHMSPhgWhGhFMFccIm4fzH/rAz92yihEQvx/HWJJ1 4eN9wPKJpUM55PQ6OMFrRCnPt7au3SOpQcP72It4xkHF8yFr3yc/h3O0UQEGMV+Qq8Yc YtG7iAf7uW7WmmCspkT8GRIR5IDSM9PkUrj9/pX1lsepbx1rkWHBu9fANuZeQBmmVPTq j/JpEUxP7taxdPxKvAIGhVti25snIrCoOMx0GzfxlqVhDq8uMBU10JoRcxzMajQkiwHt VbXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=PUltZEzDEG5OoCb+tqodLp9Z8/Tnpk6sVV12mVb/eA4=; b=mZ6bvuY3ZDzkHJdBRod7f3LavzDlKrB1VmDXGaUPgyNvoSfycnuxw3YHvLgAUayJLC rVaUydQnTInfPAJfA6c5xhqMpcg+GZ0NOk2Jp4kwz8KkYBitt9zMBOvfdTQk/S/AHBL0 3KDf3EJeF63VYO56OF7OG8t2VUgpl4yRX2yjT+2ywpmsh7f0Fxj5/fJyZW31HqX1Jq4r SOBCvO0/BHb6ir5rELsjPKtI245z3xyQYFOUzJlSRtmIARtcabm94bmW1fzVjtzWxjhh Ou6fT/y6HcXau5NKQAe/aj8Icg1bkENtWI1nCgGUhpuolieaqRQY362BGaTEGKApTirI da8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@cmpxchg.org header.s=x header.b=OmaVwI8p; 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 k33-v6si22694140pld.100.2018.05.07.14.02.08; Mon, 07 May 2018 14:02:23 -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=fail header.i=@cmpxchg.org header.s=x header.b=OmaVwI8p; 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 S1753450AbeEGVBf (ORCPT + 99 others); Mon, 7 May 2018 17:01:35 -0400 Received: from gum.cmpxchg.org ([85.214.110.215]:49468 "EHLO gum.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753348AbeEGU77 (ORCPT ); Mon, 7 May 2018 16:59:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=cmpxchg.org ; s=x; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender: Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=PUltZEzDEG5OoCb+tqodLp9Z8/Tnpk6sVV12mVb/eA4=; b=OmaVwI8pE1UO2/VIRQ9jhgQqzZ cQYOQPeroWsyFgzG+sismg1l/i71Nqas83UlWjadkAauuymtfcD/w3ifYgbHJTDuF+7Oek7w4qof9 gS2t9OH+bAFy5pcBH7AjWq1hwNBcVECpGZ5P8EdIFfOuc/go7bKQq9ZfFdAnro536aaQ=; From: Johannes Weiner To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-block@vger.kernel.org, cgroups@vger.kernel.org Cc: Ingo Molnar , Peter Zijlstra , Andrew Morton , Tejun Heo , Balbir Singh , Mike Galbraith , Oliver Yang , Shakeel Butt , xxx xxx , Taras Kondratiuk , Daniel Walker , Vinayak Menon , Ruslan Ruslichenko , kernel-team@fb.com Subject: [PATCH 1/7] mm: workingset: don't drop refault information prematurely Date: Mon, 7 May 2018 17:01:29 -0400 Message-Id: <20180507210135.1823-2-hannes@cmpxchg.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180507210135.1823-1-hannes@cmpxchg.org> References: <20180507210135.1823-1-hannes@cmpxchg.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johannes Weiner If we just keep enough refault information to match the CURRENT page cache during reclaim time, we could lose a lot of events when there is only a temporary spike in non-cache memory consumption that pushes out all the cache. Once cache comes back, we won't see those refaults. They might not be actionable for LRU aging, but we want to know about them for measuring memory pressure. Signed-off-by: Johannes Weiner --- mm/workingset.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/workingset.c b/mm/workingset.c index 40ee02c83978..53759a3cf99a 100644 --- a/mm/workingset.c +++ b/mm/workingset.c @@ -364,7 +364,7 @@ static unsigned long count_shadow_nodes(struct shrinker *shrinker, { unsigned long max_nodes; unsigned long nodes; - unsigned long cache; + unsigned long pages; /* list_lru lock nests inside the IRQ-safe i_pages lock */ local_irq_disable(); @@ -393,14 +393,14 @@ static unsigned long count_shadow_nodes(struct shrinker *shrinker, * * PAGE_SIZE / radix_tree_nodes / node_entries * 8 / PAGE_SIZE */ - if (sc->memcg) { - cache = mem_cgroup_node_nr_lru_pages(sc->memcg, sc->nid, - LRU_ALL_FILE); - } else { - cache = node_page_state(NODE_DATA(sc->nid), NR_ACTIVE_FILE) + - node_page_state(NODE_DATA(sc->nid), NR_INACTIVE_FILE); - } - max_nodes = cache >> (RADIX_TREE_MAP_SHIFT - 3); +#ifdef CONFIG_MEMCG + if (sc->memcg) + pages = page_counter_read(&sc->memcg->memory); + else +#endif + pages = node_present_pages(sc->nid); + + max_nodes = pages >> (RADIX_TREE_MAP_SHIFT - 3); if (nodes <= max_nodes) return 0; -- 2.17.0