Received: by 10.213.65.68 with SMTP id h4csp1312883imn; Sat, 24 Mar 2018 09:10:49 -0700 (PDT) X-Google-Smtp-Source: AG47ELvuLtE1LCJn9rf2c6NuYXwzDWLZ8tn+JshhHeNbIjSznteP8YQ2UPCFA0kDq5YuDlM4rcsL X-Received: by 10.101.70.132 with SMTP id h4mr23829942pgr.155.1521907849786; Sat, 24 Mar 2018 09:10:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521907849; cv=none; d=google.com; s=arc-20160816; b=DlYsyftGgcyPB/zExiOh7pTDErO7elKTd1BFQTgyeBel8lJyyoAAUl0VRupTa4yNOD 2kuhKgk0pWreaeCKl4Ap9VLnT/U9GbuLY/CeX6CCmdfK84tSjWvzZjqPsZljO+Ss0b2Z fkONo/UUkuGqA+vOGeHfk4d0No8+MRHl1hk36RBUawB1IprDdRyYBZcGSXPtloBGT9MR yDDcBeSEps7qUd70TN/5qcWWxpqMsURjEl7EeFvuixi2r58de5FC26WBzSZfS/EqyRzI MWOplkutGINUC0mgE+iMqEFqLhuIbf9T5jSg8mTU0LvF0vNRhEzZVp423i9I3KZAQT5K 2nMw== 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=BTdX2Kl6sQttClqcWQ/16Y9rC2X73c2Syo2Wq3t3azM=; b=Ix0CLLzdfWnKNcYQ7vOZ5BYNLwzplRfZTKjXglK6lF2d8Ge2JBhHmhppt6yq30spSJ RskjFBYtR9FcXdchci02ppiKGecXWLxHlj4n2Ook++kzSR8rzU9NGDuQlQsTlhTlpJFS D3QWoM4sSoYRfXcGTAkEm0lH6kwfgOIhiFDRrLgzQqBpZSSPa6o0VOyOhB+LF1GR05CH 4tv+ibos3LUwvIGe85d04N4isMPvkAZS46QaSEUdibokRzzmzorg+NPy079XgRzYa6BP MPH91JEKytkPHujMUp84pQC3vFzlnOddHLNIASnJxy4vMmZrgaBCuyu3WbkXoQrepjZ3 Q/uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=h1S4Z0oF; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h68si7659072pgc.537.2018.03.24.09.10.35; Sat, 24 Mar 2018 09:10:49 -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=@gmail.com header.s=20161025 header.b=h1S4Z0oF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752536AbeCXQJn (ORCPT + 99 others); Sat, 24 Mar 2018 12:09:43 -0400 Received: from mail-yb0-f193.google.com ([209.85.213.193]:34822 "EHLO mail-yb0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752486AbeCXQJj (ORCPT ); Sat, 24 Mar 2018 12:09:39 -0400 Received: by mail-yb0-f193.google.com with SMTP id v66-v6so5075259ybv.2; Sat, 24 Mar 2018 09:09:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=BTdX2Kl6sQttClqcWQ/16Y9rC2X73c2Syo2Wq3t3azM=; b=h1S4Z0oFTvb1csiQIHzRZR0CsRPiC9fSuXC3/8Qg4Y9V+wlvmBaWQLgSZE2EGcDvFC ShyQOzruBTb73eE5Sg0bXcoSauQ+6t/Q1P8okmsGIi3XTtN6RePp4ogJRYcAHd20gDXl E4AU7ouugtx5+I9Gg7kElk4tD0CArLHyxUJEFZ6oGbyzNL0SjUGPg6B0rFCi8eUFtwnM 0GbMevN0QeYfA36RFaXBYCBsV6knofY1VjdGNz0oiWJ2ux1egSh/pVYJpVLcPPt+Ar3I igPYoMjQwQxQl7ioAZIIGQ9vA6Bp8kdR69qv04D8b6POcWR6gFbjcJ24DykiGbpyuACz 9Zew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=BTdX2Kl6sQttClqcWQ/16Y9rC2X73c2Syo2Wq3t3azM=; b=UFblB6jsavSYbdW3xEfEeAVtJZR4FqntFecKLGE7xcpuYt3NBbKgBxBtpUXpKnyvLp 4m8bK/ZATqto+tAsL1kSc9r0YdmnvhnOpSYoxS1NlQL3GgLCbB3lUMzJsOykTwFNymns Jfohpg5Ojgkc6W2bdGtR7J7s+vioOtGfahZq285ylImzAw7SU0+e2G3T3weN8a0O8l6y nFdYKTeA8tHni9KuDhaAyQb1gYZmS70VBZL5Bac1ZTiTPM0maIC2Xum8XyQ7ERIlS5gQ ss7DN2pGHam4QvUIVhEMjUY1+WEo8HBu/RJuD49KvJw0Y+tRiPNoLvH7JzpGauO+OUwj EmPA== X-Gm-Message-State: AElRT7FSFmo/IfByjYrqjQWRoDHe1cHHIFhUn3lISIEkUJ84p2ZUxWPQ O1wws3tnObhCg8aqgNCLR78= X-Received: by 2002:a25:aea2:: with SMTP id b34-v6mr3760682ybj.443.1521907778948; Sat, 24 Mar 2018 09:09:38 -0700 (PDT) Received: from localhost ([2620:10d:c091:180::1:524]) by smtp.gmail.com with ESMTPSA id w5sm3883902ywl.38.2018.03.24.09.09.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Mar 2018 09:09:38 -0700 (PDT) From: Tejun Heo To: hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com Cc: guro@fb.com, riel@surriel.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, cgroups@vger.kernel.org, linux-mm@kvack.org, Tejun Heo Subject: [PATCH 3/3] mm: memcontrol: Remove lruvec_stat Date: Sat, 24 Mar 2018 09:09:01 -0700 Message-Id: <20180324160901.512135-4-tj@kernel.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180324160901.512135-1-tj@kernel.org> References: <20180324160901.512135-1-tj@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org lruvec_stat doesn't have any consumer. Remove it. Signed-off-by: Tejun Heo Cc: Johannes Weiner Cc: Michal Hocko Cc: Vladimir Davydov Cc: Roman Gushchin Cc: Rik van Riel Cc: Andrew Morton --- include/linux/memcontrol.h | 40 ---------------------------------------- mm/memcontrol.c | 36 ++---------------------------------- 2 files changed, 2 insertions(+), 74 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 0cf6d5a..85a8f00 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -103,19 +103,12 @@ struct mem_cgroup_reclaim_iter { unsigned int generation; }; -struct lruvec_stat { - long count[NR_VM_NODE_STAT_ITEMS]; -}; - /* * per-zone information in memory controller. */ struct mem_cgroup_per_node { struct lruvec lruvec; - struct lruvec_stat __percpu *lruvec_stat_cpu; - atomic_long_t lruvec_stat[NR_VM_NODE_STAT_ITEMS]; - unsigned long lru_zone_size[MAX_NR_ZONES][NR_LRU_LISTS]; struct mem_cgroup_reclaim_iter iter[DEF_PRIORITY + 1]; @@ -602,29 +595,10 @@ static inline void mod_memcg_page_state(struct page *page, mod_memcg_state(page->mem_cgroup, idx, val); } -static inline unsigned long lruvec_page_state(struct lruvec *lruvec, - enum node_stat_item idx) -{ - struct mem_cgroup_per_node *pn; - long x; - - if (mem_cgroup_disabled()) - return node_page_state(lruvec_pgdat(lruvec), idx); - - pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec); - x = atomic_long_read(&pn->lruvec_stat[idx]); -#ifdef CONFIG_SMP - if (x < 0) - x = 0; -#endif - return x; -} - static inline void __mod_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, int val) { struct mem_cgroup_per_node *pn; - long x; /* Update node */ __mod_node_page_state(lruvec_pgdat(lruvec), idx, val); @@ -636,14 +610,6 @@ static inline void __mod_lruvec_state(struct lruvec *lruvec, /* Update memcg */ __mod_memcg_state(pn->memcg, idx, val); - - /* Update lruvec */ - x = val + __this_cpu_read(pn->lruvec_stat_cpu->count[idx]); - if (unlikely(abs(x) > MEMCG_CHARGE_BATCH)) { - atomic_long_add(x, &pn->lruvec_stat[idx]); - x = 0; - } - __this_cpu_write(pn->lruvec_stat_cpu->count[idx], x); } static inline void mod_lruvec_state(struct lruvec *lruvec, @@ -967,12 +933,6 @@ static inline void mod_memcg_page_state(struct page *page, { } -static inline unsigned long lruvec_page_state(struct lruvec *lruvec, - enum node_stat_item idx) -{ - return node_page_state(lruvec_pgdat(lruvec), idx); -} - static inline void __mod_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, int val) { diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 03d1b30..d5bf01d 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1815,30 +1815,7 @@ static void drain_all_stock(struct mem_cgroup *root_memcg) static int memcg_hotplug_cpu_dead(unsigned int cpu) { - struct memcg_stock_pcp *stock; - struct mem_cgroup *memcg; - - stock = &per_cpu(memcg_stock, cpu); - drain_stock(stock); - - for_each_mem_cgroup(memcg) { - int i; - - for (i = 0; i < NR_VM_NODE_STAT_ITEMS; i++) { - int nid; - long x; - - for_each_node(nid) { - struct mem_cgroup_per_node *pn; - - pn = mem_cgroup_nodeinfo(memcg, nid); - x = this_cpu_xchg(pn->lruvec_stat_cpu->count[i], 0); - if (x) - atomic_long_add(x, &pn->lruvec_stat[i]); - } - } - } - + drain_stock(&per_cpu(memcg_stock, cpu)); return 0; } @@ -4056,12 +4033,6 @@ static int alloc_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node) if (!pn) return 1; - pn->lruvec_stat_cpu = alloc_percpu(struct lruvec_stat); - if (!pn->lruvec_stat_cpu) { - kfree(pn); - return 1; - } - lruvec_init(&pn->lruvec); pn->usage_in_excess = 0; pn->on_tree = false; @@ -4073,10 +4044,7 @@ static int alloc_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node) static void free_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node) { - struct mem_cgroup_per_node *pn = memcg->nodeinfo[node]; - - free_percpu(pn->lruvec_stat_cpu); - kfree(pn); + kfree(memcg->nodeinfo[node]); } static void __mem_cgroup_free(struct mem_cgroup *memcg) -- 2.9.5