Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2278802pxj; Sun, 30 May 2021 20:38:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXmJpJs5xjHu49x7bxvrnsxRye1Ve1zjPO5ghkKcC8hYflxOOVsR1EF111ezKSQu7fzMSt X-Received: by 2002:a6b:610d:: with SMTP id v13mr4878818iob.171.1622432326286; Sun, 30 May 2021 20:38:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622432326; cv=none; d=google.com; s=arc-20160816; b=bP/2hSsxPwktxbZJ34u/fZgjvbHBYNuPjJeHOL+Syn1FZewDB8BMgCzNh45HxaDNMp EPXSFn67IN3TzPL5hpS3qUQgGgGTHfrkOWWLZmUzE5TRuIDHRukmUmGVz3pWCNzIzXOX yoUok0krPd3z2alyartwoci2QJIlLnCG8EFd3Q7qbZhbynrd4UwEOXPi6CwPXK92QE94 Wlos98165qMUwd5IEHbGtG+IyhkUbZO9ANTL2cdWRtmeUN37btjj+jVcuxi6h5bgy75h EfZJ07J6ALFOZr+Wvsc9RhOdPKxXmjp7Du9xJxff9FBAv0msbHdReCSEUDNFWotzfaN3 y+Ew== 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; bh=OQAQ52Y9DPOIQT4Ptj1ycSNjvwlfYBtosJO0mVHNj1g=; b=lI5hbWF8zc6JhPexOxuk/JfTEKk1TgPUFE1tWoPucepAEBfOesL99zYmObMRc0+a6L sADlA+z0Ndgy6xY2wW8oD8hHSl2n4R285mbik/OBMB+/vwEQUy+5QFEglIMJiuABpcIf JkmlSJ8IMpNCuNI6C8Wx0BDisV5CdWSkrpRT2gTcLL3jzSW1fpUx+Bv7PKB3Mr0e4row x7vFGdvBFO00Iseq/7C8WUsecbg5+7hYXeHD14xAYzZSvAoZyak6hckm/AZHO684AlMY pKs2AzauDaQAsx1BBvOmFan1LZfoZi0NMF6TNyGXxfoQJV+WJrwIzYK2yta3HtzRjwIa GwIQ== ARC-Authentication-Results: i=1; mx.google.com; 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=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q13si11962076jap.33.2021.05.30.20.38.32; Sun, 30 May 2021 20:38:46 -0700 (PDT) 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; 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=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230100AbhEaDho (ORCPT + 99 others); Sun, 30 May 2021 23:37:44 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:2477 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230092AbhEaDhk (ORCPT ); Sun, 30 May 2021 23:37:40 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Ftgq36wDGz68yZ; Mon, 31 May 2021 11:33:03 +0800 (CST) Received: from dggpemm500004.china.huawei.com (7.185.36.219) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 31 May 2021 11:35:29 +0800 Received: from huawei.com (10.174.28.241) by dggpemm500004.china.huawei.com (7.185.36.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 31 May 2021 11:35:28 +0800 From: Bixuan Cui To: CC: , , , Bixuan Cui Subject: [PATCH -next v2] mm/mmap_lock: fix warning when CONFIG_TRACING is not defined Date: Mon, 31 May 2021 11:34:26 +0800 Message-ID: <20210531033426.74031-1-cuibixuan@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset="y" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.28.241] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500004.china.huawei.com (7.185.36.219) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix the warning: [-Wunused-function] mm/mmap_lock.c:157:20: warning: ‘get_mm_memcg_path’ defined but not used static const char *get_mm_memcg_path(struct mm_struct *mm) ^~~~~~~~~~~~~~~~~ Move get_mm_memcg_path() into #ifdef CONFIG_TRACING. Signed-off-by: Bixuan Cui Acked-by: Matthew Wilcox (Oracle) --- Changes in v2: Move get_mm_memcg_path() into #ifdef CONFIG_TRACING to fix the warning. mm/mmap_lock.c | 60 ++++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/mm/mmap_lock.c b/mm/mmap_lock.c index 03ee85c696ef..29e99af73144 100644 --- a/mm/mmap_lock.c +++ b/mm/mmap_lock.c @@ -142,6 +142,37 @@ static inline void put_memcg_path_buf(void) rcu_read_unlock(); } +#define TRACE_MMAP_LOCK_EVENT(type, mm, ...) \ + do { \ + const char *memcg_path; \ + preempt_disable(); \ + memcg_path = get_mm_memcg_path(mm); \ + trace_mmap_lock_##type(mm, \ + memcg_path != NULL ? memcg_path : "", \ + ##__VA_ARGS__); \ + if (likely(memcg_path != NULL)) \ + put_memcg_path_buf(); \ + preempt_enable(); \ + } while (0) + +#else /* !CONFIG_MEMCG */ + +int trace_mmap_lock_reg(void) +{ + return 0; +} + +void trace_mmap_lock_unreg(void) +{ +} + +#define TRACE_MMAP_LOCK_EVENT(type, mm, ...) \ + trace_mmap_lock_##type(mm, "", ##__VA_ARGS__) + +#endif /* CONFIG_MEMCG */ + +#ifdef CONFIG_TRACING +#ifdef CONFIG_MEMCG /* * Write the given mm_struct's memcg path to a percpu buffer, and return a * pointer to it. If the path cannot be determined, or no buffer was available @@ -175,37 +206,8 @@ static const char *get_mm_memcg_path(struct mm_struct *mm) out: return buf; } - -#define TRACE_MMAP_LOCK_EVENT(type, mm, ...) \ - do { \ - const char *memcg_path; \ - preempt_disable(); \ - memcg_path = get_mm_memcg_path(mm); \ - trace_mmap_lock_##type(mm, \ - memcg_path != NULL ? memcg_path : "", \ - ##__VA_ARGS__); \ - if (likely(memcg_path != NULL)) \ - put_memcg_path_buf(); \ - preempt_enable(); \ - } while (0) - -#else /* !CONFIG_MEMCG */ - -int trace_mmap_lock_reg(void) -{ - return 0; -} - -void trace_mmap_lock_unreg(void) -{ -} - -#define TRACE_MMAP_LOCK_EVENT(type, mm, ...) \ - trace_mmap_lock_##type(mm, "", ##__VA_ARGS__) - #endif /* CONFIG_MEMCG */ -#ifdef CONFIG_TRACING /* * Trace calls must be in a separate file, as otherwise there's a circular * dependency between linux/mmap_lock.h and trace/events/mmap_lock.h. -- 2.17.1