Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2928322pxj; Mon, 31 May 2021 15:03:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOyMlAATbniKHGF2Vg6lmPnsps2ySUzlvccH2O/59pHMzwjyujGGlHBPGCDHQbX1tqrSvr X-Received: by 2002:a17:906:f88b:: with SMTP id lg11mr11847825ejb.99.1622498625507; Mon, 31 May 2021 15:03:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622498625; cv=none; d=google.com; s=arc-20160816; b=jHTM9kQaVcyptGkvXEHG53bfNeBmgAs/OEQSY80V07R6bD08FWDWAZf/7H/ZYAXGVT koCDWP6Byp0U7/1elvpifC+u0fiZr03SNCPmOyFYcpgvzb45XVwJ5c4kj3/8gDxb9TQ4 MiOSg/tdYkA8++gvwRwHkYaCeP8MZPnsSOHU08pJHuZqWyWcfF58C4bVqHURa5QfOf5Q bt4nli2a5vCW0EmeCsL6rp/MRfF99O+hlxd8naIAdtQB7a9VJVHWFPxO9cuK0lFWN+db l5R8Q7886Wy4tia8DbByAXbC9ZzNhKG2+UE+sLKWK3W6GTLSPcEqP7C/5ViqpmGGRPii 5mtg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=5f9f/DtO3oGELfjiWebE7C5+Q0dM5UlpyIlBCn6a9MA=; b=LrLDNPn53klNyoZdOJdqm7bdjAQjMSeYRhucYs4wzeeTpWLH/okGZNxP0ivaja7ElR l/es0bJrk22rlD6PmX+MtCU9QYTyQ7jwVeoPoyZwo1eJaB54a3UzoNSUHqLWCZNMMZ2J JhE/4f98vOXmRgcojDzDwAId1W9A4+rXnwfqpIPUiLSbwyuRpWZPPmrsaKHIX7aBztuZ ozbIe+blyjFkqidZRE6r6TNjurou0sIzusQUMJAvP+0nankc/fITR6tnnfOL8q/ujF0K Pm2M1jTsf+pFFoOTY4Sn5rgHuoLV4vybaxaWaExtgQtZmbOmW+G56FkBvvPO9EF3wH6x aLqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=cvdQJ8ks; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e6si16805003edz.248.2021.05.31.15.03.22; Mon, 31 May 2021 15:03:45 -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; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=cvdQJ8ks; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231708AbhEaWEN (ORCPT + 99 others); Mon, 31 May 2021 18:04:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:48186 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231240AbhEaWEM (ORCPT ); Mon, 31 May 2021 18:04:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B6400610E7; Mon, 31 May 2021 22:02:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1622498551; bh=5ro2yd7/l1B26WTmAhjAsxZqQV6JJ76rUjTohSCFwiw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=cvdQJ8ksHOiV0MC7lG4BzkGwz6r/Qt/CJ/QvMJnimlDCH0Y/QIxQfiTxOKJHJRE0z R9Z8YKioc1/3UC6ibdrErMbni4ybzQ4hSt6bp4nXJHv7cAod3xcIkH1UNbIrAOEn55 VBy+hj917Gr7taSapmYi1E4Pqgb3aw7QV5UXktL4= Date: Mon, 31 May 2021 15:02:31 -0700 From: Andrew Morton To: Bixuan Cui Cc: , , , Mel Gorman Subject: Re: [PATCH -next v2] mm/mmap_lock: fix warning when CONFIG_TRACING is not defined Message-Id: <20210531150231.2e7bfdb063db06dfdfb81a26@linux-foundation.org> In-Reply-To: <20210531033426.74031-1-cuibixuan@huawei.com> References: <20210531033426.74031-1-cuibixuan@huawei.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 31 May 2021 11:34:26 +0800 Bixuan Cui wrote: > 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. Thanks, I queued this as a fix against Mel's "mm/mmap_lock: remove dead code for !CONFIG_TRACING configurations". > 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