From: Guenter Roeck <linux@roeck-us.net>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, Stephen Rothwell <sfr@canb.auug.org.au>,
Robin Murphy <robin.murphy@arm.com>,
linux-kernel@vger.kernel.org,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: [PATCH -next] mm: Mark undo_dev_pagemap as __maybe_unused
Date: Tue, 2 Jul 2019 16:27:10 -0700 [thread overview]
Message-ID: <fa5137e4-478a-94b6-f0ae-28d48f53825e@roeck-us.net> (raw)
In-Reply-To: <20190702135418.ce51c988e88ca0d9546a2a11@linux-foundation.org>
On 7/2/19 1:54 PM, Andrew Morton wrote:
> On Tue, 2 Jul 2019 06:02:03 -0700 Guenter Roeck <linux@roeck-us.net> wrote:
>
>> Several mips builds generate the following build warning.
>>
>> mm/gup.c:1788:13: warning: 'undo_dev_pagemap' defined but not used
>>
>> The function is declared unconditionally but only called from behind
>> various ifdefs. Mark it __maybe_unused.
>>
>> ...
>>
>> --- a/mm/gup.c
>> +++ b/mm/gup.c
>> @@ -1785,7 +1785,8 @@ static inline pte_t gup_get_pte(pte_t *ptep)
>> }
>> #endif /* CONFIG_GUP_GET_PTE_LOW_HIGH */
>>
>> -static void undo_dev_pagemap(int *nr, int nr_start, struct page **pages)
>> +static void __maybe_unused undo_dev_pagemap(int *nr, int nr_start,
>> + struct page **pages)
>> {
>> while ((*nr) - nr_start) {
>> struct page *page = pages[--(*nr)];
>
> It's not our preferred way of doing it but yes, it would be a bit of a
> mess and a bit of a maintenance burden to get the ifdefs correct.
>
That is why I did it here. I understand that some maintainers don't like it,
and I noticed that it wasn't used elsewhere in the file, but it seemed to be
to most straightforward solution.
> And really, __maybe_unused isn't a bad way at all - it ensures that the
> function always gets build-tested and the compiler will remove it so we
> don't have to play the chase-the-ifdefs game.
>
Yes, it does have its advantages. I like it myself, but usually I would not
impose my opinion on others. In this case, anything else would have been
quite awkward and be prone to never-ending adjustments.
Thanks,
Guenter
prev parent reply other threads:[~2019-07-02 23:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-02 13:02 Guenter Roeck
2019-07-02 20:54 ` Andrew Morton
2019-07-02 23:27 ` Guenter Roeck [this message]
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=fa5137e4-478a-94b6-f0ae-28d48f53825e@roeck-us.net \
--to=linux@roeck-us.net \
--cc=akpm@linux-foundation.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=robin.murphy@arm.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