From patchwork Mon May 1 19:28:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13227931 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 61FE0C7EE24 for ; Mon, 1 May 2023 19:28:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4A67228000B; Mon, 1 May 2023 15:28:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 456EF280001; Mon, 1 May 2023 15:28:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2F7D028000B; Mon, 1 May 2023 15:28:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 20523280001 for ; Mon, 1 May 2023 15:28:55 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id EF6738085F for ; Mon, 1 May 2023 19:28:54 +0000 (UTC) X-FDA: 80742673788.15.D2C50A3 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by imf05.hostedemail.com (Postfix) with ESMTP id 09D0510000E for ; Mon, 1 May 2023 19:28:51 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bRmqBPTZ; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969332; a=rsa-sha256; cv=none; b=O43ecMdFS8uz1G4Gh97XGlVtxXjPoWRU5Oqr0yL3ovn4cD6QSkXgFFbpXFNw2UPedKyb2T PG5h6wOQnD6uBnKrdSGTo46NbAm/fMF7eKVzjjlKMZbH3flMDjZZ6q5ITaHkXFNae9uZFZ 6PYmai4hRyP6+8IwgLdhT5znf7pCGZk= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bRmqBPTZ; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682969332; 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=Mt3HE6L47sPJBYnAKPMz0/DxNRKvA6oRz72+XbjGX9E=; b=TOqBAmiJsWqg8iqIb9mRrjahyfyTx/B+RU0AmZwaIumzqLvKJEbPQGF3nu/HcHxeT42LBU HNFJBmIjHDJocfjsAMlp6LBWjdDQQEuAaqAzWjgIabXPHEyKUN4xuU7p66T3vuk+DtMLSc mt5T4IctjbpaMJr57//W3r8RHoPtrxI= Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-64115eef620so29037908b3a.1 for ; Mon, 01 May 2023 12:28:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969331; x=1685561331; 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=Mt3HE6L47sPJBYnAKPMz0/DxNRKvA6oRz72+XbjGX9E=; b=bRmqBPTZgCa5IrhecvrTPyLDuab4M/2pWmm67Ij9kB88cqyNYvHpKZf2c822tlLINs V7g4wokwjyA5yoaxqgkTwqtzjgfghwoIfl0NbPXtXdg2Gw3C4PIS2FYz/KLko7etiChc s5Y++dzV39ZBew8o5WYNHoWZR+E9Lx1p8UATOni2Z3kTd3MdcR3ji+KJhcCE5jLMM79j 4rcgjvbB4U2t2rwTpoiUyWgvBTuTWbg65E+Konk9GYsk7NMgNhoUvQ9jMEmXFDz/6lzW 5y5R3ETL6C6d8IdLyMxau5jgOeNqS9ewzuT1HexEBx4VHGUimuQrmfTb2llKzaIBnzUu BV2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969331; x=1685561331; 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=Mt3HE6L47sPJBYnAKPMz0/DxNRKvA6oRz72+XbjGX9E=; b=g2bcTJoxwXzNbT1EZDRQRo4DnNzPEoLmm1fNkyLXgG9D9LyhMesfDZ+En5iyQt63or tOP0gTPLSfvD0yeZPUOwHzkkH/upg5kbE9IVYLIHU/MbHg6UYY0nLjO91z1D+m00WRLS 6sqqrWg2Z4FT0tv8csXgX6AQ/lfbuH5J72FQN4Zw07LFXL+dS6n1jOC+ic2G9Yglr6xe xoWHtw2Mdn/fa9dJB8i1y8G/ByqRaJWXW7DiTHX2XN06FHdoy7BsEDPZu3GwFAM0CvnF 0M+fwMccVUkMQ+ZCqfNY7aOf8SezMzHKnwqPBUmIOCaG6sJpe6wLlOlMs96iF+n7RyJz pfpQ== X-Gm-Message-State: AC+VfDxQVtp/BVoEz67EJl2ZwksyoUBn/Z7aBKgtm8/8zqb/mteykLNh lILckA6fU4XvI4mdfKdjBaE= X-Google-Smtp-Source: ACHHUZ6xNyoMsdtkeuJYwr4JFA16W7bSDCfft0wt/spwymptVQy+yHqySIROmads3b5d2VYC5oAliA== X-Received: by 2002:a17:902:ced1:b0:1a9:3c1d:66de with SMTP id d17-20020a170902ced100b001a93c1d66demr18699403plg.15.1682969330907; Mon, 01 May 2023 12:28:50 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28:50 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.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, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, "Vishal Moola (Oracle)" Subject: [PATCH v2 12/34] mm: Convert ptlock_free() to use ptdescs Date: Mon, 1 May 2023 12:28:07 -0700 Message-Id: <20230501192829.17086-13-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 09D0510000E X-Rspamd-Server: rspam01 X-Stat-Signature: z4g5fndt9mn46xynsk8sp5kwkt46rdtt X-HE-Tag: 1682969331-561079 X-HE-Meta: U2FsdGVkX19eZB5Iiab80qSBccBsVhfS3hupQGmvFMAgqFgKot97iqCy6tUsGG0yn5OHUyJdH3hDdfiUxDrQM0npY5Aa81G5+Us0RRuiFDXBkQIvBmg3OdRDzCCm2R/JrYZugCIZX4KjP28gQ6kLIgmmBK5AZLId7nLNNEPJgWxf2TcWRpRLtqhKjQwWRTLS2R1Zxk450lyQ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/M/K29PmH6zpKFdnun/J0N/PNuNcC63CBqLw31tkAgPQDLVj5tjX4g9+2q1UPgNJodROlTlj4KOWY6qb53qdxQyxHAAdHIkopLfucWA5JCmn5kLImar1LMAKdaQlW0ktc6mYM32lPkXWyNAC7bl3KXxFVq6XSNOpn7mwkuRZ4IdH6ZZMDv7HB9afN/tWDTPw62vHfi5ZJeGEuqqepNqos1U/WHmA9M+sAgEUvi9dYRXM5DASu/QlmkN1B2Lei+LeObLsaanuje19BN3nTZ1yIH7rlzbthEBln2a8SBeLMw= 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 removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) --- include/linux/mm.h | 10 +++++----- mm/memory.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index a2a1bca84ada..58c911341a33 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2787,7 +2787,7 @@ static inline void ptdesc_clear(void *x) #if ALLOC_SPLIT_PTLOCKS void __init ptlock_cache_init(void); bool ptlock_alloc(struct ptdesc *ptdesc); -extern void ptlock_free(struct page *page); +void ptlock_free(struct ptdesc *ptdesc); static inline spinlock_t *ptlock_ptr(struct ptdesc *ptdesc) { @@ -2803,7 +2803,7 @@ static inline bool ptlock_alloc(struct ptdesc *ptdesc) return true; } -static inline void ptlock_free(struct page *page) +static inline void ptlock_free(struct ptdesc *ptdesc) { } @@ -2844,7 +2844,7 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) } static inline void ptlock_cache_init(void) {} static inline bool ptlock_init(struct ptdesc *ptdesc) { return true; } -static inline void ptlock_free(struct page *page) {} +static inline void ptlock_free(struct ptdesc *ptdesc) {} #endif /* USE_SPLIT_PTE_PTLOCKS */ static inline bool pgtable_pte_page_ctor(struct page *page) @@ -2858,7 +2858,7 @@ static inline bool pgtable_pte_page_ctor(struct page *page) static inline void pgtable_pte_page_dtor(struct page *page) { - ptlock_free(page); + ptlock_free(page_ptdesc(page)); __ClearPageTable(page); dec_lruvec_page_state(page, NR_PAGETABLE); } @@ -2916,7 +2916,7 @@ static inline void pmd_ptlock_free(struct ptdesc *ptdesc) #ifdef CONFIG_TRANSPARENT_HUGEPAGE VM_BUG_ON_PAGE(ptdesc->pmd_huge_pte, ptdesc_page(ptdesc)); #endif - ptlock_free(ptdesc_page(ptdesc)); + ptlock_free(ptdesc); } #define pmd_huge_pte(mm, pmd) (pmd_ptdesc(pmd)->pmd_huge_pte) diff --git a/mm/memory.c b/mm/memory.c index ba0dd1b2d616..7a0b36560e28 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5950,8 +5950,8 @@ bool ptlock_alloc(struct ptdesc *ptdesc) return true; } -void ptlock_free(struct page *page) +void ptlock_free(struct ptdesc *ptdesc) { - kmem_cache_free(page_ptl_cachep, page->ptl); + kmem_cache_free(page_ptl_cachep, ptdesc->ptl); } #endif