From: Anshuman Khandual <anshuman.khandual@arm.com>
To: "Arnd Bergmann" <arnd@arndb.de>, "Jérôme Glisse" <jglisse@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Ralph Campbell <rcampbell@nvidia.com>,
Stephen Rothwell <sfr@canb.auug.org.au>,
John Hubbard <jhubbard@nvidia.com>,
Dan Williams <dan.j.williams@intel.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/hmm: fix unused variable warnings
Date: Tue, 5 Mar 2019 17:48:07 +0530 [thread overview]
Message-ID: <be817f74-3441-47c1-6958-233d6e1172c4@arm.com> (raw)
In-Reply-To: <20190304200026.1140281-1-arnd@arndb.de>
On 03/05/2019 01:30 AM, Arnd Bergmann wrote:
> When CONFIG_HUGETLB_PAGE is disabled, the only use of the variable 'h'
> is compiled out, and the compiler thinks it is unnecessary:
>
> mm/hmm.c: In function 'hmm_range_snapshot':
> mm/hmm.c:1015:19: error: unused variable 'h' [-Werror=unused-variable]
> struct hstate *h = hstate_vma(vma);
After doing some Kconfig hacks like (ARCH_WANT_GENERAL_HUGETLB = n) on an
X86 system I got (HUGETLB_PAGE = n and HMM = y) config. But was unable to
hit the build error. Helper is_vm_hugetlb_page() seems to always return
false when HUGETLB_PAGE = n. Would not the compiler remove the entire code
block including the declaration for 'h' ?
#ifdef CONFIG_HUGETLB_PAGE
#include <linux/mm.h>
static inline bool is_vm_hugetlb_page(struct vm_area_struct *vma)
{
return !!(vma->vm_flags & VM_HUGETLB);
}
#else
static inline bool is_vm_hugetlb_page(struct vm_area_struct *vma)
{
return false;
}
#endif
next prev parent reply other threads:[~2019-03-05 12:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-04 20:00 [PATCH] mm/hmm: fix unused variable warnings Arnd Bergmann
2019-03-05 12:18 ` Anshuman Khandual [this message]
2019-03-06 10:26 ` Arnd Bergmann
2019-03-05 23:51 ` John Hubbard
2019-03-06 10:19 ` Arnd Bergmann
2019-03-06 18:34 ` John Hubbard
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=be817f74-3441-47c1-6958-233d6e1172c4@arm.com \
--to=anshuman.khandual@arm.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=dan.j.williams@intel.com \
--cc=jglisse@redhat.com \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rcampbell@nvidia.com \
--cc=sfr@canb.auug.org.au \
/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;
as well as URLs for NNTP newsgroup(s).