From patchwork Tue Oct 15 19:19:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 11191563 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D806B139A for ; Tue, 15 Oct 2019 19:19:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A521820872 for ; Tue, 15 Oct 2019 19:19:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="BWN/PPXg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A521820872 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=synopsys.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 650438E000A; Tue, 15 Oct 2019 15:19:34 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 34FD98E0009; Tue, 15 Oct 2019 15:19:34 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E20D08E0006; Tue, 15 Oct 2019 15:19:33 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0082.hostedemail.com [216.40.44.82]) by kanga.kvack.org (Postfix) with ESMTP id AB9428E0007 for ; Tue, 15 Oct 2019 15:19:33 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 4B5031803A543 for ; Tue, 15 Oct 2019 19:19:33 +0000 (UTC) X-FDA: 76046983026.13.chalk50_1927ffe379714 X-Spam-Summary: 2,0,0,15277b2689bb4c72,d41d8cd98f00b204,vineet.gupta1@synopsys.com,:arnd@arndb.de:will@kernel.org:aneesh.kumar@linux.ibm.com:akpm@linux-foundation.org:npiggin@gmail.com:peterz@infradead.org:kirill.shutemov@linux.intel.com:torvalds@linux-foundation.org::linux-snps-arc@lists.infradead.org:linux-kernel@vger.kernel.org:linux-arch@vger.kernel.org:vineet.gupta1@synopsys.com,RULES_HIT:41:355:379:541:800:960:966:968:973:988:989:1042:1260:1261:1311:1314:1345:1359:1431:1437:1515:1535:1542:1711:1730:1747:1777:1792:1801:1981:2194:2196:2199:2200:2393:2559:2562:3138:3139:3140:3141:3142:3353:3865:3867:3870:3871:4250:4321:4385:4605:5007:6119:6261:6653:7208:7903:8784:9113:9121:10004:11026:11473:11657:11658:11914:12043:12048:12114:12297:12438:12517:12519:12555:12895:13161:13229:13894:14096:14181:14394:14721:21080:21324:21451:21627:21772:30003:30012:30054:30070,0,RBL:198.182.47.102:@synopsys.com:.lbl8.mailshell.net-62.2.0.100 64.100.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netc heck:non X-HE-Tag: chalk50_1927ffe379714 X-Filterd-Recvd-Size: 5134 Received: from smtprelay-out1.synopsys.com (dc8-smtprelay2.synopsys.com [198.182.47.102]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Tue, 15 Oct 2019 19:19:32 +0000 (UTC) Received: from mailhost.synopsys.com (dc8-mailhost1.synopsys.com [10.13.135.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id E2469C0CD1; Tue, 15 Oct 2019 19:19:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1571167171; bh=RyhMIjR3Y4w5X+IYeglkWJ5DXU5dz7cL7fsVk7a3+1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BWN/PPXg23JjmO2741Fpd8QxE87HdsIEDLlX4KdT9dm8ECSSpANQhXocUQJh6AmYN r+lSGGM5QkoVqx2fbngVSTh14EaddCn4TqS7nOVFHKIesOb9vXp5QpjWcoroVn45gq UihJ8APqtu49L+oMn9Q9ImTnFQ5g5evu+cmQeZPj0oAkYDDkwN9jmqYlvic0vGWmhw +KcNPQtAYCqVfp8tVKqiv0utvVuwqe3QLouiSynu4k5+J7qfea7jK/+QaL4rooDPlN dKITFmOUy5ZuHRjvxQOoehYFlo+02EK/ZjrSyKlOhu+SAoRvnYVuzIA8St6UAQZcv1 KtdwJCmfTo/kQ== Received: from vineetg-Latitude-E7450.internal.synopsys.com (vineetg-latitude-e7450.internal.synopsys.com [10.10.161.61]) by mailhost.synopsys.com (Postfix) with ESMTP id 22622A006D; Tue, 15 Oct 2019 19:19:29 +0000 (UTC) From: Vineet Gupta To: Arnd Bergmann , Will Deacon , "Aneesh Kumar K . V" , Andrew Morton , Nick Piggin , Peter Zijlstra , "Kirill A . Shutemov" , Linus Torvalds Cc: linux-mm@kvack.org, linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Vineet Gupta Subject: [PATCH v2 1/5] ARC: mm: remove __ARCH_USE_5LEVEL_HACK Date: Tue, 15 Oct 2019 12:19:22 -0700 Message-Id: <20191015191926.9281-2-vgupta@synopsys.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191015191926.9281-1-vgupta@synopsys.com> References: <20191015191926.9281-1-vgupta@synopsys.com> MIME-Version: 1.0 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: Add the intermedivmlinux-A-baseline vmlinux-B-elide-ARCH_USE_5LEVEL_HACK This is a non-functional change anyways since ARC has software page walker with 2 lookup levels (pgd -> pte) There is slight code bloat due to pulling in needless p*d_free_tlb() macros which needs to be addressed seperately. | bloat-o-meter2 vmlinux-with-5LEVEL_HACK vmlinux-patched | add/remove: 0/0 grow/shrink: 2/0 up/down: 128/0 (128) | function old new delta | free_pgd_range 546 656 +110 | p4d_clear_bad 2 20 +18 | Total: Before=4137148, After=4137276, chg 0.000000% Cc: Kirill A. Shutemov Signed-off-by: Vineet Gupta --- arch/arc/include/asm/pgtable.h | 1 - arch/arc/mm/fault.c | 10 ++++++++-- arch/arc/mm/highmem.c | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h index 7addd0301c51..b917b596f7fb 100644 --- a/arch/arc/include/asm/pgtable.h +++ b/arch/arc/include/asm/pgtable.h @@ -33,7 +33,6 @@ #define _ASM_ARC_PGTABLE_H #include -#define __ARCH_USE_5LEVEL_HACK #include #include #include /* to propagate CONFIG_ARC_MMU_VER */ diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c index 3861543b66a0..fb86bc3e9b35 100644 --- a/arch/arc/mm/fault.c +++ b/arch/arc/mm/fault.c @@ -30,6 +30,7 @@ noinline static int handle_kernel_vaddr_fault(unsigned long address) * with the 'reference' page table. */ pgd_t *pgd, *pgd_k; + p4d_t *p4d, *p4d_k; pud_t *pud, *pud_k; pmd_t *pmd, *pmd_k; @@ -39,8 +40,13 @@ noinline static int handle_kernel_vaddr_fault(unsigned long address) if (!pgd_present(*pgd_k)) goto bad_area; - pud = pud_offset(pgd, address); - pud_k = pud_offset(pgd_k, address); + p4d = p4d_offset(pgd, address); + p4d_k = p4d_offset(pgd_k, address); + if (!p4d_present(*p4d_k)) + goto bad_area; + + pud = pud_offset(p4d, address); + pud_k = pud_offset(p4d_k, address); if (!pud_present(*pud_k)) goto bad_area; diff --git a/arch/arc/mm/highmem.c b/arch/arc/mm/highmem.c index a4856bfaedf3..fc8849e4f72e 100644 --- a/arch/arc/mm/highmem.c +++ b/arch/arc/mm/highmem.c @@ -111,12 +111,14 @@ EXPORT_SYMBOL(__kunmap_atomic); static noinline pte_t * __init alloc_kmap_pgtable(unsigned long kvaddr) { pgd_t *pgd_k; + p4d_t *p4d_k; pud_t *pud_k; pmd_t *pmd_k; pte_t *pte_k; pgd_k = pgd_offset_k(kvaddr); - pud_k = pud_offset(pgd_k, kvaddr); + p4d_k = p4d_offset(pgd_k, kvaddr); + pud_k = pud_offset(p4d_k, kvaddr); pmd_k = pmd_offset(pud_k, kvaddr); pte_k = (pte_t *)memblock_alloc_low(PAGE_SIZE, PAGE_SIZE); From patchwork Tue Oct 15 19:19:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 11191559 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D7A7F14E5 for ; Tue, 15 Oct 2019 19:19:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A53FD20872 for ; Tue, 15 Oct 2019 19:19:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="XDJW6c8g" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A53FD20872 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=synopsys.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 189878E0001; Tue, 15 Oct 2019 15:19:34 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E69FF8E000E; Tue, 15 Oct 2019 15:19:33 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B5C4C8E000D; Tue, 15 Oct 2019 15:19:33 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0178.hostedemail.com [216.40.44.178]) by kanga.kvack.org (Postfix) with ESMTP id 7F1D58E0008 for ; Tue, 15 Oct 2019 15:19:33 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id DF7F6181AEF10 for ; Tue, 15 Oct 2019 19:19:32 +0000 (UTC) X-FDA: 76046982984.11.hose03_19091bbee8a4c X-Spam-Summary: 2,0,0,f97f9e40d68e7adc,d41d8cd98f00b204,vineet.gupta1@synopsys.com,:arnd@arndb.de:will@kernel.org:aneesh.kumar@linux.ibm.com:akpm@linux-foundation.org:npiggin@gmail.com:peterz@infradead.org:kirill.shutemov@linux.intel.com:torvalds@linux-foundation.org::linux-snps-arc@lists.infradead.org:linux-kernel@vger.kernel.org:linux-arch@vger.kernel.org:vineet.gupta1@synopsys.com,RULES_HIT:41:355:379:541:800:960:965:966:968:973:988:989:1260:1261:1311:1314:1345:1359:1437:1515:1534:1542:1711:1730:1747:1777:1792:1801:1978:1981:2194:2196:2199:2200:2393:2559:2562:3138:3139:3140:3141:3142:3353:3865:3866:3870:3871:4250:4321:4385:4390:4395:4605:5007:6119:6261:6653:7208:7903:8784:9113:9121:10004:11026:11473:11658:11914:12043:12048:12296:12297:12438:12517:12519:12555:12679:12895:12986:13141:13180:13229:13230:13894:14181:14394:14721:21080:21451:21627:30003:30012:30054:30070,0,RBL:198.182.47.102:@synopsys.com:.lbl8.mailshell.net-62.14.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0. 5,0.5,Ne X-HE-Tag: hose03_19091bbee8a4c X-Filterd-Recvd-Size: 4933 Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [198.182.47.102]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Tue, 15 Oct 2019 19:19:31 +0000 (UTC) Received: from mailhost.synopsys.com (dc8-mailhost1.synopsys.com [10.13.135.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 06607C0CD6; Tue, 15 Oct 2019 19:19:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1571167170; bh=gJQnMGxonECDaNYPNrLwCIA62ffLbTLzgnjHo41zQDw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XDJW6c8glZg1PZKyzY2vkJMCet81A5IGMv4tqw9VLQicuO4zku/C5prsWa9YOcZp7 w0cLntq0d/potp3TNdqfrOMq0JKeooNxWojDzTQ7gsWSh0OozGvZ+BX05ewF9YORfH Lo3cai8cARNoYafhRcwrucsiJYCzkBoteCICqqTSox3d2gPLo4Bz6MDNcba4kRH5Rt nc9U1Wsp4ngZR+kFqgGy9UVk+dj0B8xR8X4BJFMulaNwK8UHVZKJJ5w5fFl+Xs7R1y 5jD+q8vQffwFJWenaRRJCrjNMYOjLpWt+2zS/sqO2wa+qEOFR7+8R2Kzo9OlktNHMD CM5xXw+cDDfBA== Received: from vineetg-Latitude-E7450.internal.synopsys.com (vineetg-latitude-e7450.internal.synopsys.com [10.10.161.61]) by mailhost.synopsys.com (Postfix) with ESMTP id 30375A0076; Tue, 15 Oct 2019 19:19:29 +0000 (UTC) From: Vineet Gupta To: Arnd Bergmann , Will Deacon , "Aneesh Kumar K . V" , Andrew Morton , Nick Piggin , Peter Zijlstra , "Kirill A . Shutemov" , Linus Torvalds Cc: linux-mm@kvack.org, linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Vineet Gupta Subject: [PATCH v2 2/5] asm-generic/tlb: stub out pud_free_tlb() if nopud ... Date: Tue, 15 Oct 2019 12:19:23 -0700 Message-Id: <20191015191926.9281-3-vgupta@synopsys.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191015191926.9281-1-vgupta@synopsys.com> References: <20191015191926.9281-1-vgupta@synopsys.com> MIME-Version: 1.0 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: ... independent of __ARCH_HAS_4LEVEL_HACK This came up when removing __ARCH_HAS_5LEVEL_HACK for ARC as code bloat from this routine which is not required in a 2-level paging setup Note: The primary change is alternate defines for pud_free_tlb() but while here removed empty stubs for __pud_free_tlb as, which is only called from pud_free_tlb(), being conditionalized already | bloat-o-meter2 vmlinux-B-elide-ARCH_USE_5LEVEL_HACK vmlinux-C-elide-pud_free_tlb | add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-104 (-104) | function old new delta | free_pgd_range 656 552 -104 | Total: Before=4137276, After=4137172, chg -1.000000% Signed-off-by: Vineet Gupta --- include/asm-generic/4level-fixup.h | 1 - include/asm-generic/pgtable-nopud.h | 2 +- include/asm-generic/tlb.h | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/include/asm-generic/4level-fixup.h b/include/asm-generic/4level-fixup.h index e3667c9a33a5..c86cf7cb4bba 100644 --- a/include/asm-generic/4level-fixup.h +++ b/include/asm-generic/4level-fixup.h @@ -30,7 +30,6 @@ #undef pud_free_tlb #define pud_free_tlb(tlb, x, addr) do { } while (0) #define pud_free(mm, x) do { } while (0) -#define __pud_free_tlb(tlb, x, addr) do { } while (0) #undef pud_addr_end #define pud_addr_end(addr, end) (end) diff --git a/include/asm-generic/pgtable-nopud.h b/include/asm-generic/pgtable-nopud.h index c77a1d301155..d3776cb494c0 100644 --- a/include/asm-generic/pgtable-nopud.h +++ b/include/asm-generic/pgtable-nopud.h @@ -59,7 +59,7 @@ static inline pud_t *pud_offset(p4d_t *p4d, unsigned long address) */ #define pud_alloc_one(mm, address) NULL #define pud_free(mm, x) do { } while (0) -#define __pud_free_tlb(tlb, x, a) do { } while (0) +#define pud_free_tlb(tlb, x, a) do { } while (0) #undef pud_addr_end #define pud_addr_end(addr, end) (end) diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index 04c0644006fd..5e0c2d01e656 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -584,7 +584,6 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm } while (0) #endif -#ifndef __ARCH_HAS_4LEVEL_HACK #ifndef pud_free_tlb #define pud_free_tlb(tlb, pudp, address) \ do { \ @@ -594,7 +593,6 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm __pud_free_tlb(tlb, pudp, address); \ } while (0) #endif -#endif #ifndef __ARCH_HAS_5LEVEL_HACK #ifndef p4d_free_tlb From patchwork Tue Oct 15 19:19:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 11191557 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E7C1D14E5 for ; Tue, 15 Oct 2019 19:19:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B52EC20872 for ; Tue, 15 Oct 2019 19:19:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="Z2FrSaF+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B52EC20872 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=synopsys.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EB6048E0007; Tue, 15 Oct 2019 15:19:33 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CE4D68E0009; Tue, 15 Oct 2019 15:19:33 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A729D8E0006; Tue, 15 Oct 2019 15:19:33 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0045.hostedemail.com [216.40.44.45]) by kanga.kvack.org (Postfix) with ESMTP id 733558E0007 for ; Tue, 15 Oct 2019 15:19:33 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 09C1082D433F for ; Tue, 15 Oct 2019 19:19:33 +0000 (UTC) X-FDA: 76046983026.08.war75_190ce7f58dc0c X-Spam-Summary: 2,0,0,8f8c8b9f6a1dc618,d41d8cd98f00b204,vineet.gupta1@synopsys.com,:arnd@arndb.de:will@kernel.org:aneesh.kumar@linux.ibm.com:akpm@linux-foundation.org:npiggin@gmail.com:peterz@infradead.org:kirill.shutemov@linux.intel.com:torvalds@linux-foundation.org::linux-snps-arc@lists.infradead.org:linux-kernel@vger.kernel.org:linux-arch@vger.kernel.org:vineet.gupta1@synopsys.com,RULES_HIT:41:355:379:541:800:960:965:966:968:973:988:989:1260:1261:1311:1314:1345:1359:1437:1515:1534:1542:1711:1730:1747:1777:1792:1801:1978:1981:2194:2196:2199:2200:2393:2559:2562:3138:3139:3140:3141:3142:3353:3866:3870:4250:4321:4385:4390:4395:4605:5007:6119:6261:6653:7208:7903:8784:9113:9121:10004:11026:11473:11658:11914:12043:12048:12296:12297:12438:12517:12519:12555:12895:13141:13230:13894:14181:14394:14721:21080:21451:21611:21627:30003:30012:30054,0,RBL:198.182.47.102:@synopsys.com:.lbl8.mailshell.net-62.2.0.100 64.100.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,M SF:not b X-HE-Tag: war75_190ce7f58dc0c X-Filterd-Recvd-Size: 4723 Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [198.182.47.102]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Tue, 15 Oct 2019 19:19:31 +0000 (UTC) Received: from mailhost.synopsys.com (dc8-mailhost1.synopsys.com [10.13.135.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id E1FD4C0C2C; Tue, 15 Oct 2019 19:19:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1571167170; bh=FwGil6fsR4diFmu7wiP5EEdJfatzpf6Ih9a6ruv//bg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z2FrSaF+FvK/6sZ1mrXBEkUj12QWVdGbO1TDNY/Tu5gDjQcKsBIQreEuTKuqpMm2l kK657CODi2afK5wyks5wt2aCqqMH9B5lAIyq3AJIw2eEQ99RyqweuOj5VccBNddPlP e01veCKaExhVS/FXqnAgByCCW6tlNQlglTXyUHX5XpXC84SKoNAwT5gIFd9LqKEEzs wL8lVlt3g7VyA+dM8Nh0cyDQ8vZvzl40IpSe5kzjNAuEnn8TG02VnAgF8JogwKgbjw qjiOFEMuFqlQpFyGDzia4UpX+v5fkCGdnm5d3Gvd9PiBmB2kHCv79Gu2xmdV01C/ie 24xbizNw/eJww== Received: from vineetg-Latitude-E7450.internal.synopsys.com (vineetg-latitude-e7450.internal.synopsys.com [10.10.161.61]) by mailhost.synopsys.com (Postfix) with ESMTP id 3DDC9A0078; Tue, 15 Oct 2019 19:19:29 +0000 (UTC) From: Vineet Gupta To: Arnd Bergmann , Will Deacon , "Aneesh Kumar K . V" , Andrew Morton , Nick Piggin , Peter Zijlstra , "Kirill A . Shutemov" , Linus Torvalds Cc: linux-mm@kvack.org, linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Vineet Gupta Subject: [PATCH v2 3/5] asm-generic/tlb: stub out p4d_free_tlb() if nop4d ... Date: Tue, 15 Oct 2019 12:19:24 -0700 Message-Id: <20191015191926.9281-4-vgupta@synopsys.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191015191926.9281-1-vgupta@synopsys.com> References: <20191015191926.9281-1-vgupta@synopsys.com> MIME-Version: 1.0 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: ... independent of __ARCH_HAS_5LEVEL_HACK This came up when removing __ARCH_HAS_5LEVEL_HACK for ARC as code bloat from this routine not required in a 2-level paging setup | bloat-o-meter2 vmlinux-C-elide-pud_free_tlb vmlinux-D-elide-p4d_free_tlb | add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-104 (-104) | function old new delta | free_pgd_range 552 422 -130 | Total: Before=4137172, After=4137042, chg -1.000000% Signed-off-by: Vineet Gupta --- include/asm-generic/5level-fixup.h | 1 - include/asm-generic/pgtable-nop4d.h | 2 +- include/asm-generic/tlb.h | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/include/asm-generic/5level-fixup.h b/include/asm-generic/5level-fixup.h index f6947da70d71..4c74b1c1d13b 100644 --- a/include/asm-generic/5level-fixup.h +++ b/include/asm-generic/5level-fixup.h @@ -51,7 +51,6 @@ static inline int p4d_present(p4d_t p4d) #undef p4d_free_tlb #define p4d_free_tlb(tlb, x, addr) do { } while (0) #define p4d_free(mm, x) do { } while (0) -#define __p4d_free_tlb(tlb, x, addr) do { } while (0) #undef p4d_addr_end #define p4d_addr_end(addr, end) (end) diff --git a/include/asm-generic/pgtable-nop4d.h b/include/asm-generic/pgtable-nop4d.h index aebab905e6cd..ce2cbb3c380f 100644 --- a/include/asm-generic/pgtable-nop4d.h +++ b/include/asm-generic/pgtable-nop4d.h @@ -50,7 +50,7 @@ static inline p4d_t *p4d_offset(pgd_t *pgd, unsigned long address) */ #define p4d_alloc_one(mm, address) NULL #define p4d_free(mm, x) do { } while (0) -#define __p4d_free_tlb(tlb, x, a) do { } while (0) +#define p4d_free_tlb(tlb, x, a) do { } while (0) #undef p4d_addr_end #define p4d_addr_end(addr, end) (end) diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index 5e0c2d01e656..05dddc17522b 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -594,7 +594,6 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm } while (0) #endif -#ifndef __ARCH_HAS_5LEVEL_HACK #ifndef p4d_free_tlb #define p4d_free_tlb(tlb, pudp, address) \ do { \ @@ -603,7 +602,6 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm __p4d_free_tlb(tlb, pudp, address); \ } while (0) #endif -#endif #endif /* CONFIG_MMU */ From patchwork Tue Oct 15 19:19:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 11191551 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9213714E5 for ; Tue, 15 Oct 2019 19:19:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5F2FE20854 for ; Tue, 15 Oct 2019 19:19:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="ZLSPKlF3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5F2FE20854 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=synopsys.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8EDD98E000B; Tue, 15 Oct 2019 15:19:33 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8784D8E0009; Tue, 15 Oct 2019 15:19:33 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 796098E0001; Tue, 15 Oct 2019 15:19:33 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0061.hostedemail.com [216.40.44.61]) by kanga.kvack.org (Postfix) with ESMTP id 52BFD8E0001 for ; Tue, 15 Oct 2019 15:19:33 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 033BF81C6 for ; Tue, 15 Oct 2019 19:19:33 +0000 (UTC) X-FDA: 76046983026.30.arm58_190e260c53345 X-Spam-Summary: 2,0,0,b4a98d45401ff109,d41d8cd98f00b204,vineet.gupta1@synopsys.com,:arnd@arndb.de:will@kernel.org:aneesh.kumar@linux.ibm.com:akpm@linux-foundation.org:npiggin@gmail.com:peterz@infradead.org:kirill.shutemov@linux.intel.com:torvalds@linux-foundation.org::linux-snps-arc@lists.infradead.org:linux-kernel@vger.kernel.org:linux-arch@vger.kernel.org:vineet.gupta1@synopsys.com,RULES_HIT:41:355:379:541:800:960:965:966:968:973:988:989:1260:1261:1311:1314:1345:1359:1437:1515:1534:1541:1711:1730:1747:1777:1792:1801:1978:1981:2194:2196:2199:2200:2393:2559:2562:3138:3139:3140:3141:3142:3352:3867:3870:3871:3874:4321:4385:4390:4395:4605:5007:6119:6261:6653:7208:7903:9113:9121:10004:11026:11658:11914:12043:12048:12296:12297:12517:12519:12555:12895:13069:13180:13229:13311:13357:13894:14096:14181:14384:14394:14581:14721:14777:21080:21451:21627:30003:30054,0,RBL:198.182.47.102:@synopsys.com:.lbl8.mailshell.net-62.14.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:n one,Doma X-HE-Tag: arm58_190e260c53345 X-Filterd-Recvd-Size: 3456 Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [198.182.47.102]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Tue, 15 Oct 2019 19:19:32 +0000 (UTC) Received: from mailhost.synopsys.com (dc8-mailhost1.synopsys.com [10.13.135.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id E20F5C0C5D; Tue, 15 Oct 2019 19:19:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1571167171; bh=TWgIAs403uWUV0wYIkngd1fRYFF87Lk2XfM7j9v1Avg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZLSPKlF3qsHIMHjNHX42zIg6rv8COLc9ZMJr/pGptVwfRJeIM+xBDW23wXMHCEVNa MdVqy65PrxiOrKXzvojFPr+6dSgi7PY8JlLojB2pZn2bFOb6oCxhtEbQUVqF255oJA LyUfQHIS/UX534EhoNu01ZjN18aS4TmWn5li0jWye2T8VA4ZwTJlRROsxbQfDb9s58 hEWVJ8J8flWGQEjC8bofa3jNnhZqJGTIgoWyod5l+i8d9VOTPKoCldNKBcDxvfvY5Z CKF2IMWPRfD+aRsAVJimGOKOR9SW11l0ER/m6tKSlMXtJQ0gkbkAfkwR6G79h/qHjg Eht8vPO+SeINQ== Received: from vineetg-Latitude-E7450.internal.synopsys.com (vineetg-latitude-e7450.internal.synopsys.com [10.10.161.61]) by mailhost.synopsys.com (Postfix) with ESMTP id 4C1A7A007D; Tue, 15 Oct 2019 19:19:29 +0000 (UTC) From: Vineet Gupta To: Arnd Bergmann , Will Deacon , "Aneesh Kumar K . V" , Andrew Morton , Nick Piggin , Peter Zijlstra , "Kirill A . Shutemov" , Linus Torvalds Cc: linux-mm@kvack.org, linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Vineet Gupta Subject: [PATCH v2 4/5] asm-generic/tlb: stub out pmd_free_tlb() if nopmd Date: Tue, 15 Oct 2019 12:19:25 -0700 Message-Id: <20191015191926.9281-5-vgupta@synopsys.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191015191926.9281-1-vgupta@synopsys.com> References: <20191015191926.9281-1-vgupta@synopsys.com> MIME-Version: 1.0 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: Note that pmd routine folding can be tricky as even in 2-level setup (where pmd is folded) most pmd routines refer to upper levels. This one can surely be elided however. | bloat-o-meter2 vmlinux-E-elide-p?d_clear_bad vmlinux-F-elide-pmd_free_tlb | add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-112 (-112) | function old new delta | free_pgd_range 422 310 -112 | Total: Before=4137042, After=4136930, chg -1.000000% Signed-off-by: Vineet Gupta --- include/asm-generic/pgtable-nopmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h index b85b8271a73d..0d9b28cba16d 100644 --- a/include/asm-generic/pgtable-nopmd.h +++ b/include/asm-generic/pgtable-nopmd.h @@ -60,7 +60,7 @@ static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address) static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) { } -#define __pmd_free_tlb(tlb, x, a) do { } while (0) +#define pmd_free_tlb(tlb, x, a) do { } while (0) #undef pmd_addr_end #define pmd_addr_end(addr, end) (end) From patchwork Tue Oct 15 19:19:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 11191561 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DBF55139A for ; Tue, 15 Oct 2019 19:19:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A7E6820872 for ; Tue, 15 Oct 2019 19:19:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="ZCwJap5y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A7E6820872 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=synopsys.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3D51E8E0006; Tue, 15 Oct 2019 15:19:34 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 122F68E000A; Tue, 15 Oct 2019 15:19:33 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D0AE38E0001; Tue, 15 Oct 2019 15:19:33 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0219.hostedemail.com [216.40.44.219]) by kanga.kvack.org (Postfix) with ESMTP id 8BB338E0001 for ; Tue, 15 Oct 2019 15:19:33 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 07BD481D0 for ; Tue, 15 Oct 2019 19:19:33 +0000 (UTC) X-FDA: 76046983026.18.cake90_1908fae923f1d X-Spam-Summary: 2,0,0,af54d3744c2c3600,d41d8cd98f00b204,vineet.gupta1@synopsys.com,:arnd@arndb.de:will@kernel.org:aneesh.kumar@linux.ibm.com:akpm@linux-foundation.org:npiggin@gmail.com:peterz@infradead.org:kirill.shutemov@linux.intel.com:torvalds@linux-foundation.org::linux-snps-arc@lists.infradead.org:linux-kernel@vger.kernel.org:linux-arch@vger.kernel.org:vineet.gupta1@synopsys.com,RULES_HIT:41:355:379:541:800:960:966:968:973:988:989:1260:1261:1311:1314:1345:1359:1437:1515:1534:1542:1711:1730:1747:1777:1792:1801:1978:1981:2194:2196:2199:2200:2393:2559:2562:3138:3139:3140:3141:3142:3353:3865:3867:3868:3870:3871:3874:4321:4385:4605:5007:6119:6261:6653:7208:7903:7974:9113:9121:10004:11026:11473:11658:11914:12043:12048:12114:12295:12297:12438:12517:12519:12555:12895:12986:13255:13894:14096:14181:14394:14721:21080:21451:21627:30012:30054,0,RBL:198.182.47.102:@synopsys.com:.lbl8.mailshell.net-62.14.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0 ,MSF:not X-HE-Tag: cake90_1908fae923f1d X-Filterd-Recvd-Size: 4368 Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [198.182.47.102]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Tue, 15 Oct 2019 19:19:31 +0000 (UTC) Received: from mailhost.synopsys.com (dc8-mailhost1.synopsys.com [10.13.135.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id ED46AC0C42; Tue, 15 Oct 2019 19:19:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1571167170; bh=HXvS8rDRQphESG7ffnx96mHp9U7LHEpSGqJLrluE2qs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZCwJap5yYG7J/fX2/MtXF9Lr8CqjfSDU0gQFHRsYSxx2FEWJi/iuZokzl3Uf30gzg SuPpnut/Hlh2Ch2hC3n+P5PJm3A2/zjEQfiX8bTSa8wmOU9PBcPMevWWfwpqKoFzf2 T8/tJZ0J6978lmKMd9VzQQ6JM3DJeuVkbene5eXKbP4VlpiDzaU50l01SsCeFcLvdK uH+nugVtEdJl9nJZd+ADQ1w4DXyIPY516+Nre5nCJS9f77LFY8tTeMC+JX7spZC6+a zzgv3/AFp9jYvvdqu55ATtDwmqvP/Ejt2i1bblheBZ9CHGqeYLnBJmR432v9efuxx6 s9uOiNKbDoBXQ== Received: from vineetg-Latitude-E7450.internal.synopsys.com (vineetg-latitude-e7450.internal.synopsys.com [10.10.161.61]) by mailhost.synopsys.com (Postfix) with ESMTP id 6329BA007E; Tue, 15 Oct 2019 19:19:29 +0000 (UTC) From: Vineet Gupta To: Arnd Bergmann , Will Deacon , "Aneesh Kumar K . V" , Andrew Morton , Nick Piggin , Peter Zijlstra , "Kirill A . Shutemov" , Linus Torvalds Cc: linux-mm@kvack.org, linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Vineet Gupta Subject: [PATCH v2 5/5] asm-generic/mm: stub out p{4,d}d_clear_bad() if __PAGETABLE_P{4,u}D_FOLDED Date: Tue, 15 Oct 2019 12:19:26 -0700 Message-Id: <20191015191926.9281-6-vgupta@synopsys.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191015191926.9281-1-vgupta@synopsys.com> References: <20191015191926.9281-1-vgupta@synopsys.com> MIME-Version: 1.0 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: This removes the code for 2 level paging as seen on ARC | bloat-o-meter2 vmlinux-D-elide-p4d_free_tlb vmlinux-E-elide-p?d_clear_bad | add/remove: 0/2 grow/shrink: 0/0 up/down: 0/-40 (-40) | function old new delta | pud_clear_bad 20 - -20 | p4d_clear_bad 20 - -20 | Total: Before=4136930, After=4136890, chg -1.000000% Signed-off-by: Vineet Gupta --- include/asm-generic/pgtable.h | 11 +++++++++++ mm/pgtable-generic.c | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 818691846c90..9cdcbc7c0b7b 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h @@ -558,8 +558,19 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot) * Do the tests inline, but report and clear the bad entry in mm/memory.c. */ void pgd_clear_bad(pgd_t *); + +#ifndef __PAGETABLE_P4D_FOLDED void p4d_clear_bad(p4d_t *); +#else +#define p4d_clear_bad(p4d) do { } while (0) +#endif + +#ifndef __PAGETABLE_PUD_FOLDED void pud_clear_bad(pud_t *); +#else +#define pud_clear_bad(p4d) do { } while (0) +#endif + void pmd_clear_bad(pmd_t *); static inline int pgd_none_or_clear_bad(pgd_t *pgd) diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c index 532c29276fce..a5edddc3846a 100644 --- a/mm/pgtable-generic.c +++ b/mm/pgtable-generic.c @@ -24,18 +24,26 @@ void pgd_clear_bad(pgd_t *pgd) pgd_clear(pgd); } +#ifndef __PAGETABLE_P4D_FOLDED void p4d_clear_bad(p4d_t *p4d) { p4d_ERROR(*p4d); p4d_clear(p4d); } +#endif +#ifndef __PAGETABLE_PUD_FOLDED void pud_clear_bad(pud_t *pud) { pud_ERROR(*pud); pud_clear(pud); } +#endif +/* + * Note that below can't be stubed out for nopmd case: + * pmd folding is special and typically pmd_* macros refet to upper level + */ void pmd_clear_bad(pmd_t *pmd) { pmd_ERROR(*pmd);