From patchwork Fri Jul 10 01:56:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 11655387 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 CEDE414DD for ; Fri, 10 Jul 2020 01:57:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8D3DA20772 for ; Fri, 10 Jul 2020 01:57:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fMl48jJg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8D3DA20772 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B8B7C6B0002; Thu, 9 Jul 2020 21:57:08 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B15D96B0005; Thu, 9 Jul 2020 21:57:08 -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 A03936B0006; Thu, 9 Jul 2020 21:57:08 -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 882EA6B0002 for ; Thu, 9 Jul 2020 21:57:08 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 30DD62A87 for ; Fri, 10 Jul 2020 01:57:08 +0000 (UTC) X-FDA: 77020503336.28.ring35_2607a2926eca Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 0BEB46C3A for ; Fri, 10 Jul 2020 01:57:08 +0000 (UTC) X-Spam-Summary: 1,0,0,74cb792c33408ce9,d41d8cd98f00b204,npiggin@gmail.com,,RULES_HIT:41:355:379:541:973:988:989:1260:1311:1314:1345:1437:1515:1535:1544:1711:1730:1747:1777:1792:1801:1981:2194:2199:2393:2559:2562:3138:3139:3140:3141:3142:3355:3743:3865:3866:3867:3868:3871:3872:4118:4250:4362:4605:5007:6117:6119:6120:6261:6653:6691:7901:7903:9413:10004:11026:11658:11914:12043:12297:12438:12517:12519:12555:12679:12895:13053:13161:13229:13548:13894:14096:14181:14687:14721:21080:21433:21444:21451:21627:21666:30054:30090,0,RBL:209.85.210.194:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100;04y8yckqbzus8y1az95ekyqhkdywjyprqj8w7oawkh3hichdj3jbot96p17gcnw.ozdrin4xbkrxixh6nw71chsiixhtc387im5mmm81h1jeu4hwyzgknbq6xhw1cr6.o-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: ring35_2607a2926eca X-Filterd-Recvd-Size: 7487 Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Fri, 10 Jul 2020 01:57:07 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id j20so1837442pfe.5 for ; Thu, 09 Jul 2020 18:57:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QaZs4PvDZSCQHhg/idOxs9IRE6Ng3ZKb9zz1kieaNAk=; b=fMl48jJgG+BPVTWiIow0uenwROVafLRv/Pw6QEkzr+wXpEFWYCCtxcrQ49EcCzDH0d At9EdV+FbGfxN1VOcr79ARfZ/roxDFUMJkCpVxmEMokKKDA2KvlLcLlW/ffWvHymX3F2 S8ZbdTobn5MmrfRiDgkpyfP+HhTC5RlzmE3D4GRIJ+voEiQRevtPCPMHgVrisdkD8eP2 1jxxnQ21nD4j3VRBOitlqof8nHGFQaev2g82+kKkgb6CdXLxQQsI66/hvBCk9EbpX1og z2sy9mDLu0jTdygNIuOzks0ygls5Fp5EVO/7Mc5nrCQdLg9R4c0EYXLztb2rfja9cZPG Nkuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QaZs4PvDZSCQHhg/idOxs9IRE6Ng3ZKb9zz1kieaNAk=; b=jXfmY2isXFkvx3l6PISboMtqX1PYukll5JUNB9G4Q5XoHqRGpYg5OuxQb2l7JX9NfY BKS+N3+u51pGQpgKPAwegLwH08mKPaa4cG5WI2ApjePFK0lBwrxN9NtbdeC9khWEWskm YSI0Sa7utNSn5uQR/t+UBb7lgQYzZMpvAZpnGaQ/p9pW/8vIa/pA+zu5ml/v4waj09OU FEKyVmVxEzmkj9MOWXPErfm1se97fTNzAtjGRthwuSj+9uOUcgue2sbD8OZW0Em2ISli K8II5dzFTzDJAEX3ihdM+ZZvVSHjjruAmJFKPKNlXSGRgdr1dZQYWUDbZNhFUuQFzRJa NKbA== X-Gm-Message-State: AOAM530Q8DZUn/MBqpAKWNp8Wj6tyNKYLifWX7mvM+YF0r31qcw3zTCR G+FPh91rhn+gB+Z74bftfyQ= X-Google-Smtp-Source: ABdhPJy2ypc+nOy85os0fHi/ZXUU5Gjee6en+B7W1uV4HyKRPCGEGLSUXEPhaRxLWRbIu5BDykA4OA== X-Received: by 2002:a62:7b0d:: with SMTP id w13mr52660663pfc.160.1594346226667; Thu, 09 Jul 2020 18:57:06 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (220-245-19-62.static.tpgi.com.au. [220.245.19.62]) by smtp.gmail.com with ESMTPSA id 7sm3912834pgw.85.2020.07.09.18.57.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 18:57:06 -0700 (PDT) From: Nicholas Piggin To: linux-arch@vger.kernel.org Cc: Nicholas Piggin , x86@kernel.org, Mathieu Desnoyers , Arnd Bergmann , Peter Zijlstra , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, Anton Blanchard Subject: [RFC PATCH 0/7] mmu context cleanup, lazy tlb cleanup, Date: Fri, 10 Jul 2020 11:56:39 +1000 Message-Id: <20200710015646.2020871-1-npiggin@gmail.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-Rspamd-Queue-Id: 0BEB46C3A X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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 blew up a bit bigger than I thought, so I'd like to get some comments as to whether people agree with the direction it's going. The patches aren't cleanly split out by arch, but as it is now it's probably easier to get a quick overview of the changes at a glance anyway. So there's a few different things here. 1. Clean up and use asm-generic for no-op mmu context functions (so not just for nommu architectures). This should be functionally a no-op for everybody. This allows exit_lazy_tlb to easily be added. 2. Add exit_lazy_tlb and use it for x86, so this is x86 and membarrier specific changes. I _may_ have spotted a small membarrier / core sync bug here when adding exit_lazy_tlb. 3. Tidy up lazy tlb a little bit, have its own refcount function and allow it to be selected out. We can audit the nommu archs and deselect it for those. 4. Add a non-refcounting lazy mmu mode, to help scalability when the same mm is used for a lot of lazy mmu switching. Comments, questions on anything would be much appreciated. Thanks, Nick Nicholas Piggin (7): asm-generic: add generic MMU versions of mmu context functions arch: use asm-generic mmu context for no-op implementations mm: introduce exit_lazy_tlb x86: use exit_lazy_tlb rather than membarrier_mm_sync_core_before_usermode lazy tlb: introduce lazy mm refcount helper functions lazy tlb: allow lazy tlb mm switching to be configurable lazy tlb: shoot lazies, a non-refcounting lazy tlb option .../membarrier-sync-core/arch-support.txt | 6 +- arch/Kconfig | 23 +++++ arch/alpha/include/asm/mmu_context.h | 12 +-- arch/arc/include/asm/mmu_context.h | 16 ++-- arch/arm/include/asm/mmu_context.h | 26 +----- arch/arm64/include/asm/mmu_context.h | 7 +- arch/csky/include/asm/mmu_context.h | 8 +- arch/hexagon/include/asm/mmu_context.h | 33 ++------ arch/ia64/include/asm/mmu_context.h | 17 +--- arch/m68k/include/asm/mmu_context.h | 47 ++--------- arch/microblaze/include/asm/mmu_context.h | 2 +- arch/microblaze/include/asm/mmu_context_mm.h | 8 +- arch/microblaze/include/asm/processor.h | 3 - arch/mips/include/asm/mmu_context.h | 11 +-- arch/nds32/include/asm/mmu_context.h | 10 +-- arch/nios2/include/asm/mmu_context.h | 21 +---- arch/nios2/mm/mmu_context.c | 1 + arch/openrisc/include/asm/mmu_context.h | 8 +- arch/openrisc/mm/tlb.c | 2 + arch/parisc/include/asm/mmu_context.h | 12 +-- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/mmu_context.h | 22 ++--- arch/powerpc/kernel/smp.c | 2 +- arch/powerpc/mm/book3s64/radix_tlb.c | 4 +- arch/riscv/include/asm/mmu_context.h | 22 +---- arch/s390/include/asm/mmu_context.h | 9 +- arch/sh/include/asm/mmu_context.h | 7 +- arch/sh/include/asm/mmu_context_32.h | 9 -- arch/sparc/include/asm/mmu_context_32.h | 10 +-- arch/sparc/include/asm/mmu_context_64.h | 10 +-- arch/um/include/asm/mmu_context.h | 12 ++- arch/unicore32/include/asm/mmu_context.h | 24 +----- arch/x86/include/asm/mmu_context.h | 41 +++++++++ arch/x86/include/asm/sync_core.h | 28 ------- arch/xtensa/include/asm/mmu_context.h | 11 +-- arch/xtensa/include/asm/nommu_context.h | 26 +----- fs/exec.c | 5 +- include/asm-generic/mmu_context.h | 77 +++++++++++++---- include/asm-generic/nommu_context.h | 19 +++++ include/linux/sched/mm.h | 35 ++++---- include/linux/sync_core.h | 21 ----- kernel/cpu.c | 6 +- kernel/exit.c | 2 +- kernel/fork.c | 39 +++++++++ kernel/kthread.c | 12 ++- kernel/sched/core.c | 84 ++++++++++++------- kernel/sched/sched.h | 4 +- 47 files changed, 388 insertions(+), 427 deletions(-) delete mode 100644 arch/x86/include/asm/sync_core.h create mode 100644 include/asm-generic/nommu_context.h delete mode 100644 include/linux/sync_core.h