From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BEA7CA9EC5 for ; Wed, 30 Oct 2019 13:31:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0449A20856 for ; Wed, 30 Oct 2019 13:31:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="g5RTAji1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0449A20856 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A4A7C6B0006; Wed, 30 Oct 2019 09:31:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D45F6B0007; Wed, 30 Oct 2019 09:31:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 89B386B0008; Wed, 30 Oct 2019 09:31:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0090.hostedemail.com [216.40.44.90]) by kanga.kvack.org (Postfix) with ESMTP id 6717F6B0006 for ; Wed, 30 Oct 2019 09:31:58 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 0FC1D6D92 for ; Wed, 30 Oct 2019 13:31:58 +0000 (UTC) X-FDA: 76100539116.22.tree16_2e23174bf9254 X-HE-Tag: tree16_2e23174bf9254 X-Filterd-Recvd-Size: 4235 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Wed, 30 Oct 2019 13:31:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572442316; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0I0c5NVjrpNTNl/OL6Kn2k5U+xaEtyxd7H2PQP2aE10=; b=g5RTAji1AUQ1k+BlH+SJkThAYHcwsUBYU9R37NCnhYC03ayxYa/wv+cHySxpj6Wrtwsrzy qeXSddJZ/VlGAzmvIbq2Po7Z10/4mfYOOuTtrh1cQaD9ea9TWamkGtteuL/Nr6Sleu4dIp X9/0l7GKkfjOVYpOum/ukDzYPq0My7A= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-276-GWuHbDW4NgOX4yFTEvnp5A-1; Wed, 30 Oct 2019 09:31:52 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 49F0B1800D55; Wed, 30 Oct 2019 13:31:51 +0000 (UTC) Received: from [10.36.116.222] (ovpn-116-222.ams2.redhat.com [10.36.116.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF8CE600C6; Wed, 30 Oct 2019 13:31:49 +0000 (UTC) Subject: Re: [PATCH] mm/sparse: Consistently do not zero memmap To: Vincent Whitchurch , 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 References: <20191030131122.8256-1-vincent.whitchurch@axis.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: Date: Wed, 30 Oct 2019 14:31:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20191030131122.8256-1-vincent.whitchurch@axis.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: GWuHbDW4NgOX4yFTEvnp5A-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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()). >=20 > In one allocation path (sparse_buffer_alloc() succeeds), the memory is > not zeroed (since it was previously allocated with > memblock_alloc_try_nid_raw()). >=20 > 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. >=20 > 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 >=20 > (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.) >=20 > Signed-off-by: Vincent Whitchurch > --- > mm/sparse.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > 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(unsigne= d long pfn, > =09if (map) > =09=09return map; > =20 > -=09map =3D memblock_alloc_try_nid(size, > +=09map =3D memblock_alloc_try_nid_raw(size, > =09=09=09=09=09 PAGE_SIZE, addr, > =09=09=09=09=09 MEMBLOCK_ALLOC_ACCESSIBLE, nid); > =09if (!map) >=20 --=20 Thanks, David / dhildenb