From patchwork Wed May 22 06:12:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bang Li X-Patchwork-Id: 13670452 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 B785AC25B77 for ; Wed, 22 May 2024 06:13:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F16636B0082; Wed, 22 May 2024 02:13:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EC60B6B0083; Wed, 22 May 2024 02:13:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB4FC6B0085; Wed, 22 May 2024 02:13:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id BD68C6B0082 for ; Wed, 22 May 2024 02:13:28 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 5D56F8011D for ; Wed, 22 May 2024 06:13:28 +0000 (UTC) X-FDA: 82145014896.07.8A69DB5 Received: from out0-203.mail.aliyun.com (out0-203.mail.aliyun.com [140.205.0.203]) by imf02.hostedemail.com (Postfix) with ESMTP id 8E2CF80012 for ; Wed, 22 May 2024 06:13:25 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=antgroup.com header.s=default header.b=BMJoYbrX; spf=pass (imf02.hostedemail.com: domain of libang.li@antgroup.com designates 140.205.0.203 as permitted sender) smtp.mailfrom=libang.li@antgroup.com; dmarc=pass (policy=quarantine) header.from=antgroup.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716358407; 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=50gKTtI5/VbfrYUWsIwxZn0QXyXPTk7AsRcof412llE=; b=kKDek+jRzzCMNIeeebyWBZeRuBj25NW4IFZEC1bo7EU6YgSlJaUiwDQrQggwU3ExaGprkc DU1/LUeDDQxYdJan8Q2G0STpnQOXBBGxDnH4DRWZOFHYpax3MrltpbsqhHHw4VUybiKGBB VFx6N2tpUs6CJZJ3Eo2UfN8UNyUAAwk= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=antgroup.com header.s=default header.b=BMJoYbrX; spf=pass (imf02.hostedemail.com: domain of libang.li@antgroup.com designates 140.205.0.203 as permitted sender) smtp.mailfrom=libang.li@antgroup.com; dmarc=pass (policy=quarantine) header.from=antgroup.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716358407; a=rsa-sha256; cv=none; b=dWOXWAkzo0X0Hlc5+hiu0CW+OHRtICpNk1nHvlVawU3FpyugjL/J8P4bF4ZvAY3s/qgitq 0IhD5eFwAjzAYSCttl8fSWw5IlGwx+76mBAkoAkvEXN669BRd/A8mbKuARhcoj8pEym1tY xYHYFAy3PUcigfvlAwJj6gdq/N7bml8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1716358402; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=50gKTtI5/VbfrYUWsIwxZn0QXyXPTk7AsRcof412llE=; b=BMJoYbrXcJg2TIaAdNpB4sO5LZVTkF+qJQJK9iGuZcxB4UGhSX3IyTI2dsDQaFq6p2vsY+YkzyoqnharK0wpde4+1n64W+ROD0fC+5GOpivsI0KuqGY3XpmJNBGX5iAu1Vek7XwBBOOlurNNsncySvf4rL5Fwetc/sqTqdcRIAA= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R261e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033068161075;MF=libang.li@antgroup.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---.Xjzgxvc_1716358399; Received: from localhost(mailfrom:libang.li@antgroup.com fp:SMTPD_---.Xjzgxvc_1716358399) by smtp.aliyun-inc.com; Wed, 22 May 2024 14:13:20 +0800 From: "Bang Li" To: akpm@linux-foundation.org, chenhuacai@kernel.org, tsbogend@alpha.franken.de, paul.walmsley@sifive.com, palmer@dabbelt.com, chris@zankel.net, jcmvbkbc@gmail.com Cc: , , , , , , , , "Bang Li" Subject: [PATCH v4 0/3] Add update_mmu_tlb_range() to simplify code Date: Wed, 22 May 2024 14:12:01 +0800 Message-Id: <20240522061204.117421-1-libang.li@antgroup.com> X-Mailer: git-send-email 2.19.1.6.gb485710b MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 8E2CF80012 X-Stat-Signature: i8p5xjwxecdd9w3xwijkcbqijkahzhqz X-HE-Tag: 1716358405-301617 X-HE-Meta: U2FsdGVkX19SKk22g7QN3Of7/h7xeAP6YexBdnBBMT+9AGOoddhnAROVgAoNUEoLA08ZZNvlOhOeE0SIukkL5Du/9hLLvflyUf3Olnb0lztXIlqzlpAchj+yFQ0etIj6XXjXn1kr4ItXSPK4DDwHS489KraXlbPa1etdhc2AOIOqYuT+9E195oelIKDqaV7o2ZUYKl36k75BkhBCMnq0wy0KBrptLCXknRYdIw5tgWDKko9YzoVQ5ZGOctMtavYpd4/V1FPXldDC13Ls6H/ZjZG+QZzTWho8+7prfHCKS2vbYpteGx+mxCyy92n7E8wHxkwnHBzHamCitZMU7p+FtcMp575OA3D40BRRDq0ktGKUFGWv46yE5fpmoIhmYLu9YbZYdqE4DmCjUwRsrJvQRG/3zgP/5N9rn8/wu6dQxu1lQ2MK8CnWFKmtjNHU8uikFW2mLJIOLhii/LI1wxjFnaqeweuF5roAAqDV0rlP8QEFZ+BpyEeHEDVvxjj2wGG/+NCpPxrO5fjQunEAGFf2d1foooS5oVwehWAJzjsqgRH4Rh7SMNlbgMSvettPL7JfOPIIhgLaeb1uXfBnmDfCk2ucEcEbNgXBJ7ACdhqlu7R9jPJNfC3ZNqqT7SrFHunhbJfOKztTVD6cWagXMm8vBrG98P0dPzs67eCQgGna/tqnn39gUIiYOX/VZZ5z7CA6/j0tK/MaEmCnsewbrpMo5NccdppN4XnTCghEDZ6c7hejB8Wfgqu5pG5HhdSzLESgcTbX097odmVLDSXy/E3UV+r9+u3rWzCYyPD7Rf35p08rSgvmsbrxWyg3J6vJOh0k/P3Mugr8aCG/qstDgz0wxjvQe54uelgs52pAU4w0mi3UTvcpEWdyznJdGS378hoWTCD1xYKxMA3/1yvsCiGTb3bgt+UtPCz3Geen/Cm/s/CW4zQw4epQPJoC8ElZnDEoqGk/X0jzimaxYwSqjwH yz565DbA /RnZx2AtmYhkorJ1WcowRbwktIJmk84Y7N2ookgqn6Ubdau0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000113, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This series of commits mainly adds the update_mmu_tlb_range() to batch update tlb in an address range and implement update_mmu_tlb() using update_mmu_tlb_range(). After the commit 19eaf44954df ("mm: thp: support allocation of anonymous multi-size THP"), We may need to batch update tlb of a certain address range by calling update_mmu_tlb() in a loop. Using the update_mmu_tlb_range(), we can simplify the code and possibly reduce the execution of some unnecessary code in some architectures. Thanks, Bang Changes since v3 [3]: - Add acked-by from David Hildenbrand (patch #2 and patch #3) - thanks! - Add reviewed-by from Lance Yang (patch #3) - thanks! - Move the general architecture update_mmu_tlb_range() from patch #2 to patch #1 (per David) - Update patch #2 commit log (per David) Changes since v2 [2]: - Use generic architecture to implement update_mmu_tlb() (per Ryan) Changes since v1 [1]: - Add __HAVE_ARCH_UPDATE_MMU_TLB_RANGE macro (per Lance Yang) [1] https://lore.kernel.org/linux-mm/20240429103346.59115-1-libang.li@antgroup.com/ [2] https://lore.kernel.org/linux-mm/20240506155120.83105-1-libang.li@antgroup.com/ [3] https://lore.kernel.org/linux-mm/20240518074914.52170-1-libang.li@antgroup.com/ Bang Li (3): mm: Add update_mmu_tlb_range() mm: implement update_mmu_tlb() using update_mmu_tlb_range() mm: Use update_mmu_tlb_range() to simplify code arch/loongarch/include/asm/pgtable.h | 4 ++-- arch/mips/include/asm/pgtable.h | 4 ++-- arch/riscv/include/asm/pgtable.h | 4 ++-- arch/xtensa/include/asm/pgtable.h | 6 +++--- arch/xtensa/mm/tlb.c | 6 +++--- include/linux/pgtable.h | 11 ++++++++--- mm/memory.c | 4 +--- 7 files changed, 21 insertions(+), 18 deletions(-)