From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B590C433E4 for ; Wed, 15 Jul 2020 00:25:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 64AC320729 for ; Wed, 15 Jul 2020 00:25:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 64AC320729 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 121896B0003; Tue, 14 Jul 2020 20:25:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F94A6B0005; Tue, 14 Jul 2020 20:25:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 00F4F6B0006; Tue, 14 Jul 2020 20:25:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0108.hostedemail.com [216.40.44.108]) by kanga.kvack.org (Postfix) with ESMTP id E03086B0003 for ; Tue, 14 Jul 2020 20:25:31 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A73C4824999B for ; Wed, 15 Jul 2020 00:25:31 +0000 (UTC) X-FDA: 77038416462.11.cork25_45028e226ef5 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 7C34A180F8B86 for ; Wed, 15 Jul 2020 00:25:31 +0000 (UTC) X-HE-Tag: cork25_45028e226ef5 X-Filterd-Recvd-Size: 3481 Received: from huawei.com (szxga06-in.huawei.com [45.249.212.32]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Wed, 15 Jul 2020 00:25:30 +0000 (UTC) Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id A6F8B76DDE269CBDAEE3; Wed, 15 Jul 2020 08:25:27 +0800 (CST) Received: from [127.0.0.1] (10.174.179.238) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Wed, 15 Jul 2020 08:25:20 +0800 Subject: [PATCH v3] mm/percpu: fix 'defined but not used' warning To: Stephen Rothwell CC: , , , , , Roman Gushchin References: <20200714134101.80534-1-cuibixuan@huawei.com> <20200714225311.7aeffffd@canb.auug.org.au> <6f1a8c76-d6d7-1a2c-8b0b-26a4a31f1a19@huawei.com> <20200715062229.78591ff9@canb.auug.org.au> From: Bixuan Cui Message-ID: <6d41b939-a741-b521-a7a2-e7296ec16219@huawei.com> Date: Wed, 15 Jul 2020 08:25:19 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20200715062229.78591ff9@canb.auug.org.au> Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.238] X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 7C34A180F8B86 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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: Gcc report the following warning without CONFIG_MEMCG_KMEM: mm/percpu-internal.h:145:29: warning: 'pcpu_chunk_type' defined but not used [-Wunused-function] static enum pcpu_chunk_type pcpu_chunk_type(struct pcpu_chunk *chunk) ^~~~~~~~~~~~~~~ Add 'inline' to pcpu_chunk_type(),pcpu_is_memcg_chunk() and pcpu_chunk_list() to clear warning. Acked-by: Roman Gushchin Suggested-by: Stephen Rothwell Signed-off-by: Bixuan Cui --- mm/percpu-internal.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/percpu-internal.h b/mm/percpu-internal.h index 7983455842ff..18b768ac7dca 100644 --- a/mm/percpu-internal.h +++ b/mm/percpu-internal.h @@ -129,31 +129,31 @@ static inline int pcpu_chunk_map_bits(struct pcpu_chunk *chunk) } #ifdef CONFIG_MEMCG_KMEM -static enum pcpu_chunk_type pcpu_chunk_type(struct pcpu_chunk *chunk) +static inline enum pcpu_chunk_type pcpu_chunk_type(struct pcpu_chunk *chunk) { if (chunk->obj_cgroups) return PCPU_CHUNK_MEMCG; return PCPU_CHUNK_ROOT; } -static bool pcpu_is_memcg_chunk(enum pcpu_chunk_type chunk_type) +static inline bool pcpu_is_memcg_chunk(enum pcpu_chunk_type chunk_type) { return chunk_type == PCPU_CHUNK_MEMCG; } #else -static enum pcpu_chunk_type pcpu_chunk_type(struct pcpu_chunk *chunk) +static inline enum pcpu_chunk_type pcpu_chunk_type(struct pcpu_chunk *chunk) { return PCPU_CHUNK_ROOT; } -static bool pcpu_is_memcg_chunk(enum pcpu_chunk_type chunk_type) +static inline bool pcpu_is_memcg_chunk(enum pcpu_chunk_type chunk_type) { return false; } #endif -static struct list_head *pcpu_chunk_list(enum pcpu_chunk_type chunk_type) +static inline struct list_head *pcpu_chunk_list(enum pcpu_chunk_type chunk_type) { return &pcpu_chunk_lists[pcpu_nr_slots * pcpu_is_memcg_chunk(chunk_type)]; -- 2.17.1 .