Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp981591imm; Wed, 1 Aug 2018 08:19:01 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf+P0GG4HduCcT/UkyiRILm9GzQDw7hauU032H4ybJi5nGuhi0K6JLVWi/F3MxwtKZXOCJB X-Received: by 2002:a62:3601:: with SMTP id d1-v6mr27191695pfa.41.1533136741018; Wed, 01 Aug 2018 08:19:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533136740; cv=none; d=google.com; s=arc-20160816; b=oks66sbrh0pfjeVpzmwABiCnH/M14OY5kZTuCMNWoi7kkdGEuNhZrvpEN3lY+mnk0u fZBmuukyZ9/BibUBY77uhfpkVwFt6J9xasqc9utkrNW0Gl2emuQeLMRHRMZHuMbfy/i/ m58AOnrZ78Ydf8ivB9F97n20h09ObiKKyUgUZumxgzbERVDYfI9eItIY9bBCi0xwPwfd 3bk4a96rfEe5xyl46tXZ3IwtaqgtYFpA4lmEb3BmatdeYbVO6ze7zwXK3Xaxt75VM9/U cqd1gLGrtnQQIsOmmWYS5+EOjQS6KwGYh0nBBmM9ehTVagqDVjUCUAUn7oDUwo6TwTE8 HuJQ== 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=dPzbJJIeJgfn8++cxkOJb5Dz/B61/Buo1muVR4A4+7E=; b=avPZg1mbaC9M3XyMHI7vxWbgEtHBaPj9SVfk70rvZA4eUGwBGrB4ic64A+94AenQws ml00V1OODJJkflBWz2Bln0PdbWXhqGanF6NyiAHoLrqTrhsA1qnbqTY/boZFbvFfODeR U3HVfv4WuAnTUClKp3oXFZZ4crOACDaT5ojtNvUjLYK3+E30kTt15W2zmyBFrbS9rWKC LRw/NwfSa6RkfyT2tAoMXRUG78K3aiZMQDO35x8Ac1OnliZfzVqp5Vxgka3OWp+3J9+w lGycESYXEsskCTfGeluLibKkjwCHg2W05HE3InjV1i8LyR2dN4D8Dd2kU0aTlRw2EBKX UNeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=vjkKAP6u; 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 z9-v6si17232945pfg.46.2018.08.01.08.18.46; Wed, 01 Aug 2018 08:19:00 -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=vjkKAP6u; 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 S2389743AbeHARD2 (ORCPT + 99 others); Wed, 1 Aug 2018 13:03:28 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:47090 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389704AbeHARD1 (ORCPT ); Wed, 1 Aug 2018 13:03:27 -0400 Received: by mail-qt0-f196.google.com with SMTP id d4-v6so20256339qtn.13 for ; Wed, 01 Aug 2018 08:17:16 -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; bh=dPzbJJIeJgfn8++cxkOJb5Dz/B61/Buo1muVR4A4+7E=; b=vjkKAP6ubSVRmeQnLIA1gqmu8OAqsEHegFTBIDM1/gU9CHgInYOeLeKoL9P1dcM5B8 F/g3ROFEMdcJg5dDR13yU3joj5UQWsjMnRDx0MouUUBe7DxHXOPd32pQJYysbbJZLLgH xlEMIfX9TjiQ+72+ycMhG1eMvquOXetDj2NhDc9pedmsJU9lRUIPuf8Q0mfCT+Z74Pjf yCDRJ+CA+TaGOqToLtodun/RLgCBPA0aO6HVisiIC05uiTi+4FORM5tjzYEcsdrHNd6T wvNUSYsmzHT8lv5HXIX1e6XMrF/B/D9vp76MjyyLkRYtFV2y5qHoKO2H9z/aPvzbK0ua 6Tqw== 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; bh=dPzbJJIeJgfn8++cxkOJb5Dz/B61/Buo1muVR4A4+7E=; b=i/fFfMKdhavFAKUKzWaJSVhIIjOGd1c8Hzkm4u9DtWGWddouuJtDurEKluvQnG8B6g dC194Yb69gJp/cHB3DGd6rJUk1LC5jHRRlUYE5VEURviux95VShqyF65epW2mj11i+vK e+vSmtR73WhvX5uF1Kf5g0nFr/htnnb3ThkBsyXvRvZ9TOjMd/IT+BKeVhfQsN+qhh4T t4mfpDGYbVBtQKipZZekPC9jSLAX/c9mRAnaNvWVBcFrSS5HTzVmZUTXRz0fG2HCWeGI jDywGD3Vb9ukn4id56qNzyiG43IpP7j/AbrPt3KjvBfaeafZ2m+UaIRY3Nxn46jRBdN2 Rjsw== X-Gm-Message-State: AOUpUlFFhwMf7uAOWUusXJYUwFEpzXe+/uzbj+gBnsCbfj6HInhgjTGD 0SHjPoB8vTVIuCguIkYOboWl1A== X-Received: by 2002:ac8:28ca:: with SMTP id j10-v6mr26812646qtj.9.1533136636070; Wed, 01 Aug 2018 08:17:16 -0700 (PDT) Received: from localhost (216.49.36.201.res-cmts.bus.ptd.net. [216.49.36.201]) by smtp.gmail.com with ESMTPSA id 127-v6sm10610783qkn.78.2018.08.01.08.17.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Aug 2018 08:17:15 -0700 (PDT) From: Johannes Weiner To: Ingo Molnar , Peter Zijlstra , Andrew Morton , Linus Torvalds Cc: Tejun Heo , Suren Baghdasaryan , Daniel Drake , Vinayak Menon , Christopher Lameter , Mike Galbraith , Shakeel Butt , Peter Enderborg , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 1/9] mm: workingset: don't drop refault information prematurely Date: Wed, 1 Aug 2018 11:19:50 -0400 Message-Id: <20180801151958.32590-2-hannes@cmpxchg.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801151958.32590-1-hannes@cmpxchg.org> References: <20180801151958.32590-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 keep just 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.18.0