From patchwork Wed Jan 18 08:00:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 13105805 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F30AC004D4 for ; Wed, 18 Jan 2023 08:00:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 923EC6B0074; Wed, 18 Jan 2023 03:00:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8D4016B0075; Wed, 18 Jan 2023 03:00:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7C3456B0078; Wed, 18 Jan 2023 03:00:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 6E4396B0074 for ; Wed, 18 Jan 2023 03:00:25 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 4108DC0303 for ; Wed, 18 Jan 2023 08:00:25 +0000 (UTC) X-FDA: 80367172410.04.A9D5602 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by imf08.hostedemail.com (Postfix) with ESMTP id AD6DC16001B for ; Wed, 18 Jan 2023 08:00:23 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=M10VwdDx; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf08.hostedemail.com: domain of npiggin@gmail.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=npiggin@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674028823; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=/c+UEu1/betIkwkWD66Ls4sEbWMR7MDl6kLYjMdOV68=; b=FkOF178G6xpIbbMKHiD2PaVvgyGwMoAWfmcYXC289flZWc98q4m4tpZP1D4eGLtuFJqHqA y7YCC1bAWbu0sgk/2gBOL74XmmBbRbcFH8+Rj33tjOf/hqbwEOBZGMkhULy9Og5siHeRt7 MrAd/iwJk4muT/PQ9DooZcchZwFTzJc= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=M10VwdDx; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf08.hostedemail.com: domain of npiggin@gmail.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=npiggin@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674028823; a=rsa-sha256; cv=none; b=LjfmrLZJTT6v5GDWA54sD9n5bSK47QDaT2XgPe/GtJPab5WFcaZEfX+CDhWgknXm7Dha/T qlU9lN/rF+UJcpDabuXqXz/Ckl6cptxRqUnAClVMwLQi+8F4Q2yI+H+jHxXwJ/qMdSu+ru mYtVz6bBscm4DJCROwdGFidnRvjHXeE= Received: by mail-pl1-f182.google.com with SMTP id z13so8300682plg.6 for ; Wed, 18 Jan 2023 00:00:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/c+UEu1/betIkwkWD66Ls4sEbWMR7MDl6kLYjMdOV68=; b=M10VwdDxiyjR3MkXCt1kIacLOaoFMDhyYGfoN3hv49C7DrdZOq1oe294t353LIQwcM l2KY2y2Zc4rxy5Mg3Z728Ym4bWH5diPOXyzsHtMT83RGbaSgYIqIREU23EJGzgLI1Ov6 N1OYK+iD4zTKGEGWh8IvWX2z6TOFlokAQYUq5hjG8xyZl4+f6z+DDXxK8Du9/vS/4tMg wmBdI3sEpKLtpt5MH8U5Bw1lHZF+5fxMmP69GiPiq3w4/kNF6+Kq0OCMnvfKaVIaj14M YoEav7fySPBIT0/7ILHa3NgDqx4uXGWF29GGOBUyZgpgm1r8bCwYgVI+XC5Nwmh6iP6r LC3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/c+UEu1/betIkwkWD66Ls4sEbWMR7MDl6kLYjMdOV68=; b=fjSoDwWUFxi04aNXeV0Ujx6MSUPzMfQVYLO6YuQZqES/dRw9+NEM+TQntqv2fjGFtw EfSRYVEvESqbK4EtSDjO/ItJ7zxgaQW8YfX675H4cDPSZ6IlmSxTN9GX6ZuUhKBZ5ACn NykTVkI454vzpOuzmycSJfUAGGZJQOQQWOOYCj72EHLGOdl6dO+UbvQb6rwrk5AN+zcE hF1CnhxKsBfP/MU8wVmktxru3V0pLyWarOUd+3CrW44p5rEdnru47IHMDodGXuGmpvcs SfEohiEQ9sBe0AZ2xhMYu+NbzyEXzUsDIvZe561t5cX1Sgmo8BB6SU9A0R22ne8kQ8G2 j+9g== X-Gm-Message-State: AFqh2ko5VUMau8gmGeTa9wRS2PQDuDTY3qURoeffN2rg5tmqKmXJyejG dh7jlOhU4mmYI2XNNduuXSQ= X-Google-Smtp-Source: AMrXdXuopL1YCdkdtbKoGG/gjIRTEabwn/ENnFAHXgYRviGj73xTUB/xxw/XplI1n3AcRXREZspG9g== X-Received: by 2002:a17:90a:f3d8:b0:228:da96:cfd2 with SMTP id ha24-20020a17090af3d800b00228da96cfd2mr5953879pjb.27.1674028822477; Wed, 18 Jan 2023 00:00:22 -0800 (PST) Received: from bobo.ibm.com (193-116-102-45.tpgi.com.au. [193.116.102.45]) by smtp.gmail.com with ESMTPSA id y2-20020a17090a16c200b002272616d3e1sm738462pje.40.2023.01.18.00.00.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 00:00:21 -0800 (PST) From: Nicholas Piggin To: Andrew Morton Cc: Nicholas Piggin , Andy Lutomirski , Linus Torvalds , linux-arch , linux-mm , linuxppc-dev@lists.ozlabs.org Subject: [PATCH v6 0/5] shoot lazy tlbs Date: Wed, 18 Jan 2023 18:00:06 +1000 Message-Id: <20230118080011.2258375-1-npiggin@gmail.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: AD6DC16001B X-Stat-Signature: 6cpyn4z7f5t7uty6qnhry1dhfdsu14kw X-HE-Tag: 1674028823-447790 X-HE-Meta: U2FsdGVkX1+ij2SfUeT4eQTqsUmtAQDRJIJrxjzzO4yaXXIkvWxtTIU82auJU/ZCHY9ggTsMgZLwKZpDLUvUXMMjjLbZgG6ok3FdZad8dTKzzFUGJftvRruH7YiDJFxP89XWdawFcajGAAxv7+NyXe4xlilkmE8BOtpwr6Fpz6Ram7Qu1mqYrjWzeXBcfEWbKfYAVC+5Z/eZxHn7xlh26lkTekvuLj/UG2sTzvKNtOWOnNYDd+l68ptJGtcLTjyzZaN+lcVqqqpKbG0NUZJFOjOmYMQxDsnAWx366LBFrf+fpt3OfIFdIIPchoPIj9rxIY+XKxI9yLhmLzkhb+4aHzrAp5QoyUIX9wK/PnVA9PLjk1RGAQEft2754pybPNsN2nbm7GIby5GTgaHw+jSCrBg6f0aqHMb7evO7zUAyySBKcMjYN4DMixWazosHmakgqEP+ootJXKCeUyege8jBAxEEjZUw9Xf0VjUpQ1QXGT5pwJBBsvYNDlzU3SwJ40xiIYQkQyhQ22i917rHe5If6yueICMqZG6DlUoIFk/6rAUnijF/j72wGrib/+ILWmZBXti81j10E27kkYXSTGvw+NADvX3vk6HSOdLLg7PtLegTkzcag130jjSBTGl6WsS3UF7imo7HbKwNyd/yw5Jpjxvf0Kp7HDTGR0muEkyEbQh4h5dwlV6UknfdG3U+A/E6JlTOZmzIhTrEmcPF6OFn2BhqFjGLbQhixo9RxiqYxZfs3oVRJHpMmB7LeIZ4lT5zCCBEzhpNMP+aVYHqV+b4sTmApAjLp2uEbhrdwDVj6eCAIkyDKxIGdC4iOrVPqqV6ttVQh1jBVrBJ67oWScaQV1jO/0ntmR6ACknHaIq0PrdnNAqPGFhF3dbf5wHkCXb2dsu3wM810+wnov0Bi2oC0RzK8KqXddTWlBO28tfyNRW3y5dxwwVpkkoBucnIw4BfOlvMEXsSCC4vBVWD1t/ U+j6i9VK HrsDkXCWG88ikYe32mju1RDxT2oVkeCA34TVxyDQRm34aHltJ6y+3iCBV3Evbh4tzbzUMSl6dlIQAsle+TSpatTtUI51Hn56WXNCe5b7EYyZ8duXOAdFfGABOiw/PJABLtxU0 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: It's time for that annual flamewar. Nothing really changed in core code to clean things up or make it better for x86 last year, so I think we can table that objection. IIRC the situation left off with Andy proposing a different approach, and Linus preferring to shoot the lazies at exit time (piggybacking on the TLB flush IPI), which is what this series allows an arch to do. Discussion thread here: https://lore.kernel.org/linux-arch/7c9c388c388df8e88bb5d14828053ac0cb11cf69.1641659630.git.luto@kernel.org/ I don't think there was any movement on this or other alternatives, or code cleanups since then, but correct me if I'm wrong. Since v5 of this series, there has just been a minor rebase to upstream, and some tweaking of comments and code style. No functional changes. Also included patch 5 which is the optimisation that combines final TLB shootdown with the lazy tlb mm shootdown IPIs. Included because Linus expected to see it. It works fine, but I have some other powerpc changes I would like to go ahead of it so I would like to take those through the powerpc tree. And actually giving it a release cycle without that optimization will help stress test the final IPI cleanup path too, which I would like. Even without the last patch, the additional IPIs caused by shoot lazy is down in the noise so I'm not too concerned about it. Thanks, Nick Nicholas Piggin (5): lazy tlb: introduce lazy tlb mm refcount helper functions lazy tlb: allow lazy tlb mm refcounting to be configurable lazy tlb: shoot lazies, non-refcounting lazy tlb mm reference handling scheme powerpc/64s: enable MMU_LAZY_TLB_SHOOTDOWN powerpc/64s/radix: combine final TLB flush and lazy tlb mm shootdown IPIs Documentation/mm/active_mm.rst | 6 +++ arch/Kconfig | 32 ++++++++++++++ arch/arm/mach-rpc/ecard.c | 2 +- arch/powerpc/Kconfig | 1 + arch/powerpc/kernel/smp.c | 2 +- arch/powerpc/mm/book3s64/radix_tlb.c | 30 +++++++++++-- fs/exec.c | 2 +- include/linux/sched/mm.h | 28 ++++++++++++ kernel/cpu.c | 2 +- kernel/exit.c | 2 +- kernel/fork.c | 65 ++++++++++++++++++++++++++++ kernel/kthread.c | 21 +++++---- kernel/sched/core.c | 35 ++++++++++----- kernel/sched/sched.h | 4 +- 14 files changed, 205 insertions(+), 27 deletions(-)