linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Vincent Whitchurch <vincent.whitchurch@axis.com>,
	akpm@linux-foundation.org
Cc: osalvador@suse.de, mhocko@suse.com, pasha.tatashin@oracle.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Vincent Whitchurch <rabinv@axis.com>
Subject: Re: [PATCH] mm/sparse: Consistently do not zero memmap
Date: Wed, 30 Oct 2019 14:31:48 +0100	[thread overview]
Message-ID: <eb5dbddd-afb6-2473-fa76-a4fabf62fb89@redhat.com> (raw)
In-Reply-To: <20191030131122.8256-1-vincent.whitchurch@axis.com>

On 30.10.19 14:11, Vincent Whitchurch wrote:
> sparsemem without VMEMMAP has two allocation paths to allocate the
> memory needed for its memmap (done in sparse_mem_map_populate()).
> 
> In one allocation path (sparse_buffer_alloc() succeeds), the memory is
> not zeroed (since it was previously allocated with
> memblock_alloc_try_nid_raw()).
> 
> In the other allocation path (sparse_buffer_alloc() fails and
> sparse_mem_map_populate() falls back to memblock_alloc_try_nid()), the
> memory is zeroed.
> 
> AFAICS this difference does not appear to be on purpose.  If the code is
> supposed to work with non-initialized memory (__init_single_page() takes
> care of zeroing the struct pages which are actually used), we should
> consistently not zero the memory, to avoid masking bugs.

I agree

Acked-by: David Hildenbrand <david@redhat.com>

> 
> (I noticed this because on my ARM64 platform, with 1 GiB of memory the
>   first [and only] section is allocated from the zeroing path while with
>   2 GiB of memory the first 1 GiB section is allocated from the
>   non-zeroing path.)
> 
> Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
> ---
>   mm/sparse.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/sparse.c b/mm/sparse.c
> index f6891c1992b1..01e467adc219 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -458,7 +458,7 @@ struct page __init *__populate_section_memmap(unsigned long pfn,
>   	if (map)
>   		return map;
>   
> -	map = memblock_alloc_try_nid(size,
> +	map = memblock_alloc_try_nid_raw(size,
>   					  PAGE_SIZE, addr,
>   					  MEMBLOCK_ALLOC_ACCESSIBLE, nid);
>   	if (!map)
> 


-- 

Thanks,

David / dhildenb


  parent reply	other threads:[~2019-10-30 13:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-30 13:11 [PATCH] mm/sparse: Consistently do not zero memmap Vincent Whitchurch
2019-10-30 13:29 ` Michal Hocko
2019-10-30 14:02   ` Vincent Whitchurch
2019-10-30 14:12     ` Michal Hocko
2019-10-30 15:20       ` Pavel Tatashin
2019-10-30 15:31         ` Michal Hocko
2019-10-30 16:53           ` Pavel Tatashin
2019-10-30 17:31             ` Michal Hocko
2019-10-30 17:53               ` Pavel Tatashin
2019-10-30 18:01                 ` Michal Hocko
2019-10-30 18:23                   ` Pavel Tatashin
2019-10-31  7:25               ` Michal Hocko
2019-11-04 15:51                 ` Vincent Whitchurch
2019-11-05  8:43                   ` Michal Hocko
2019-11-15 23:55                     ` Andrew Morton
2019-11-18 11:28                       ` Michal Hocko
2019-10-30 13:31 ` David Hildenbrand [this message]
2019-10-30 13:38 ` Oscar Salvador
2019-10-30 15:21 ` Pavel Tatashin

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=eb5dbddd-afb6-2473-fa76-a4fabf62fb89@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=osalvador@suse.de \
    --cc=pasha.tatashin@oracle.com \
    --cc=rabinv@axis.com \
    --cc=vincent.whitchurch@axis.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;
as well as URLs for NNTP newsgroup(s).