From: Miaohe Lin <linmiaohe@huawei.com>
To: Guan Jing <guanjing6@huawei.com>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"djwong@kernel.org" <djwong@kernel.org>,
"dan.j.williams@intel.com" <dan.j.williams@intel.com>,
"ruansy.fnst@fujitsu.com" <ruansy.fnst@fujitsu.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"HORIGUCHI NAOYA(堀口 直也)" <naoya.horiguchi@nec.com>
Subject: Re: [PATCH -next] mm:fix build error of defined but not used
Date: Thu, 9 Jun 2022 15:38:58 +0800 [thread overview]
Message-ID: <5ae24232-91c0-99f5-48cc-beea1a16e426@huawei.com> (raw)
In-Reply-To: <20220609052420.GA1452839@hori.linux.bs1.fc.nec.co.jp>
On 2022/6/9 13:24, HORIGUCHI NAOYA(堀口 直也) wrote:
> On Thu, Jun 09, 2022 at 01:00:28PM +0800, Guan Jing wrote:
>> If CONFIG_HUGETLB_PAGE is not set and CONFIG_FS_DAX=y.
>> Use command "make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-" to
>> build, will fail:
>>
>> mm/memory-failure.c:568:13: error: ‘collect_procs_fsdax’ defined
>> but not used [-Werror=unused-function]
>> static void collect_procs_fsdax(struct page *page,
>> ^~~~~~~~~~~~~~~~~~~
>> cc1: all warnings being treated as errors
>> make[1]: *** [mm/memory-failure.o] Error 1
>> make[1]: *** Waiting for unfinished jobs....
>> make: *** [mm] Error 2
>> make: *** Waiting for unfinished jobs....
>>
>> so extending "#ifdef CONFIG_HUGETLB_PAG" to cover
>> collect_procs_fsdax() would be a simple resolution.
>
> Thank you for reporting. I think that collect_procs_fsdax() seems to not
> depend on hugetlb, so probably mf_dax_kill_procs() should be defined outside
> "#ifdef CONFIG_HUGETLB_PAGE"?
I tend to agree with Naoya. CONFIG_FS_DAX should not depend on CONFIG_HUGETLB_PAGE.
There are some functions, e.g. mf_generic_kill_procs, are under the CONFIG_HUGETLB_PAGE
unnecessarily. Those should be cleaned up altogether.
Thanks!
>
> Thanks,
> Naoya Horiguchi
>
>>
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Fixes: 143ac5cd7289 ("mm: introduce mf_dax_kill_procs() for fsdax case")
>> Signed-off-by: Guan Jing <guanjing6@huawei.com>
>> ---
>> mm/memory-failure.c | 56 ++++++++++++++++++++++-----------------------
>> 1 file changed, 28 insertions(+), 28 deletions(-)
>>
>> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
>> index 545f402c4890..952f117e4584 100644
>> --- a/mm/memory-failure.c
>> +++ b/mm/memory-failure.c
>> @@ -561,34 +561,6 @@ static void collect_procs_file(struct page *page, struct list_head *to_kill,
>> i_mmap_unlock_read(mapping);
>> }
>>
>> -#ifdef CONFIG_FS_DAX
>> -/*
>> - * Collect processes when the error hit a fsdax page.
>> - */
>> -static void collect_procs_fsdax(struct page *page,
>> - struct address_space *mapping, pgoff_t pgoff,
>> - struct list_head *to_kill)
>> -{
>> - struct vm_area_struct *vma;
>> - struct task_struct *tsk;
>> -
>> - i_mmap_lock_read(mapping);
>> - read_lock(&tasklist_lock);
>> - for_each_process(tsk) {
>> - struct task_struct *t = task_early_kill(tsk, true);
>> -
>> - if (!t)
>> - continue;
>> - vma_interval_tree_foreach(vma, &mapping->i_mmap, pgoff, pgoff) {
>> - if (vma->vm_mm == t->mm)
>> - add_to_kill(t, page, pgoff, vma, to_kill);
>> - }
>> - }
>> - read_unlock(&tasklist_lock);
>> - i_mmap_unlock_read(mapping);
>> -}
>> -#endif /* CONFIG_FS_DAX */
>> -
>> /*
>> * Collect the processes who have the corrupted page mapped to kill.
>> */
>> @@ -1540,6 +1512,34 @@ static int try_to_split_thp_page(struct page *page, const char *msg)
>> }
>>
>> #ifdef CONFIG_HUGETLB_PAGE
>> +#ifdef CONFIG_FS_DAX
>> +/*
>> + * Collect processes when the error hit a fsdax page.
>> + */
>> +static void collect_procs_fsdax(struct page *page,
>> + struct address_space *mapping, pgoff_t pgoff,
>> + struct list_head *to_kill)
>> +{
>> + struct vm_area_struct *vma;
>> + struct task_struct *tsk;
>> +
>> + i_mmap_lock_read(mapping);
>> + read_lock(&tasklist_lock);
>> + for_each_process(tsk) {
>> + struct task_struct *t = task_early_kill(tsk, true);
>> +
>> + if (!t)
>> + continue;
>> + vma_interval_tree_foreach(vma, &mapping->i_mmap, pgoff, pgoff) {
>> + if (vma->vm_mm == t->mm)
>> + add_to_kill(t, page, pgoff, vma, to_kill);
>> + }
>> + }
>> + read_unlock(&tasklist_lock);
>> + i_mmap_unlock_read(mapping);
>> +}
>> +#endif /* CONFIG_FS_DAX */
>> +
>> /*
>> * Called from hugetlb code with hugetlb_lock held.
>> *
>> --
>> 2.17.1
prev parent reply other threads:[~2022-06-09 7:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-09 5:00 Guan Jing
2022-06-09 5:24 ` HORIGUCHI NAOYA(堀口 直也)
2022-06-09 7:38 ` Miaohe Lin [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=5ae24232-91c0-99f5-48cc-beea1a16e426@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=djwong@kernel.org \
--cc=guanjing6@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=naoya.horiguchi@nec.com \
--cc=ruansy.fnst@fujitsu.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