linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Qian Cai <cai@lca.pw>
Cc: YueHaibing <yuehaibing@huawei.com>,
	akpm@linux-foundation.org, kirill.shutemov@linux.intel.com,
	vbabka@suse.cz, yang.shi@linux.alibaba.com, jannh@google.com,
	walken@google.com, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [PATCH] mm/mmap.c: silence variable 'new_start' set but not used
Date: Wed, 24 Jul 2019 16:17:10 +0200	[thread overview]
Message-ID: <20190724141710.GD5584@dhcp22.suse.cz> (raw)
In-Reply-To: <1563977465.11067.9.camel@lca.pw>

On Wed 24-07-19 10:11:05, Qian Cai wrote:
> On Wed, 2019-07-24 at 22:07 +0800, YueHaibing wrote:
> > 'new_start' is used in is_hugepage_only_range(),
> > which do nothing in some arch. gcc will warning:
> > 
> > mm/mmap.c: In function acct_stack_growth:
> > mm/mmap.c:2311:16: warning: variable new_start set but not used [-Wunused-but-
> > set-variable]
> 
> Nope. Convert them to inline instead.

Agreed. Obfuscating the code is not really something we want.

> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> > ---
> >  mm/mmap.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/mm/mmap.c b/mm/mmap.c
> > index e2dbed3..56c2a92 100644
> > --- a/mm/mmap.c
> > +++ b/mm/mmap.c
> > @@ -2308,7 +2308,7 @@ static int acct_stack_growth(struct vm_area_struct *vma,
> >  			     unsigned long size, unsigned long grow)
> >  {
> >  	struct mm_struct *mm = vma->vm_mm;
> > -	unsigned long new_start;
> > +	unsigned long __maybe_unused new_start;
> >  
> >  	/* address space limit tests */
> >  	if (!may_expand_vm(mm, vma->vm_flags, grow))

-- 
Michal Hocko
SUSE Labs


  reply	other threads:[~2019-07-24 14:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-24 14:07 YueHaibing
2019-07-24 14:11 ` Qian Cai
2019-07-24 14:17   ` Michal Hocko [this message]
2019-07-24 14:34 ` Kirill A. Shutemov
2019-07-25  9:30   ` Yuehaibing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190724141710.GD5584@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cai@lca.pw \
    --cc=jannh@google.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=vbabka@suse.cz \
    --cc=walken@google.com \
    --cc=yang.shi@linux.alibaba.com \
    --cc=yuehaibing@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox