From patchwork Fri May 5 17:03:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Tatashin X-Patchwork-Id: 759100 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wKJFZ16P0z9s7r for ; Sat, 6 May 2017 03:06:10 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3wKJFY6FbQzDqJ2 for ; Sat, 6 May 2017 03:06:09 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3wKJBb244nzDqCt for ; Sat, 6 May 2017 03:03:35 +1000 (AEST) Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v45H3PhW027090 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 5 May 2017 17:03:26 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v45H3PHC011224 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 5 May 2017 17:03:25 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v45H3PDX015626; Fri, 5 May 2017 17:03:25 GMT Received: from ca-ldom103.us.oracle.com (/10.129.68.23) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 05 May 2017 10:03:25 -0700 From: Pavel Tatashin To: linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, borntraeger@de.ibm.com, heiko.carstens@de.ibm.com, davem@davemloft.net Subject: [v3 5/9] mm: zero struct pages during initialization Date: Fri, 5 May 2017 13:03:12 -0400 Message-Id: <1494003796-748672-6-git-send-email-pasha.tatashin@oracle.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1494003796-748672-1-git-send-email-pasha.tatashin@oracle.com> References: <1494003796-748672-1-git-send-email-pasha.tatashin@oracle.com> X-Source-IP: userv0021.oracle.com [156.151.31.71] X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" When deferred struct page initialization is enabled, do not expect that the memory that was allocated for struct pages was zeroed by the allocator. Zero it when "struct pages" are initialized. Also, a defined boolean VMEMMAP_ZERO is provided to tell platforms whether they should zero memory or can deffer it. Signed-off-by: Pavel Tatashin Reviewed-by: Shannon Nelson --- include/linux/mm.h | 9 +++++++++ mm/page_alloc.c | 3 +++ 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 4375015..1c481fc 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2419,6 +2419,15 @@ int vmemmap_populate_basepages(unsigned long start, unsigned long end, #ifdef CONFIG_MEMORY_HOTPLUG void vmemmap_free(unsigned long start, unsigned long end); #endif +/* + * Don't zero "struct page"es during early boot, and zero only when they are + * initialized in parallel. + */ +#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT +#define VMEMMAP_ZERO false +#else +#define VMEMMAP_ZERO true +#endif void register_page_bootmem_memmap(unsigned long section_nr, struct page *map, unsigned long size); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 2c25de4..e736c6a 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1159,6 +1159,9 @@ static void free_one_page(struct zone *zone, static void __meminit __init_single_page(struct page *page, unsigned long pfn, unsigned long zone, int nid) { +#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT + memset(page, 0, sizeof(struct page)); +#endif set_page_links(page, zone, nid, pfn); init_page_count(page); page_mapcount_reset(page);