Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp148100lqp; Tue, 21 May 2024 23:13:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUeCw2LSbq8RiyBSmTrgYQZpcWITSNq3WhpeppdEiCXxtFVhrbxdoXnwquOVwaGzY/RFrqiRdrnfKnaD9mZKqPa0+xiTlm8ke8bKRykFQ== X-Google-Smtp-Source: AGHT+IHMlveXi+90MatDg70JSUsWIWAWQk6vsiYv101VvGv3zUxs8GqdcQTK52j1aaJ24qr0q8xl X-Received: by 2002:ae9:ec17:0:b0:792:e153:111b with SMTP id af79cd13be357-7949942d74fmr104933785a.30.1716358423361; Tue, 21 May 2024 23:13:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716358423; cv=pass; d=google.com; s=arc-20160816; b=0XBeNIyGKxvnuhI5YeUrH3wah8YZg5bOnvC6PoKRv+H0U1WYJ7Ob2lOVUbeDg7YpN2 ySmXUsjcS0G0COYjLbnOms4hLQd3rBpQXpv5VX0Vs46rI1Dsv/BVFC5mozj8d48rKbZD heVoW0J+5V8YCdZrDxVEA4ZkjEZgJCK4iV3geCu+sTZ7QAt7HD3qu8rvPHMpXt/+iA6l Lo2zE8LmJZlY4udqErAuqFhLO6DOGlZEMT0fFhi6+CrnTo1c/4LMktpgFwOtrNLz5ZRc AjTdxmc97xcevraILWuh2zfIx/aF4xsdmQfMIU1pm9G/3+243vU2lyhLxjc/lpGrp+fG awvg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=50gKTtI5/VbfrYUWsIwxZn0QXyXPTk7AsRcof412llE=; fh=ZaPvTvk3greVAhtlw/faBL7y/bcze5JBULOYO1tsevI=; b=Hf1zadTYXj4H9t/A5aJ88nP2xx7lSGBV6jZbSGVYrFR5vsCTFIr2MBc0V0Yk5YFQW3 gGlxuU3gPxIjl1sHJQOwxmWQV2EJ1KWqov7yPb0HWIFpbkG3Ce5zSNzq+AOD+l0HtQpp QSwsiiLN3Rz8G1KX957n/f3EF4394/RxynEVChg0ijxvwArd5rUAOlTVxr/MUKjEXHEh cevJ2c9nVkipm4ojluSRlEHvZznxKaoXKmwVyutjLk0de0IXX0/7XJOGGaAIt1BykRxL OjHdVNbJNJN2oIKivyMGR1QoCXz2omZNy/tuNJ+jiO4vTCNGB/R6oSFnx5RGRgGDYfH2 /fRg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@antgroup.com header.s=default header.b="M2ShXC/k"; arc=pass (i=1 spf=pass spfdomain=antgroup.com dkim=pass dkdomain=antgroup.com dmarc=pass fromdomain=antgroup.com); spf=pass (google.com: domain of linux-kernel+bounces-185797-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185797-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-792bf278a1asi245833485a.1.2024.05.21.23.13.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 23:13:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-185797-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@antgroup.com header.s=default header.b="M2ShXC/k"; arc=pass (i=1 spf=pass spfdomain=antgroup.com dkim=pass dkdomain=antgroup.com dmarc=pass fromdomain=antgroup.com); spf=pass (google.com: domain of linux-kernel+bounces-185797-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185797-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id F380A1C20DC4 for ; Wed, 22 May 2024 06:13:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BB52378289; Wed, 22 May 2024 06:13:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b="M2ShXC/k" Received: from out0-204.mail.aliyun.com (out0-204.mail.aliyun.com [140.205.0.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8644D1C6B4 for ; Wed, 22 May 2024 06:13:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=140.205.0.204 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716358412; cv=none; b=Lpw63+9cGEhDkPuXrYKpmF7Ex8oHZEyDy+JDCkykW0et7qeIcTvD97RXvJBDLWtT1YcWNbT9kxn0k7oR9J/bVT0W2huRbcbKgOMO58Cyj9lgxVV/h3vTdYK+pqDCzvgGzAUFlLLUQYJ7VJscZ1AbGUtuOEB89nLJpdHXDrbOUeg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716358412; c=relaxed/simple; bh=TRiPUs3sOqcR2Uebg5ICahKspfvDNX9Au3ncj/hVLOg=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=nYwhgMcNjurt46oU83oAon12JmRVQUT1dmE1mJUN/lFs6+JbRnHx4Ho4oJbQekPMRZSmQTS0XGWNkfCh5VT4hWQm6YiAtWzlGL+Ef2MsKMfasXRAV1a1JY6igQ04oCIGMsmnWXHdcDcEwMQsYaqfBUanvUwV8Jq7GbTxc1r2Kpg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b=M2ShXC/k; arc=none smtp.client-ip=140.205.0.204 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1716358401; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=50gKTtI5/VbfrYUWsIwxZn0QXyXPTk7AsRcof412llE=; b=M2ShXC/kO+uLmb1DERSb+Y3T2CE4HXLhuViAFdf1bMn31T/nG6D6d5Tc9VCmJCKtGRtP75W2kB8gsyJKzigy63IqXGZV+443bqQ6CUBgYBzd4kqLeGRqxb6GMg1qCcalHkUottxI1VJPaW52ZQr5NiNPpWzef7O46GNIoKy3/Qg= 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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(-) -- 2.19.1.6.gb485710b