From patchwork Tue Jun 27 03:14:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13293724 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 CF753EB64DD for ; Tue, 27 Jun 2023 03:15:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BBC2B8D0009; Mon, 26 Jun 2023 23:15:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B42138D0003; Mon, 26 Jun 2023 23:15:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A31448D0009; Mon, 26 Jun 2023 23:15:25 -0400 (EDT) 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 953998D0003 for ; Mon, 26 Jun 2023 23:15:25 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 55E3B160478 for ; Tue, 27 Jun 2023 03:15:25 +0000 (UTC) X-FDA: 80947062210.18.7580679 Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) by imf04.hostedemail.com (Postfix) with ESMTP id 9285840009 for ; Tue, 27 Jun 2023 03:15:23 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=dOSQZ2Oi; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.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=1687835723; 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=Z9Q71kHk0zB6vt5ahL9ZHs7069+SCA/PofhBzVdlAuY=; b=1K0P73oEZp2h1E8YauOs9qIcEXeeLblrEQsNxVUuj/AH1pHr8Mmy44QuEj2CvpIBk/pysc dkAhZRCgt4VGEPjSjmw0npA/mTKy9Zl+mUvt2NG08fBUeAXezYQcoA7lRim9wLASAUyK69 aM8idjDvncJ8sgcSz/q/gPKUP4OnMDY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687835723; a=rsa-sha256; cv=none; b=PqN838UTLFZrbsmxKFu6Hms/7DtDAcEDKN6aFEJ+e3NCChI4JVQNYMSQo4DX0km/wP6H8z U/ba8gwebjRXSj1e2elf//sBehSy5ylGrj15FvPrwwZGkA34CRM8hgctpAJKGCIuyXG9US P3abbdPbjxlHiLoHuXl/hrROGRD7ito= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=dOSQZ2Oi; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.128.173 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-570002c9b38so42369067b3.1 for ; Mon, 26 Jun 2023 20:15:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687835722; x=1690427722; 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=Z9Q71kHk0zB6vt5ahL9ZHs7069+SCA/PofhBzVdlAuY=; b=dOSQZ2OiXRbn7dKMKT1JXAgsN/C3jxCnB5LBHCK9iXILo1l4gDWq1J3cX5+exLYTxn wYoORsV8t6fPDceGwULdTPoZYpfiYfI04T4bOuvjwcHJfivuVIRVY0M+R3Uhc5iOpVeL 0vND8iKDAhmvYQiXoqAJRaFlNkMa3Bk4ZwjVbqbFjHFv+wwgHdDhUknddaUHcnd7Lv+F XfvU3AUvFbk/B6hNpVu5vRnlx39aUpFS25FcgH8ICpzs8p4la51sSmvC+1TP3EUm2inI tzhySMFhH/VY7MUDkzq18xgDM3Cn6KetwRARgLmNOPJ/2w0oaiVuiWvL7GVUeKg27bSV B58A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687835722; x=1690427722; 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=Z9Q71kHk0zB6vt5ahL9ZHs7069+SCA/PofhBzVdlAuY=; b=Ol+7BZ5W0H+GyeQk1GmEOzVltIH+iYlJr2FCUrg50RpPPEtEKxU7IDfkt1fDrcWq1K dogEbicstClLde4HUlYuYbSKwgGCieNmMuHhthciJUjh5aXhefR5J8bPXyjrv0GjrG9A +EJPC+ZCYVGgnhwcUwJccHaKFe/AynrXD+DI3tTslcnzbF5AdagTairMiqDrnSdZeyV7 vcZ67YNq9oaymtniX6yVmIcw4zTy78hfy4Frak6uWcr6IXtUBVhypgpuJ9srQjk5lDJl PzFw8OVkBRZRS2+lvPI49s1OC6YU+AnM9onlqV2uAauj4fqD6ifq/t53SaOaszmGYB23 K82g== X-Gm-Message-State: AC+VfDwi9JNcrETcL6AbHNhnVuSpldRTPgReS0YTh2swPdcv1W7CsihY kUR9ylMBxFJx0k6IiiogXLo= X-Google-Smtp-Source: ACHHUZ5sPmbirZ+Hp/U6Mh5uEO5OmHRgtgjjLF/hS5R/U+jD4/eUdYkFVTE6CQ/xsnAMAlWUQublhg== X-Received: by 2002:a0d:ea89:0:b0:56c:e4b1:19f6 with SMTP id t131-20020a0dea89000000b0056ce4b119f6mr32348296ywe.44.1687835722632; Mon, 26 Jun 2023 20:15:22 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id s4-20020a0dd004000000b0057399b3bd26sm1614798ywd.33.2023.06.26.20.15.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 20:15:22 -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, Hugh Dickins , "Vishal Moola (Oracle)" , Mike Rapoport Subject: [PATCH v6 07/33] mm: Convert ptlock_ptr() to use ptdescs Date: Mon, 26 Jun 2023 20:14:05 -0700 Message-Id: <20230627031431.29653-8-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627031431.29653-1-vishal.moola@gmail.com> References: <20230627031431.29653-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 9285840009 X-Rspam-User: X-Stat-Signature: eejjazd415ubedeircpgzuo1ya638zba X-Rspamd-Server: rspam03 X-HE-Tag: 1687835723-137489 X-HE-Meta: U2FsdGVkX1+zwAaKr2X6Dkbn7D0B4K9Wghk3FOiGKsKTSrKZYPImgnuda29IEYdK7Syv4X9+onhbdVPCgAI4AZTFeE6mMlgZnTJKMabIbjRaV5AxvKXzlZVB+uifwgPBpgS3eeVN1Lxrc13MfyFsOaLN1RtUDF124Kjk2VsmMG1bvpzyf+j3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KfwzLZarlfGRszQ/iBrZ4TPV2kkvFvj7T0oWFslO060BPA/bVMldpROlPo+lfyCdYhLeeiweHH7ZK7F7pG2u4fEwjQrIdtPihZrGdl9w2jMALbySpgYCi06QoEAMEB+YqYoOXiKj5sIm2HTYwTdCdvyJsKHf4W5U1DKva5MF2xlkxCJp0AtzVwRQRK3NfbaTh5Mum5awlJ/rZYDutjiuWFfxk9ywtrjRwD1UVQoK2MwviRMHkPkBrhrH45Qan3antJnfc+C/Grbcs+5i/WrtLZMjfkOSMJUGJugGXhaheVE8BeRUgR9TVzgNiYDKwT7RqmRhLBMk/jl/aHBrQYXnHfoSciFzqQdkAy9xcpQ8+p7aOdxw589y5ZwR7kAPRFXgWFc8Syp/rdsCGi2frWkWSxauyLGcROjBFuK5Ziqsd6PtTPZpbtr2IeZSnvA7tAGUbvDBjxIn2iQ0Q== 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) Acked-by: Mike Rapoport (IBM) --- arch/x86/xen/mmu_pv.c | 2 +- include/linux/mm.h | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c index e0a975165de7..8796ec310483 100644 --- a/arch/x86/xen/mmu_pv.c +++ b/arch/x86/xen/mmu_pv.c @@ -667,7 +667,7 @@ static spinlock_t *xen_pte_lock(struct page *page, struct mm_struct *mm) spinlock_t *ptl = NULL; #if USE_SPLIT_PTE_PTLOCKS - ptl = ptlock_ptr(page); + ptl = ptlock_ptr(page_ptdesc(page)); spin_lock_nest_lock(ptl, &mm->page_table_lock); #endif diff --git a/include/linux/mm.h b/include/linux/mm.h index 39b0a4661e44..0b230d5d229a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2801,9 +2801,9 @@ void __init ptlock_cache_init(void); bool ptlock_alloc(struct ptdesc *ptdesc); extern void ptlock_free(struct page *page); -static inline spinlock_t *ptlock_ptr(struct page *page) +static inline spinlock_t *ptlock_ptr(struct ptdesc *ptdesc) { - return page->ptl; + return ptdesc->ptl; } #else /* ALLOC_SPLIT_PTLOCKS */ static inline void ptlock_cache_init(void) @@ -2819,15 +2819,15 @@ static inline void ptlock_free(struct page *page) { } -static inline spinlock_t *ptlock_ptr(struct page *page) +static inline spinlock_t *ptlock_ptr(struct ptdesc *ptdesc) { - return &page->ptl; + return &ptdesc->ptl; } #endif /* ALLOC_SPLIT_PTLOCKS */ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) { - return ptlock_ptr(pmd_page(*pmd)); + return ptlock_ptr(page_ptdesc(pmd_page(*pmd))); } static inline bool ptlock_init(struct page *page) @@ -2842,7 +2842,7 @@ static inline bool ptlock_init(struct page *page) VM_BUG_ON_PAGE(*(unsigned long *)&page->ptl, page); if (!ptlock_alloc(page_ptdesc(page))) return false; - spin_lock_init(ptlock_ptr(page)); + spin_lock_init(ptlock_ptr(page_ptdesc(page))); return true; } @@ -2923,7 +2923,7 @@ static inline struct ptdesc *pmd_ptdesc(pmd_t *pmd) static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) { - return ptlock_ptr(ptdesc_page(pmd_ptdesc(pmd))); + return ptlock_ptr(pmd_ptdesc(pmd)); } static inline bool pmd_ptlock_init(struct page *page)