Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5240265imm; Tue, 9 Oct 2018 11:50:12 -0700 (PDT) X-Google-Smtp-Source: ACcGV62rUiheO5UK2HV/mqaQovd1dCP/oN8x5pFWoicA8wKpf8rlafEYBID2w5lFRMqoZkdPBUJP X-Received: by 2002:a17:902:1021:: with SMTP id b30-v6mr30359223pla.23.1539111012830; Tue, 09 Oct 2018 11:50:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539111012; cv=none; d=google.com; s=arc-20160816; b=D9oLRvbb9NzqhWdS8heLMMezVNl9bxzJpzzrJKrTEcjtj903Wf5qV+CFzeHf6yH+kD 55g0omtboCDsJWQht2Bo7SUwgMXduiCOxaYzp5Fd4pzbx4FlFnlU3RJkiPCjmOSB6v3Q ncFZOg09euRgqFV6PwxJZQHxdxBeiiiVa02bknPeVJJ//oUdKi2/OBLkK5YR5CbS4PiT ZzH21ahn9doxFcnchtGi2Kl9W2a1qzZEPPDYs05eu8fKufa0EmFK3N4HeUS13INOoELa LNEGaYq/VoV16ilbTJ5r2jf6Wg7wxQx3cXeA9g2XsN71EWty2JeM7iS7TPhztLMpe3+C oMEw== 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=5KEsEdGBvrMUNWtGyEIiTPpN958jHDkc6gRi8ilCin8=; b=L5SuUvjfJ7mo+St73rCcYqQ4plK+AmHPHa5EvS9qMGsB2poMfoCEQdkLPSZdvB9wjU btTYx9c4XrpH+jhIEBOVL2P6V9q6NqEnnhpaoYV2EI3cHrlutF80zndln0Rf6Or2UIRD QYt37mL++CRudgWn8J60xMd1876fiGs+RLaVCexq6f5SBlB8kuLIVsVqavWCfZUuqPp1 huV5iCfJD5wlY97dZPsKQIKatZBr0rUTU9XyLJLzufz5Km1ePKozmMFrca/uD9vVPi0y OOXvXX0WLTiq7NxigpKdHEedzRoaNtRUhkVEqNDM23WDd13YAWLBQW1nGNMBCIe9iHIc rzCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=iHW4Xuaz; 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 go1si21702468plb.242.2018.10.09.11.49.58; Tue, 09 Oct 2018 11:50:12 -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=iHW4Xuaz; 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 S1727416AbeJJCGk (ORCPT + 99 others); Tue, 9 Oct 2018 22:06:40 -0400 Received: from mail-yw1-f68.google.com ([209.85.161.68]:33580 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726486AbeJJCGk (ORCPT ); Tue, 9 Oct 2018 22:06:40 -0400 Received: by mail-yw1-f68.google.com with SMTP id m127-v6so1111663ywb.0 for ; Tue, 09 Oct 2018 11:48:19 -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=5KEsEdGBvrMUNWtGyEIiTPpN958jHDkc6gRi8ilCin8=; b=iHW4XuazhRFqlrZRq9IUKEVo7Apl+liUkomlKYHmxGSxyFc2pckXE8G6NTzXQ5su7/ okopKOrLP5N1PXqh8N8RYwtSnbtaSlmxmce+2IQchMunbthj/9WDU89QVNbdwqc0/kX8 fxvzAZ3mhC1Q2vL895UEFZY6BDqyNjZ0D9m98T8Lg5KGnpYzoo9BFONj02tvdJM2e+jg ljsIwB7FxTAVrnnLRXuoZT08vIztvbrB19hE0Gcmei1orsZIunZ7qsGA2F4dhN9jpaRh eI7yUuXCKEhL4VwqEszgnTOYaVxXbQLTsfQ/NwOSYTWkzpZTmpm+LF4U7D8oNofLm8gu oyjg== 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=5KEsEdGBvrMUNWtGyEIiTPpN958jHDkc6gRi8ilCin8=; b=QRoZXnu3A24HY+CgtXhhmJ8GdFj+mrgjvIpay3WMPjNagTCoHp1dKA8cGkU8nVim93 huhdBP13kioRxWRWiNGpN2/T/VgjY4yR8TScJ4uN06MlkJ0u4rVA8Qfuf1oYLBwkSMiV Bxb0jVDMPjBcdDVwXkCi+qO8fix5WP+/ETBSeijmjrtTJ55kuqAdNjXvrzNnlTod7yZF hQdDTti8Pvrzp/SiLVu8p5YmjACp7A8R/25yxgfZHr21jx6HWrCEFSsjDst5PS/aYlOg vmb9y9G/yMfYfSWEPtKYXKUC0PRooMCBBabbaR2CAChBOEcnQtw3F+xKpObutXYtZW5R LMTQ== X-Gm-Message-State: ABuFfoiXPSTSnv5bUWmsbDTJWduzKc1zBJWuSsesnmec1okPA30p1aX6 mRb2tZOX6sTWN8y3Hwd1qdBuJ4f2QAc= X-Received: by 2002:a81:2609:: with SMTP id m9-v6mr16924353ywm.67.1539110899119; Tue, 09 Oct 2018 11:48:19 -0700 (PDT) Received: from localhost ([2620:10d:c091:200::6:14c5]) by smtp.gmail.com with ESMTPSA id o202-v6sm35068808ywo.38.2018.10.09.11.48.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Oct 2018 11:48:18 -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 3/4] mm: workingset: add vmstat counter for shadow nodes Date: Tue, 9 Oct 2018 14:47:32 -0400 Message-Id: <20181009184732.762-4-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 Make it easier to catch bugs in the shadow node shrinker by adding a counter for the shadow nodes in circulation. Signed-off-by: Johannes Weiner --- include/linux/mmzone.h | 1 + mm/vmstat.c | 1 + mm/workingset.c | 12 ++++++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 4179e67add3d..d82e80d82aa6 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -161,6 +161,7 @@ enum node_stat_item { NR_SLAB_UNRECLAIMABLE, NR_ISOLATED_ANON, /* Temporary isolated pages from anon lru */ NR_ISOLATED_FILE, /* Temporary isolated pages from file lru */ + WORKINGSET_NODES, WORKINGSET_REFAULT, WORKINGSET_ACTIVATE, WORKINGSET_RESTORE, diff --git a/mm/vmstat.c b/mm/vmstat.c index d08ed044759d..6038ce593ce3 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1143,6 +1143,7 @@ const char * const vmstat_text[] = { "nr_slab_unreclaimable", "nr_isolated_anon", "nr_isolated_file", + "workingset_nodes", "workingset_refault", "workingset_activate", "workingset_restore", diff --git a/mm/workingset.c b/mm/workingset.c index f564aaa6b71d..cfdf6adf7e7c 100644 --- a/mm/workingset.c +++ b/mm/workingset.c @@ -378,11 +378,17 @@ void workingset_update_node(struct xa_node *node) * as node->private_list is protected by the i_pages lock. */ if (node->count && node->count == node->nr_values) { - if (list_empty(&node->private_list)) + if (list_empty(&node->private_list)) { list_lru_add(&shadow_nodes, &node->private_list); + __inc_lruvec_page_state(virt_to_page(node), + WORKINGSET_NODES); + } } else { - if (!list_empty(&node->private_list)) + if (!list_empty(&node->private_list)) { list_lru_del(&shadow_nodes, &node->private_list); + __dec_lruvec_page_state(virt_to_page(node), + WORKINGSET_NODES); + } } } @@ -472,6 +478,8 @@ static enum lru_status shadow_lru_isolate(struct list_head *item, } list_lru_isolate(lru, item); + __dec_lruvec_page_state(virt_to_page(node), WORKINGSET_NODES); + spin_unlock(lru_lock); /* -- 2.19.0