linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Oscar Salvador <osalvador@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	linux-s390@vger.kernel.org,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>
Subject: Re: [PATCH] mm/sparse.c: mark populate_section_memmap as __meminit
Date: Wed, 30 Oct 2019 16:07:09 +0100	[thread overview]
Message-ID: <EA4FBE3A-13D4-4ECF-A2FC-64CBACEA9A87@linux.ibm.com> (raw)
In-Reply-To: <20191030081359.GA11931@linux>

> Am 30.10.2019 um 09:14 schrieb Oscar Salvador <osalvador@suse.de>:
> 
> On Mon, Oct 28, 2019 at 05:55:49PM +0100, Ilya Leoshkevich wrote:
>> Building the kernel on s390 with -Og produces the following warning:
>> 
>> WARNING: vmlinux.o(.text+0x28dabe): Section mismatch in reference from the function populate_section_memmap() to the function .meminit.text:__populate_section_memmap()
>> The function populate_section_memmap() references
>> the function __meminit __populate_section_memmap().
>> This is often because populate_section_memmap lacks a __meminit
>> annotation or the annotation of __populate_section_memmap is wrong.
>> 
>> While -Og is not supported, in theory this might still happen with
>> another compiler or on another architecture. So fix this by using the
>> correct section annotations.
>> 
>> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
>> ---
>> mm/sparse.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>> 
>> diff --git a/mm/sparse.c b/mm/sparse.c
>> index f6891c1992b1..0f1f36443a96 100644
>> --- a/mm/sparse.c
>> +++ b/mm/sparse.c
>> @@ -448,7 +448,7 @@ static unsigned long __init section_map_size(void)
>> 	return PAGE_ALIGN(sizeof(struct page) * PAGES_PER_SECTION);
>> }
>> 
>> -struct page __init *__populate_section_memmap(unsigned long pfn,
>> +struct page __meminit *__populate_section_memmap(unsigned long pfn,
>> 		unsigned long nr_pages, int nid, struct vmem_altmap *altmap)
>> {
>> 	unsigned long size = section_map_size();
>> @@ -647,7 +647,7 @@ void offline_mem_sections(unsigned long start_pfn, unsigned long end_pfn)
>> #endif
>> 
>> #ifdef CONFIG_SPARSEMEM_VMEMMAP
>> -static struct page *populate_section_memmap(unsigned long pfn,
>> +static struct page * __meminit populate_section_memmap(unsigned long pfn,
>> 		unsigned long nr_pages, int nid, struct vmem_altmap *altmap)
>> {
>> 	return __populate_section_memmap(pfn, nr_pages, nid, altmap);
>> @@ -669,7 +669,7 @@ static void free_map_bootmem(struct page *memmap)
>> 	vmemmap_free(start, end, NULL);
>> }
>> #else
>> -struct page *populate_section_memmap(unsigned long pfn,
>> +struct page * __meminit populate_section_memmap(unsigned long pfn,
>> 		unsigned long nr_pages, int nid, struct vmem_altmap *altmap)
>> {
>> 	struct page *page, *ret;
> 
> I did not really check deep, but I __think__ you only need to add __meminit in
> populate_section_memmap functions.
> 
> __populate_section_memmap for SPARSE case is only used at init phase.

You are absolutely right, and this is what must be causing the problem
on sh4.

With CONFIG_SPARSEMEM_VMEMMAP, populate_section_memmap calls
__populate_section_memmap version from mm/sparse-vmemmap.c, which is
already marked as __meminit.

Without CONFIG_SPARSEMEM_VMEMMAP, populate_section_memmap does not
call __populate_section_memmap (which is then defined in mm/sparse.c).
Like you said, in this case the latter is called only during the init
phase (by sparse_init_nid), so it should keep the __init annotation.

I think it still makes sense to mark the !CONFIG_SPARSEMEM_VMEMMAP
version of populate_section_memmap as __meminit, since it's only called
from __meminit section_activate.

I will send a v2.


      reply	other threads:[~2019-10-30 15:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28 16:55 Ilya Leoshkevich
2019-10-29 11:09 ` David Hildenbrand
2019-10-30  6:42 ` kbuild test robot
2019-10-30  8:14 ` Oscar Salvador
2019-10-30 15:07   ` Ilya Leoshkevich [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=EA4FBE3A-13D4-4ECF-A2FC-64CBACEA9A87@linux.ibm.com \
    --to=iii@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=gor@linux.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=osalvador@suse.de \
    /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