From patchwork Mon Nov 15 18:59:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minchan Kim X-Patchwork-Id: 12620225 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71393C433EF for ; Mon, 15 Nov 2021 18:59:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 10E3163490 for ; Mon, 15 Nov 2021 18:59:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 10E3163490 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 882316B007B; Mon, 15 Nov 2021 13:59:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8615E6B007D; Mon, 15 Nov 2021 13:59:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 746A86B007E; Mon, 15 Nov 2021 13:59:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0213.hostedemail.com [216.40.44.213]) by kanga.kvack.org (Postfix) with ESMTP id 630246B007B for ; Mon, 15 Nov 2021 13:59:17 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 077DA180AE800 for ; Mon, 15 Nov 2021 18:59:17 +0000 (UTC) X-FDA: 78812077554.25.F2E010A Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by imf12.hostedemail.com (Postfix) with ESMTP id 2F38210003CC for ; Mon, 15 Nov 2021 18:59:16 +0000 (UTC) Received: by mail-pj1-f47.google.com with SMTP id gb13-20020a17090b060d00b001a674e2c4a8so626331pjb.4 for ; Mon, 15 Nov 2021 10:59:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DTS88cwpZRhNdCWVFjW1Uni2clTkdxNvhvbd9hJHl9Q=; b=da6IwRTzPyK70awYlgE0TSC0pnxwDgovl10PZugFz0nSCXgF/M3bHXusjkMbSiGEOd M9Vc0uIfWa8+0U6z9vMK8g06eYPzbzC7XiVg0yj1fCgkV7dMXea/QPn9ifrNbmtPJ/Qr pskfzpzHiUgzbxDmPaGh0JXTvkIpgtGeWDoT0Pp0A8XRirme8UnTUY6l8ZWyv/e9uS2i NXbMdwxPNjFvv7rOzAgv1L+GEGVRWsZg2eXmy1lrja8xt/qVp5dhku2yaG+NOx/Avcy4 gU7HQdbyybIhiFVC+AxFd3nXRotqAL8XMYBf1kTtNPC6IMnpRXFuL5+Lqr7rAFzODrbF 6+Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=DTS88cwpZRhNdCWVFjW1Uni2clTkdxNvhvbd9hJHl9Q=; b=fnskcX2WyzWBeoUvgZMxiW4QxLXgkRG2N77KOMthXK3+1uhGN0quxOcQphPGiPI8wt wyKm2cEWTp8IEWPzPwqX0N9N5UebneqTh/n/fLMsMERqBhJs5zF8ET7XuUX2sNMvYI/H GynZZ2iyDbNEMI93nrhqa7n7456vNvLMfY4cj/3Y3MBXomkXf/nEOJM5kz6FhwJ6hPkp 4CdyKeoH9YacX2UdhUtiZN6mAxofyyiPDoCNKhi01uaMS1fLSkTwE6DP/gq8zA126//x 9gZSmyjhQ5Io5p8ksb/MKFBse/f8qp4pAucIxJMAK6MSI8XH1tVjY8oQ/9LbjNa/GEEW y3aQ== X-Gm-Message-State: AOAM530KWOMwvoyTZ40H0fQGr83+VWEOZ6hq4WzJY8gFPi2Ps2RowhvU JB9JrmdTC+1seq7g5BqMta1ZntgkRaY= X-Google-Smtp-Source: ABdhPJzxfgbtwijPOncIcmJbV2TmcVA+OjV2UZGher8++1JTm+1DFMz36WOHauXa42QkDTYF1C6bUA== X-Received: by 2002:a17:902:8214:b0:142:61cf:7be with SMTP id x20-20020a170902821400b0014261cf07bemr38182979pln.0.1637002755117; Mon, 15 Nov 2021 10:59:15 -0800 (PST) Received: from bbox-1.mtv.corp.google.com ([2620:15c:211:201:7a54:8083:4365:b23d]) by smtp.gmail.com with ESMTPSA id c3sm11882941pfv.67.2021.11.15.10.59.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 10:59:14 -0800 (PST) From: Minchan Kim To: Andrew Morton Cc: Sergey Senozhatsky , linux-mm , LKML , Minchan Kim Subject: [PATCH v2 2/9] zsmalloc: rename zs_stat_type to class_stat_type Date: Mon, 15 Nov 2021 10:59:02 -0800 Message-Id: <20211115185909.3949505-3-minchan@kernel.org> X-Mailer: git-send-email 2.34.0.rc1.387.gb447b232ab-goog In-Reply-To: <20211115185909.3949505-1-minchan@kernel.org> References: <20211115185909.3949505-1-minchan@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 2F38210003CC X-Stat-Signature: 8uu73zejrkqzgakcxj7de3n61hnkeuzj Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=da6IwRTz; spf=pass (imf12.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.216.47 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) X-HE-Tag: 1637002756-565546 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The stat aims for class stat, not zspage so rename it. Signed-off-by: Minchan Kim --- mm/zsmalloc.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index f8c63bacd22e..c149ccf734ba 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -158,7 +158,7 @@ enum fullness_group { NR_ZS_FULLNESS, }; -enum zs_stat_type { +enum class_stat_type { CLASS_EMPTY, CLASS_ALMOST_EMPTY, CLASS_ALMOST_FULL, @@ -549,21 +549,21 @@ static int get_size_class_index(int size) return min_t(int, ZS_SIZE_CLASSES - 1, idx); } -/* type can be of enum type zs_stat_type or fullness_group */ -static inline void zs_stat_inc(struct size_class *class, +/* type can be of enum type class_stat_type or fullness_group */ +static inline void class_stat_inc(struct size_class *class, int type, unsigned long cnt) { class->stats.objs[type] += cnt; } -/* type can be of enum type zs_stat_type or fullness_group */ -static inline void zs_stat_dec(struct size_class *class, +/* type can be of enum type class_stat_type or fullness_group */ +static inline void class_stat_dec(struct size_class *class, int type, unsigned long cnt) { class->stats.objs[type] -= cnt; } -/* type can be of enum type zs_stat_type or fullness_group */ +/* type can be of enum type class_stat_type or fullness_group */ static inline unsigned long zs_stat_get(struct size_class *class, int type) { @@ -725,7 +725,7 @@ static void insert_zspage(struct size_class *class, { struct zspage *head; - zs_stat_inc(class, fullness, 1); + class_stat_inc(class, fullness, 1); head = list_first_entry_or_null(&class->fullness_list[fullness], struct zspage, list); /* @@ -750,7 +750,7 @@ static void remove_zspage(struct size_class *class, VM_BUG_ON(is_zspage_isolated(zspage)); list_del_init(&zspage->list); - zs_stat_dec(class, fullness, 1); + class_stat_dec(class, fullness, 1); } /* @@ -964,7 +964,7 @@ static void __free_zspage(struct zs_pool *pool, struct size_class *class, cache_free_zspage(pool, zspage); - zs_stat_dec(class, OBJ_ALLOCATED, class->objs_per_zspage); + class_stat_dec(class, OBJ_ALLOCATED, class->objs_per_zspage); atomic_long_sub(class->pages_per_zspage, &pool->pages_allocated); } @@ -1394,7 +1394,7 @@ static unsigned long obj_malloc(struct size_class *class, kunmap_atomic(vaddr); mod_zspage_inuse(zspage, 1); - zs_stat_inc(class, OBJ_USED, 1); + class_stat_inc(class, OBJ_USED, 1); obj = location_to_obj(m_page, obj); @@ -1458,7 +1458,7 @@ unsigned long zs_malloc(struct zs_pool *pool, size_t size, gfp_t gfp) record_obj(handle, obj); atomic_long_add(class->pages_per_zspage, &pool->pages_allocated); - zs_stat_inc(class, OBJ_ALLOCATED, class->objs_per_zspage); + class_stat_inc(class, OBJ_ALLOCATED, class->objs_per_zspage); /* We completely set up zspage so mark them as movable */ SetZsPageMovable(pool, zspage); @@ -1489,7 +1489,7 @@ static void obj_free(struct size_class *class, unsigned long obj) kunmap_atomic(vaddr); set_freeobj(zspage, f_objidx); mod_zspage_inuse(zspage, -1); - zs_stat_dec(class, OBJ_USED, 1); + class_stat_dec(class, OBJ_USED, 1); } void zs_free(struct zs_pool *pool, unsigned long handle)