From patchwork Fri Oct 11 22:38:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 11186431 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 AC3F21575 for ; Fri, 11 Oct 2019 22:38:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 74FF921E6F for ; Fri, 11 Oct 2019 22:38:32 +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="A6IYKky8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74FF921E6F 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 9CF368E0001; Fri, 11 Oct 2019 18:38:31 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 97E5E6B0005; Fri, 11 Oct 2019 18:38:31 -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 8935D8E0001; Fri, 11 Oct 2019 18:38:31 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0134.hostedemail.com [216.40.44.134]) by kanga.kvack.org (Postfix) with ESMTP id 61F916B0003 for ; Fri, 11 Oct 2019 18:38:31 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id ED7AF181AC9AE for ; Fri, 11 Oct 2019 22:38:30 +0000 (UTC) X-FDA: 76032969180.08.brick87_4a36232de0b0d X-Spam-Summary: 2,0,0,b17f4a3cfbc0fb18,d41d8cd98f00b204,vineet.gupta1@synopsys.com,::linux-snps-arc@lists.infradead.org:linux-kernel@vger.kernel.org:linux-arch@vger.kernel.org: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:vineet.gupta1@synopsys.com,RULES_HIT:41:355:379:541:800:960:965:966:967:968:973:988:989:1260:1261:1263:1311:1314:1345:1359:1437:1515:1534:1542:1711:1730:1747:1777:1792:1801:1978:1981:2194:2196:2199:2200:2393:2525:2553:2559:2564:2682:2685:2692:2859:2898:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3865:3867:3868:3871:3872:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:4385:4390:4395:4605:5007:6117:6119:6261:6653:6742:7208:7875:7903:9025:9113:9121:9388:10004:10049:11026:11473:11658:11914:12043:12114:12295:12296:12297:12438:12517:12519:12555:12663:12776:12895:12986:13894:14106:14107:14181 :14721:1 X-HE-Tag: brick87_4a36232de0b0d X-Filterd-Recvd-Size: 4425 Received: from smtprelay-out1.synopsys.com (us03-smtprelay2.synopsys.com [149.117.87.133]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Fri, 11 Oct 2019 22:38:29 +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 80CEFC04A7; Fri, 11 Oct 2019 22:38:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1570833508; bh=E0P1RFAQD2Jf3g/rlBhYfNzwHdOeyXPqBOG/QZTvieM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A6IYKky8AdyUQ2QMjcIa2Uj+0XJjLeGbu6SH7JKVYKXMO6VLVywzRybptkCdTakG0 RDHIGz82Gfiajkpm4OCoDCz9X4UjVucNxnWyUWfz+tlwwNcSs1lfGeqyUqmRKJ3LFS tBwLL8Ru9EXyP/LBxMEtY6xAHed0FQeC59VOQqR9UUlgMl+BFNEPVVNI9SqOd5WLg0 jRQ+NyVOSXkfzBGVDgUyBMjNBT83MBQiNVhn3m6ENnXJdTZM9bDCep+rLXiai1UQkv UIYZzv9FSGgroLSDe0WPaDu0yK3CsCcEcUiNmvP+v0zljLl4HIl6q2weZjeDtxqIVu zIeuNs1TDq8ZA== 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 AC1E4A006B; Fri, 11 Oct 2019 22:38:21 +0000 (UTC) From: Vineet Gupta To: linux-mm@kvack.org Cc: linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Arnd Bergmann , Will Deacon , "Aneesh Kumar K . V" , Andrew Morton , Nick Piggin , Peter Zijlstra , "Kirill A . Shutemov" , Linus Torvalds , Vineet Gupta Subject: [RFC] asm-generic/tlb: stub out pmd_free_tlb() if __PAGETABLE_PMD_FOLDED Date: Fri, 11 Oct 2019 15:38:18 -0700 Message-Id: <20191011223818.7238-1-vgupta@synopsys.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191011121951.nxna6hruuskvdxod@box> References: <20191011121951.nxna6hruuskvdxod@box> 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 is inine with similar patches for nopud [1] and nop4d [2] cases. However I'm not really sure I understand clearly how the nopmd code is supposed to work (for a 2 tier paging system) - hence the RFC. Consider free_pmd_range() simplified/annotated below free_pmd_range ... pmd = pmd_offset(pud, addr); do { next = pmd_addr_end(addr, end); if (pmd_none_or_clear_bad(pmd)) => *pmd_bad()/pmd_clear_bad() [a]* continue; free_pte_range(tlb, pmd, addr); } while (pmd++, addr = next, addr != end); ... *pmd_free_tlb(tlb, pmd, start); => [b]* For ARC/nopmd case [a] is actually checking pgd and consequently pmd_clear_bad() can't be stubbed out for PMD_FOLDED case. However it seems case [b] can be stubbed out (hence this patch) along same lines as [1] and [2] | 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=4137002, After=4136890, chg -1.000000% [1] http://lists.infradead.org/pipermail/linux-snps-arc/2019-October/006266.html [2] http://lists.infradead.org/pipermail/linux-snps-arc/2019-October/006265.html Signed-off-by: Vineet Gupta --- include/asm-generic/tlb.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index f3dad87f4ecc..a1edad7d4170 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -574,6 +574,7 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm } while (0) #endif +#ifndef __PAGETABLE_PMD_FOLDED #ifndef pmd_free_tlb #define pmd_free_tlb(tlb, pmdp, address) \ do { \ @@ -583,6 +584,9 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm __pmd_free_tlb(tlb, pmdp, address); \ } while (0) #endif +#else +#define pmd_free_tlb(tlb, pmdp, address) do { } while (0) +#endif #ifndef __PAGETABLE_PUD_FOLDED #ifndef pud_free_tlb