{"id":806910,"url":"http://patchwork.ozlabs.org/api/1.0/patches/806910/?format=json","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/1.0/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/"},"msgid":"<1503972142-289376-8-git-send-email-pasha.tatashin@oracle.com>","date":"2017-08-29T02:02:18","name":"[v7,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/1.0/people/71010/?format=json","name":"Pavel Tatashin","email":"pasha.tatashin@oracle.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1503972142-289376-8-git-send-email-pasha.tatashin@oracle.com/mbox/","series":[{"id":286,"url":"http://patchwork.ozlabs.org/api/1.0/series/286/?format=json","date":"2017-08-29T02:02:21","name":"complete deferred page initialization","version":7,"mbox":"http://patchwork.ozlabs.org/series/286/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/806910/checks/","tags":{},"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 3xhBpr4G98z9s1h\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 12:07:16 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xhBpr3JYgzDqYl\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 12:07:16 +1000 (AEST)","from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69])\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 3xhBkg0BKqzDqKk\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tTue, 29 Aug 2017 12:03:38 +1000 (AEST)","from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71])\n\tby aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with\n\tESMTP id v7T22bJ2011059\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256\n\tverify=OK); Tue, 29 Aug 2017 02:02:37 GMT","from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72])\n\tby userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v7T22aeb007095\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256\n\tverify=OK); Tue, 29 Aug 2017 02:02:36 GMT","from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17])\n\tby userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id\n\tv7T22Zma011213; Tue, 29 Aug 2017 02:02:35 GMT","from ca-ldom-ol-build-1.us.oracle.com (/10.129.68.23)\n\tby default (Oracle Beehive Gateway v4.0)\n\twith ESMTP ; Mon, 28 Aug 2017 19:02:35 -0700"],"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 v7 07/11] sparc64: optimized struct page zeroing","Date":"Mon, 28 Aug 2017 22:02:18 -0400","Message-Id":"<1503972142-289376-8-git-send-email-pasha.tatashin@oracle.com>","X-Mailer":"git-send-email 1.7.1","In-Reply-To":"<1503972142-289376-1-git-send-email-pasha.tatashin@oracle.com>","References":"<1503972142-289376-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\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>\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 6fbd931f0570..cee5cc7ccc51 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":["v7","07/11"]}