From patchwork Mon Dec 23 09:40:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13918677 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 ADBA9E7718B for ; Mon, 23 Dec 2024 09:45:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 44A2E6B00A7; Mon, 23 Dec 2024 04:45:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3FB5C6B00A8; Mon, 23 Dec 2024 04:45:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 24C9C6B00A9; Mon, 23 Dec 2024 04:45:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 043306B00A7 for ; Mon, 23 Dec 2024 04:45:39 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 9FA5B140CE6 for ; Mon, 23 Dec 2024 09:45:39 +0000 (UTC) X-FDA: 82925740422.30.A74A28C Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by imf24.hostedemail.com (Postfix) with ESMTP id D2AA018000F for ; Mon, 23 Dec 2024 09:45:32 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=hx2+FlXC; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf24.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.182 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734947120; a=rsa-sha256; cv=none; b=wTjtio90SQUo1e8k6NU22B0ZJk8xRIhUeUXbKcsJxxsoiJ88a0sB8aueiCSHwVM/C6o6Fy mSXq9rMiPWciapSVyrsN/xMMFQ+G6BLVGge1Co/IAP14kxRbRvEqvstwhlXPhRU0DVj8mE ZuyY2Tfg6Q/l+wx6vvawETRrkUwdzn8= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=hx2+FlXC; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf24.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.182 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734947120; 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:in-reply-to:references:references:dkim-signature; bh=jyEzElX2/Cl2Hb0vACePBo9dDp7jwROhL3d0Mq9f7ig=; b=OzGT7C4qX0qKiTubMHW7pxuVQ7tQ16QeB8BywbWUCCyd/WZGFVdbYJCXvka7QclykYBdbT y18rIWAGCDWCkEl4yaAvhd7lNpHLSN1460FfvjlQpR+1GM6zkqdogLd10lT7XSS3SkGBYP aaaOIyHU4ZI3Tnx5rScwja/M46Hzl58= Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-725ce7b82cbso4567427b3a.0 for ; Mon, 23 Dec 2024 01:45:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1734947136; x=1735551936; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jyEzElX2/Cl2Hb0vACePBo9dDp7jwROhL3d0Mq9f7ig=; b=hx2+FlXC2WLX5GBGqSRmOW2p+SumbSiwoYStpELSD8Ebp86Gwebjlxfic8QkmEHxvM 4zCQt1KcGBLqD8krcd5TcSHceMjq99hA0uVQUnBZENuAs/sUtGtEkBD6fkobnwr0j/6D QYk994q0URrOWLn+pw6wiGEAg+zjsGVUEugWQg4QMOEaMtWBOdwg5KwuVGOIxA6l9+Ob RZ6pLvYhnn7erW57xpZNcXOvAjsI0pqXvSxIP/jt97SPVocbm1qcIVoKU7lkapWxng2K HNXB6Dpo80nDIF1I0fncU43mocZdo7BVpjf4XBg6Qxm1uSEsiPwVKQVSiaa/Sq4srW0Z FW/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734947136; x=1735551936; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jyEzElX2/Cl2Hb0vACePBo9dDp7jwROhL3d0Mq9f7ig=; b=YKyKle0i8hesXDGzmSvxmpVRxBT6ijStQbTG4rIWHg7vc/k7ApnNr2BfoLd3trZtnh XsbHTz6DCqqQHM6wd/RiYfNHei1YFOLo851MKs0fqbsCJdXrHKFK/cLpSsp4RIk6Sm9D 3XHAbXxvx/vwPVrsolRvvv/o2zmWHzGcf9B+4q96prPLqyMG9gD9nWf2PgK1nHkyBVsR iKAw4hfwixQ9Rc0IPFCsnXbhG3lKvs2V9MXAEd2ess1ZDrKQOT0IdXiybA0EuWe6SHRw mR71+ao4X4IHixq2/YnFatIYFTmwoLHB1iXG6h31GisZTfYRIqJFTrN8hGMI5Z+O/Kf2 fBDA== X-Gm-Message-State: AOJu0YyxICnanPGxspW0QGIjgd25SWcxyZXPAw27XiK5OhaFNM+Hm3fc Ls0vsx+g9/rrf4tQOQ+4qoqB2QqKyk/y6e0uDtIUIGwFEUS9yiKyGsE3pJx8EKg= X-Gm-Gg: ASbGnct9fGjPQ18ouhlXhPbu1MkJLy6glBrLvDK1VZV8a7iCpavU8kJtZiCU3Kjth8R 0mOEI0JOqq23A5KqF/N9XCFzrQ9jT/T5zhL5ZDswQCXZsTQKeg23TFFj57t5Cr/EJ98dx6TKiqQ UAMYwTCdjrgvcpb2jkSQQuggnqXRxAStx77Eo54nu7DrWwfhb0ooh8IsGqqWTFFzdO9d6Wuglu6 vYsJcVJnYzmhH1uvUZhTaNXhYscFvTapziy3MUJJFzuLT0GPsHWcbn38jREum6FwiOq8OG3UxuF Z/WwIn79tgw1wEn6XLC+6A== X-Google-Smtp-Source: AGHT+IFFxsa0Y8D8QMIcsR8+VA1yaCfovsoDpuS31clip0UDjebZ+1TP8q/TeJDt5eTrdc0wzKH4iQ== X-Received: by 2002:a05:6a00:399a:b0:725:b7dd:e668 with SMTP id d2e1a72fcca58-72abdebb868mr13954007b3a.17.1734947136545; Mon, 23 Dec 2024 01:45:36 -0800 (PST) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.150]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8486c6sm7468309b3a.85.2024.12.23.01.45.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Dec 2024 01:45:36 -0800 (PST) From: Qi Zheng To: peterz@infradead.org, agordeev@linux.ibm.com, kevin.brodsky@arm.com, tglx@linutronix.de, david@redhat.com, jannh@google.com, hughd@google.com, yuzhao@google.com, willy@infradead.org, muchun.song@linux.dev, vbabka@kernel.org, lorenzo.stoakes@oracle.com, akpm@linux-foundation.org, rientjes@google.com, vishal.moola@gmail.com, arnd@arndb.de, will@kernel.org, aneesh.kumar@kernel.org, npiggin@gmail.com, dave.hansen@linux.intel.com, rppt@kernel.org, ryan.roberts@arm.com Cc: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linux-sh@vger.kernel.org, linux-um@lists.infradead.org, Qi Zheng Subject: [PATCH v3 12/17] s390: pgtable: also move pagetable_dtor() of PxD to __tlb_remove_table() Date: Mon, 23 Dec 2024 17:40:58 +0800 Message-Id: X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: D2AA018000F X-Stat-Signature: mpj38i5jdboefnmoistx38oign4g8s4d X-HE-Tag: 1734947132-888765 X-HE-Meta: U2FsdGVkX1/NVw3sDPiZAHfZkDi+9agWXsSINfW1Tn0bRdNIH1fK/sMs/UDs7qny1647JizU7L1sECg7ei31lJxkEnhtMz5gjW+68ctPNGBMMwGQ1YMw52kZV9rx9JssxHAiLxT4jeqauCGxp+gfyIynCCUh6ddKLZyZO8JEdCh0U12drnS2kheUesOXr48Q5izFTG/wd5tXrC3V1gYFil1WDtIL9CCsxGkrMr1SZXmEFSqtcsFVjs/A34Dl0IZfhB133DlZkUQSC936cY6UHno6TjmS71TdyQkEvXUnwyNOsAnDi5LiwTcC3144CWrsAA+nRSPHUxF+JwKwwGF9tAX8kWfrxqyCIMZoRx7jSyhgo6kO33q+KOf4cVQeVLcnIuJhCyCZaXqUHDwAD+705M26ZnjeLPXxM6VEMNZMWo23vDYfOOLPoa6p8ykjlzD7GHkP57c8yU503Par7tL39NpV8T6/fojYJNVjzxauCEwfrdM/UbRQ3n7FHkdBFf1mVfGIZDgMhIL2sn82kPt1HqgEYRXutKGJWIsTZbZlQiHptcytFq08GYgFK3pRG83DPxoUsjJBnvAkmquQux+ZBlOU6Hj6+qj7XvjGc7U53VA40DTgcjURun+sAOlXAWSQ+7PdHQljtfk7U049qcjLorRRxVxZys8hcq9e55aJS2OP6y0ckE93yMiSB44Cw2GBBeqOtyVj7KcXAnLcrkmYjv3kBsjSay/pZwoqqPYKnlWfBRNDUR1ptkQCOSi8ve26HVfzBdIFHujyBBdZq9Q62NYrTKsyVcx5y1D3vgSmQuupkgeO/RotprGXDztrA8feL2ScdGaKUVguK6FD6u5vmgPLdgxS2OKeD7GJOtM8ishGXC7sw0ZAHs618FsINAsbhizWdn7hFSi8hIj6ppGmXf3nkwl/3Ya1z0Ge0uW+iwhynvMNTBwNBIWsQhBb+VD+v7ZpugtliuTZ5qjrqmy 5n8BaU7f nvQpwr4aGTtwY/dxyvYE80coPwOCbTvynBvsFDu7GruCsTHYXjKYm1oT+3pAa9KhiThtXQZLs22kDBd0Tl/Z8MigDHhIOPNHymHpC40nSdYT3QZp1at1e7tkDv4e8NplAhPFmhsQ9Jgv1RObGeN7HsmKVVV06CmSiLALU4cq6TxFe4A3Vb4SNFpA7EfD+RGLmDeacr79ppgy9w0ttRw+nKIeRrVDe5+mr8iyFXRPseZwkB9vx25ZEuEJl7hFpYJQtbSey5pLJ60UyXprw3CejHL71G+qdh1+ogl7t3Es05TWdMzMWJPfpvxlofjFKuSjDfMBpePWfOUqkC7bn/x+tpZSTyOvu8p8tidRb59ecCLPsrHps3PzxrY5NG6cDfHjMA8uWVpzVzf6FMLM4Lg++m/P8WOK9OIU3yYpKd6k0Pd6/yr4LMfI5FcirjKeV1RlsAU8SfqnF+oTSE3hv/kMO+voaJB8+PmBhrXvhGEYcJCzvdWAtBBYUYVMHtMeFZA0jY4vS 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: List-Subscribe: List-Unsubscribe: To unify the PxD and PTE TLB free path, also move the pagetable_dtor() of PMD|PUD|P4D to __tlb_remove_table(). Signed-off-by: Qi Zheng Suggested-by: Peter Zijlstra (Intel) Cc: linux-s390@vger.kernel.org --- arch/s390/include/asm/tlb.h | 3 --- arch/s390/mm/pgalloc.c | 14 ++++---------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h index 74b6fba4c2ee3..79df7c0932c56 100644 --- a/arch/s390/include/asm/tlb.h +++ b/arch/s390/include/asm/tlb.h @@ -102,7 +102,6 @@ static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd, { if (mm_pmd_folded(tlb->mm)) return; - pagetable_dtor(virt_to_ptdesc(pmd)); __tlb_adjust_range(tlb, address, PAGE_SIZE); tlb->mm->context.flush_mm = 1; tlb->freed_tables = 1; @@ -122,7 +121,6 @@ static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud, { if (mm_pud_folded(tlb->mm)) return; - pagetable_dtor(virt_to_ptdesc(pud)); tlb->mm->context.flush_mm = 1; tlb->freed_tables = 1; tlb->cleared_p4ds = 1; @@ -141,7 +139,6 @@ static inline void p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d, { if (mm_p4d_folded(tlb->mm)) return; - pagetable_dtor(virt_to_ptdesc(p4d)); __tlb_adjust_range(tlb, address, PAGE_SIZE); tlb->mm->context.flush_mm = 1; tlb->freed_tables = 1; diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c index 569de24d33761..c73b89811a264 100644 --- a/arch/s390/mm/pgalloc.c +++ b/arch/s390/mm/pgalloc.c @@ -180,7 +180,7 @@ unsigned long *page_table_alloc(struct mm_struct *mm) return table; } -static void pagetable_pte_dtor_free(struct ptdesc *ptdesc) +static void pagetable_dtor_free(struct ptdesc *ptdesc) { pagetable_dtor(ptdesc); pagetable_free(ptdesc); @@ -190,20 +190,14 @@ void page_table_free(struct mm_struct *mm, unsigned long *table) { struct ptdesc *ptdesc = virt_to_ptdesc(table); - pagetable_pte_dtor_free(ptdesc); + pagetable_dtor_free(ptdesc); } void __tlb_remove_table(void *table) { struct ptdesc *ptdesc = virt_to_ptdesc(table); - struct page *page = ptdesc_page(ptdesc); - if (compound_order(page) == CRST_ALLOC_ORDER) { - /* pmd, pud, or p4d */ - pagetable_free(ptdesc); - return; - } - pagetable_pte_dtor_free(ptdesc); + pagetable_dtor_free(ptdesc); } #ifdef CONFIG_TRANSPARENT_HUGEPAGE @@ -211,7 +205,7 @@ static void pte_free_now(struct rcu_head *head) { struct ptdesc *ptdesc = container_of(head, struct ptdesc, pt_rcu_head); - pagetable_pte_dtor_free(ptdesc); + pagetable_dtor_free(ptdesc); } void pte_free_defer(struct mm_struct *mm, pgtable_t pgtable)