{"id":813999,"url":"http://patchwork.ozlabs.org/api/patches/813999/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170914223517.8242-8-pasha.tatashin@oracle.com/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/","list_archive_url":"https://lore.kernel.org/linuxppc-dev/","list_archive_url_format":"https://lore.kernel.org/linuxppc-dev/{}/","commit_url_format":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"},"msgid":"<20170914223517.8242-8-pasha.tatashin@oracle.com>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/20170914223517.8242-8-pasha.tatashin@oracle.com/","date":"2017-09-14T22:35:13","name":"[v8,07/11] sparc64: optimized struct page zeroing","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"e491f76dd863cd259f8b65b312e161bde30fdecc","submitter":{"id":71010,"url":"http://patchwork.ozlabs.org/api/people/71010/?format=json","name":"Pavel Tatashin","email":"pasha.tatashin@oracle.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170914223517.8242-8-pasha.tatashin@oracle.com/mbox/","series":[{"id":3173,"url":"http://patchwork.ozlabs.org/api/series/3173/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=3173","date":"2017-09-14T22:35:12","name":"complete deferred page initialization","version":8,"mbox":"http://patchwork.ozlabs.org/series/3173/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/813999/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/813999/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xtYfR3HjSz9sPs\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 15 Sep 2017 08:50:55 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xtYfR2KyNzDsNn\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 15 Sep 2017 08:50:55 +1000 (AEST)","from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xtYP23XXTzDrZ1\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri, 15 Sep 2017 08:39:18 +1000 (AEST)","from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71])\n\tby userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with\n\tESMTP id v8EMZatV030147\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256\n\tverify=OK); Thu, 14 Sep 2017 22:35:37 GMT","from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235])\n\tby userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id\n\tv8EMZaI4029453\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256\n\tverify=OK); Thu, 14 Sep 2017 22:35:36 GMT","from ubhmp0003.oracle.com (ubhmp0003.oracle.com [156.151.24.56])\n\tby aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v8EMZZSc024769; \n\tThu, 14 Sep 2017 22:35:35 GMT","from cmex.localdomain (/12.145.98.253)\n\tby default (Oracle Beehive Gateway v4.0)\n\twith ESMTP ; Thu, 14 Sep 2017 22:35:34 +0000"],"Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=oracle.com\n\t(client-ip=156.151.31.81; helo=userp1040.oracle.com;\n\tenvelope-from=pasha.tatashin@oracle.com; receiver=<UNKNOWN>)","From":"Pavel Tatashin <pasha.tatashin@oracle.com>","To":"linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org,\n\tlinux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org,\n\tlinux-s390@vger.kernel.org, linux-arm-kernel@lists.infradead.org,\n\tx86@kernel.org, kasan-dev@googlegroups.com, borntraeger@de.ibm.com,\n\theiko.carstens@de.ibm.com, davem@davemloft.net, willy@infradead.org, \n\tmhocko@kernel.org, ard.biesheuvel@linaro.org, will.deacon@arm.com,\n\tcatalin.marinas@arm.com, sam@ravnborg.org, mgorman@techsingularity.net,\n\tSteven.Sistare@oracle.com, daniel.m.jordan@oracle.com,\n\tbob.picco@oracle.com","Subject":"[PATCH v8 07/11] sparc64: optimized struct page zeroing","Date":"Thu, 14 Sep 2017 18:35:13 -0400","Message-Id":"<20170914223517.8242-8-pasha.tatashin@oracle.com>","X-Mailer":"git-send-email 2.14.1","In-Reply-To":"<20170914223517.8242-1-pasha.tatashin@oracle.com>","References":"<20170914223517.8242-1-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.24","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"},"content":"Add an optimized mm_zero_struct_page(), so struct page's are zeroed without\ncalling memset(). We do eight to ten regular stores based on the size of\nstruct page. Compiler optimizes out the conditions of switch() statement.\n\nSPARC-M6 with 15T of memory, single thread performance:\n\n                               BASE            FIX  OPTIMIZED_FIX\n        bootmem_init   28.440467985s   2.305674818s   2.305161615s\nfree_area_init_nodes  202.845901673s 225.343084508s 172.556506560s\n                      --------------------------------------------\nTotal                 231.286369658s 227.648759326s 174.861668175s\n\nBASE:  current linux\nFIX:   This patch series without \"optimized struct page zeroing\"\nOPTIMIZED_FIX: This patch series including the current patch.\n\nbootmem_init() is where memory for struct pages is zeroed during\nallocation. Note, about two seconds in this function is a fixed time: it\ndoes not increase as memory is increased.\n\nSigned-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>\nReviewed-by: Steven Sistare <steven.sistare@oracle.com>\nReviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>\nReviewed-by: Bob Picco <bob.picco@oracle.com>\nAcked-by: David S. Miller <davem@davemloft.net>\n---\n arch/sparc/include/asm/pgtable_64.h | 30 ++++++++++++++++++++++++++++++\n 1 file changed, 30 insertions(+)","diff":"diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h\nindex 4fefe3762083..8ed478abc630 100644\n--- a/arch/sparc/include/asm/pgtable_64.h\n+++ b/arch/sparc/include/asm/pgtable_64.h\n@@ -230,6 +230,36 @@ extern unsigned long _PAGE_ALL_SZ_BITS;\n extern struct page *mem_map_zero;\n #define ZERO_PAGE(vaddr)\t(mem_map_zero)\n \n+/* This macro must be updated when the size of struct page grows above 80\n+ * or reduces below 64.\n+ * The idea that compiler optimizes out switch() statement, and only\n+ * leaves clrx instructions\n+ */\n+#define\tmm_zero_struct_page(pp) do {\t\t\t\t\t\\\n+\tunsigned long *_pp = (void *)(pp);\t\t\t\t\\\n+\t\t\t\t\t\t\t\t\t\\\n+\t /* Check that struct page is either 64, 72, or 80 bytes */\t\\\n+\tBUILD_BUG_ON(sizeof(struct page) & 7);\t\t\t\t\\\n+\tBUILD_BUG_ON(sizeof(struct page) < 64);\t\t\t\t\\\n+\tBUILD_BUG_ON(sizeof(struct page) > 80);\t\t\t\t\\\n+\t\t\t\t\t\t\t\t\t\\\n+\tswitch (sizeof(struct page)) {\t\t\t\t\t\\\n+\tcase 80:\t\t\t\t\t\t\t\\\n+\t\t_pp[9] = 0;\t/* fallthrough */\t\t\t\\\n+\tcase 72:\t\t\t\t\t\t\t\\\n+\t\t_pp[8] = 0;\t/* fallthrough */\t\t\t\\\n+\tdefault:\t\t\t\t\t\t\t\\\n+\t\t_pp[7] = 0;\t\t\t\t\t\t\\\n+\t\t_pp[6] = 0;\t\t\t\t\t\t\\\n+\t\t_pp[5] = 0;\t\t\t\t\t\t\\\n+\t\t_pp[4] = 0;\t\t\t\t\t\t\\\n+\t\t_pp[3] = 0;\t\t\t\t\t\t\\\n+\t\t_pp[2] = 0;\t\t\t\t\t\t\\\n+\t\t_pp[1] = 0;\t\t\t\t\t\t\\\n+\t\t_pp[0] = 0;\t\t\t\t\t\t\\\n+\t}\t\t\t\t\t\t\t\t\\\n+} while (0)\n+\n /* PFNs are real physical page numbers.  However, mem_map only begins to record\n  * per-page information starting at pfn_base.  This is to handle systems where\n  * the first physical page in the machine is at some huge physical address,\n","prefixes":["v8","07/11"]}