Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3704082pxb; Tue, 17 Nov 2020 00:59:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJxjx/J4NIfFJalDOkEoUJ/ia8c39ue17m2WYA6PMKVVcbfYiJjPV2pUbq883iZFSvM072Pt X-Received: by 2002:a50:951e:: with SMTP id u30mr20940148eda.197.1605603596324; Tue, 17 Nov 2020 00:59:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605603596; cv=none; d=google.com; s=arc-20160816; b=vDdcHonc2wLKwqTDz4EkfQcxPdPon8RsR05s7TtdwYVYHB/WmoPukhZ30XHDFiRdRl Lpe1yDAP5pi0OO6qrayTRzx3rQJDBa+s3Kzd+gT5YA/ACa4iZerXubcHZwg7IpL0uE+8 YmMdNKTy+dfR00JB0UpJlv5pikkCxw3/J9fZJ7vKVpmWHfDFBODlqCIM53QUk6yBNnWN AwuB8cCLE8VjK1GASighZNRPdyyK0IB+wcM+wP+tyovjWGWwQNtyOOGyoLQvMLhzJtuh 8jgIb8WgIZMFNwa5DrFHedAi6SwDI8SXBm0+v7O1/O+v33MlA/P1MKLZjRqV5A0+UpAR K3YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=UKjsS4hTKC7rV0kYBscjT3mdhWgwWmoUJLccuKRuQEw=; b=oH1lRTs22VGBNA4ID1E6eiUeIcKuH2KpUOsYrNI7UhS4cP+nBLvIplG8bZHVxJ4vqQ jEf8cq+I2zyB9yaTgTJjfV8sXHPxRJENinIUpSgKyzX05uyJ+8p6y61h8uTXADD4jUSd QNNSUJFYxgLTER0XoDg7z5MNN+uXcS2vlResSnR8T04HXqfheRMTF+vtAKeNp1pMMXoR uuU6rYGExXyZ7QltMfSlEo31yXGvCD1KZIlUFnZPsyPVS3DtMwyC1MPKwnB9fNvusOGX s4S+Aq9r7NPpZc9nf8t9bR7Zd0c2IZ7qnX6nUjkA9Pjn8p+ASULi6zG6cFXyXEikJHNP 2w5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=bydidUtJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d12si601628ejj.498.2020.11.17.00.59.34; Tue, 17 Nov 2020 00:59:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=bydidUtJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726739AbgKQIzq (ORCPT + 99 others); Tue, 17 Nov 2020 03:55:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726561AbgKQIzq (ORCPT ); Tue, 17 Nov 2020 03:55:46 -0500 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF9DDC0613CF for ; Tue, 17 Nov 2020 00:55:44 -0800 (PST) Received: by mail-pf1-x442.google.com with SMTP id w6so16895930pfu.1 for ; Tue, 17 Nov 2020 00:55:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UKjsS4hTKC7rV0kYBscjT3mdhWgwWmoUJLccuKRuQEw=; b=bydidUtJr91S3sSScljC6vcJ0lib651urA+Tj5lAjUxiP75EFkLgI83zQXzDtsD7cz zkGSMnE/xutkXOicIdKijRS1oCDO8824jaNUScAYoy5SD+6m2E1TeAwe43jMJqnVA9Eq a5+LisK/Zryu5/0f64GX8jZpe2vC9GewxWnb6/GUtfH87qfDRl2g/DqYgjSo7bHm6580 mT00DrXEXtyrHqeZfQ4seDdpePhplntTbDbwuyszLj4rNuRpt3esDYfB/LbfI/1b9JQQ 3jRmNfVPYSRJsAmekwRJhakVvhAPrg7c7+OigEdtPfQp2G1d/1OYn5TAI/TVCEpYblt8 vlGA== 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:mime-version :content-transfer-encoding; bh=UKjsS4hTKC7rV0kYBscjT3mdhWgwWmoUJLccuKRuQEw=; b=dfuJmytpG34/UkqNWGYFMFlm0aZlg4ayNQuXu/lZzEm7SLwURMyPAYjA4CcNylmLuD 6DkpYTnl4jHVrbSqJRCBv86Q1naNtmDzeCyrZZB81S7JtcP7SyRhwfURhf17HkTk4GjD E637ZfzzvkvhGtqnisaLmfgu37RgwNmMz0TAMR7du99/gFNtqMbXGV5my7mFq6JwofXh LXKfRgBTrdXBDe1gC/59wcQRh2v3Aai7CnYd6RCEFhol1ZcqUE7G4oIVHOAyEXIcEjsl H4EhR79BygvC1Ue/xIxpCIURkLq2fvuFZJ6dXNKE+nfOaxb+nsD4RvaG02/Cz49fcooc XYew== X-Gm-Message-State: AOAM5311CMsO+4BudPbxnRSO+kNbBygeTbkKJgoPEcI9PA2uuK32ZGEn gEzgHTV5C5uMjDmKAobaT6kOkQ== X-Received: by 2002:aa7:8430:0:b029:18b:b3f5:ea4b with SMTP id q16-20020aa784300000b029018bb3f5ea4bmr17174835pfn.61.1605603343548; Tue, 17 Nov 2020 00:55:43 -0800 (PST) Received: from localhost.localdomain ([103.136.220.82]) by smtp.gmail.com with ESMTPSA id f19sm20372258pfa.82.2020.11.17.00.55.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Nov 2020 00:55:42 -0800 (PST) From: Muchun Song To: hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com, akpm@linux-foundation.org, shakeelb@google.com, guro@fb.com, laoar.shao@gmail.com, chris@chrisdown.name, christian.brauner@ubuntu.com, mingo@kernel.org, peterz@infradead.org, ebiederm@xmission.com, esyr@redhat.com, tglx@linutronix.de, surenb@google.com, areber@redhat.com, elver@google.com Cc: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Muchun Song Subject: [PATCH v2 RESEND] mm: memcg/slab: Rename *_lruvec_slab_state to *_lruvec_kmem_state Date: Tue, 17 Nov 2020 16:52:49 +0800 Message-Id: <20201117085249.24319-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The *_lruvec_slab_state is also suitable for pages allocated from buddy, not just for the slab objects. But the function name seems to tell us that only slab object is applicable. So we can rename the keyword of slab to kmem. Signed-off-by: Muchun Song Acked-by: Roman Gushchin Reviewed-by: Shakeel Butt --- changelog in v2: 1. Remove VM_BUG_ON suggested by Roman. include/linux/memcontrol.h | 18 +++++++++--------- kernel/fork.c | 2 +- mm/memcontrol.c | 2 +- mm/workingset.c | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index d7e339bf72dc..95807bf6be64 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -793,15 +793,15 @@ void __mod_memcg_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, int val); void __mod_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, int val); -void __mod_lruvec_slab_state(void *p, enum node_stat_item idx, int val); +void __mod_lruvec_kmem_state(void *p, enum node_stat_item idx, int val); -static inline void mod_lruvec_slab_state(void *p, enum node_stat_item idx, +static inline void mod_lruvec_kmem_state(void *p, enum node_stat_item idx, int val) { unsigned long flags; local_irq_save(flags); - __mod_lruvec_slab_state(p, idx, val); + __mod_lruvec_kmem_state(p, idx, val); local_irq_restore(flags); } @@ -1227,7 +1227,7 @@ static inline void mod_lruvec_page_state(struct page *page, mod_node_page_state(page_pgdat(page), idx, val); } -static inline void __mod_lruvec_slab_state(void *p, enum node_stat_item idx, +static inline void __mod_lruvec_kmem_state(void *p, enum node_stat_item idx, int val) { struct page *page = virt_to_head_page(p); @@ -1235,7 +1235,7 @@ static inline void __mod_lruvec_slab_state(void *p, enum node_stat_item idx, __mod_node_page_state(page_pgdat(page), idx, val); } -static inline void mod_lruvec_slab_state(void *p, enum node_stat_item idx, +static inline void mod_lruvec_kmem_state(void *p, enum node_stat_item idx, int val) { struct page *page = virt_to_head_page(p); @@ -1330,14 +1330,14 @@ static inline void __dec_lruvec_page_state(struct page *page, __mod_lruvec_page_state(page, idx, -1); } -static inline void __inc_lruvec_slab_state(void *p, enum node_stat_item idx) +static inline void __inc_lruvec_kmem_state(void *p, enum node_stat_item idx) { - __mod_lruvec_slab_state(p, idx, 1); + __mod_lruvec_kmem_state(p, idx, 1); } -static inline void __dec_lruvec_slab_state(void *p, enum node_stat_item idx) +static inline void __dec_lruvec_kmem_state(void *p, enum node_stat_item idx) { - __mod_lruvec_slab_state(p, idx, -1); + __mod_lruvec_kmem_state(p, idx, -1); } /* idx can be of type enum memcg_stat_item or node_stat_item */ diff --git a/kernel/fork.c b/kernel/fork.c index 4b328aecabb2..4fb0bbc3b041 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -384,7 +384,7 @@ static void account_kernel_stack(struct task_struct *tsk, int account) mod_lruvec_page_state(vm->pages[0], NR_KERNEL_STACK_KB, account * (THREAD_SIZE / 1024)); else - mod_lruvec_slab_state(stack, NR_KERNEL_STACK_KB, + mod_lruvec_kmem_state(stack, NR_KERNEL_STACK_KB, account * (THREAD_SIZE / 1024)); } diff --git a/mm/memcontrol.c b/mm/memcontrol.c index d9cdf899c6fc..2dde734df7d1 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -866,7 +866,7 @@ void __mod_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, __mod_memcg_lruvec_state(lruvec, idx, val); } -void __mod_lruvec_slab_state(void *p, enum node_stat_item idx, int val) +void __mod_lruvec_kmem_state(void *p, enum node_stat_item idx, int val) { pg_data_t *pgdat = page_pgdat(virt_to_page(p)); struct mem_cgroup *memcg; diff --git a/mm/workingset.c b/mm/workingset.c index 50d53f3699e4..2c707c92dd89 100644 --- a/mm/workingset.c +++ b/mm/workingset.c @@ -445,12 +445,12 @@ void workingset_update_node(struct xa_node *node) if (node->count && node->count == node->nr_values) { if (list_empty(&node->private_list)) { list_lru_add(&shadow_nodes, &node->private_list); - __inc_lruvec_slab_state(node, WORKINGSET_NODES); + __inc_lruvec_kmem_state(node, WORKINGSET_NODES); } } else { if (!list_empty(&node->private_list)) { list_lru_del(&shadow_nodes, &node->private_list); - __dec_lruvec_slab_state(node, WORKINGSET_NODES); + __dec_lruvec_kmem_state(node, WORKINGSET_NODES); } } } @@ -541,7 +541,7 @@ static enum lru_status shadow_lru_isolate(struct list_head *item, } list_lru_isolate(lru, item); - __dec_lruvec_slab_state(node, WORKINGSET_NODES); + __dec_lruvec_kmem_state(node, WORKINGSET_NODES); spin_unlock(lru_lock); @@ -564,7 +564,7 @@ static enum lru_status shadow_lru_isolate(struct list_head *item, * shadow entries we were tracking ... */ xas_store(&xas, NULL); - __inc_lruvec_slab_state(node, WORKINGSET_NODERECLAIM); + __inc_lruvec_kmem_state(node, WORKINGSET_NODERECLAIM); out_invalid: xa_unlock_irq(&mapping->i_pages); -- 2.20.1