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 E49F6C433E2 for ; Tue, 14 Jul 2020 13:46:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AAB5222510 for ; Tue, 14 Jul 2020 13:46:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AAB5222510 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 592266B0008; Tue, 14 Jul 2020 09:46:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 542796B000A; Tue, 14 Jul 2020 09:46:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 458F56B000C; Tue, 14 Jul 2020 09:46:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0033.hostedemail.com [216.40.44.33]) by kanga.kvack.org (Postfix) with ESMTP id 2FA666B0008 for ; Tue, 14 Jul 2020 09:46:31 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id E45488248047 for ; Tue, 14 Jul 2020 13:46:30 +0000 (UTC) X-FDA: 77036806140.28.place66_5308ac526ef1 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id B6AE76C13 for ; Tue, 14 Jul 2020 13:46:30 +0000 (UTC) X-HE-Tag: place66_5308ac526ef1 X-Filterd-Recvd-Size: 3432 Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Tue, 14 Jul 2020 13:46:29 +0000 (UTC) Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id EE6B7F7F624EA20164CF; Tue, 14 Jul 2020 21:46:26 +0800 (CST) Received: from [127.0.0.1] (10.174.179.238) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Tue, 14 Jul 2020 21:46:19 +0800 Subject: [PATCH v2] 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> From: Bixuan Cui Message-ID: <6f1a8c76-d6d7-1a2c-8b0b-26a4a31f1a19@huawei.com> Date: Tue, 14 Jul 2020 21:46:18 +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: <20200714225311.7aeffffd@canb.auug.org.au> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.238] X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: B6AE76C13 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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. Fixes: 26c99879ef01 ("mm: memcg/percpu: account percpu memory to memory cgroups") Signed-off-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 . .