From patchwork Mon Aug 7 23:04:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345290 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 19CB5C001DE for ; Mon, 7 Aug 2023 23:05:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A3A5094000B; Mon, 7 Aug 2023 19:05:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9C466940008; Mon, 7 Aug 2023 19:05:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 83EAC94000B; Mon, 7 Aug 2023 19:05:33 -0400 (EDT) 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 5F484940008 for ; Mon, 7 Aug 2023 19:05:33 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 307B11206BB for ; Mon, 7 Aug 2023 23:05:33 +0000 (UTC) X-FDA: 81098842146.27.55ECAA0 Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) by imf04.hostedemail.com (Postfix) with ESMTP id 689B440008 for ; Mon, 7 Aug 2023 23:05:31 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="i3yG/elN"; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.171 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=1691449531; 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=nhRFpHY9Gkw1pvDSPH6l3PWFnY0Equ+A7zpvUAn8VQI=; b=DFRaU9aQzvmqZ++HvixZpCsXoj9MN+jno/YPSEFYABUGY4YOjCKrSi4LqTqRbZ8atVbnMa tKEPH6dSi8pyA6ZyUctt+OYg8nefjhEXlFxURFe37nghjWI2sXPiKysNFl8bK6ln5SwUwM b9nDDEG0NElF9KaQM84s2oe5kH4vAIw= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="i3yG/elN"; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.171 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=1691449531; a=rsa-sha256; cv=none; b=mszasKn57E6AMHjYMVNK9S8ul1NTfKbas7J4+3vJAU5jBEZe33/NMgcEaHa4dqJJfCxdjs 1fVWbHlS7deGhB7mi9YqM6pi/uays7v5oQSLLa/YYwVzlE9cB4Mc6bXGYIzS2XnWWyoUP4 NON+2KdGOBTK9UZ5rCdIL9aj5NR2nbE= Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-d414540af6bso3652496276.2 for ; Mon, 07 Aug 2023 16:05:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449530; x=1692054330; 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=nhRFpHY9Gkw1pvDSPH6l3PWFnY0Equ+A7zpvUAn8VQI=; b=i3yG/elNSvAKIQpu+LnaQkf9aWr2RTSDWZ0bD6C1RLjObUv19W0XGp5nQ/WUHqv97k 3F3d9T+x+RGssi2D5sQsk0sbYNBszDeUty4Uz3WYnNNnOAOtum0uoqfNv64CjbJYI2vt 5W+yDKCq8CPlPCKNltLocOrpvWmx0Hi9m5r7qQtJGuYnsVLA+FFqMS9EVAuWM7bu2InG Y2OLsVw1zQ1ypzE/Wu4y0WN08yQxAbeMR9OdyOcp5d10YTszQgqk88e/T18v49VnUb5a Be+cx3DsqCXaxjSPwUg4xCjeVNpaDlwm4eDVW83zp+7fbc6H/u+IOUuZtg+F6GjbM9PA 0MXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449530; x=1692054330; 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=nhRFpHY9Gkw1pvDSPH6l3PWFnY0Equ+A7zpvUAn8VQI=; b=lRyD11l9zW8OK8lae0wgc81VTEQEwHzpF5p3ydeiinRZAUxZ1RGu5gy4+112U7eVPJ 9svL2oLwGjOGW6vrXx3L9hq6onsYGxcvWDkBVOlkR87Yrt/2FhoR8h31KeQnUlpxOoGz nDzB/bHc0uhKGDsQDaOD3NxBRLSurgWfI/vhRnkuuFLpKbGTLqvQ4Th9+Wr/YqXio/3G NxExpcxc8Im7eOqbdgNuan6ZfJuNOfknB2mkm0j5qY+gUVnyXGiXiGH7L2mx1WEKJ3Nk L0Hr+WFf/Nx0Y7rb4Vzyi8HtWjOcwZLenee4QkUaLLDi/740WQCBKYrQt5+sFs/xlk1N OueQ== X-Gm-Message-State: AOJu0YxnWfkcZxkItigLSycWpRo6C1k+c2C2xXYgmK3JVdjh71W0crMu gfUj3eIx+zBZ3TkeGcOMZ4s= X-Google-Smtp-Source: AGHT+IH0ZW2oaxdE5zMBv/D24ibnqwE3DqpI9lmZfRLWAk1KAOJsXcFTPw6pcD+tvJtRgJ78+52WaA== X-Received: by 2002:a25:fc3:0:b0:c21:4bc4:331d with SMTP id 186-20020a250fc3000000b00c214bc4331dmr6829336ybp.43.1691449530544; Mon, 07 Aug 2023 16:05:30 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05:30 -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 mm-unstable v9 06/31] mm: Convert ptlock_ptr() to use ptdescs Date: Mon, 7 Aug 2023 16:04:48 -0700 Message-Id: <20230807230513.102486-7-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807230513.102486-1-vishal.moola@gmail.com> References: <20230807230513.102486-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 689B440008 X-Rspam-User: X-Stat-Signature: q377wju375jscj6hk7hzdbyi8g88qrwm X-Rspamd-Server: rspam01 X-HE-Tag: 1691449531-476782 X-HE-Meta: U2FsdGVkX1+o4x7DNilqqoCXVsjww9E8+MQcuATamja6jGLrislhnDGMb4buLklNdB5I7xqekQhNdOde+z9cZjPOnt/sv3OXaV2jfvQDoMYjrnnq4F9B+XBHUYvRWHBrWjoWU0hFtT+pL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q/RS+5VuPn7PxyXkaA3He541kNc/wee5HhKeaJTkKrzA43u0U2R/PX8064IIk7fK4y2147K/aTt8M9wwPpoPM/2J9ynKPRvfM0Y3Kr/E9QVS6In5OTOvkxEwEfwipmjZT8iaTZYOOsI889+XCjgyTVAIb23Rvb6qXR/uAj2hSKY5yCu0GP6pPyM+/s/HQKg0oTpyZgt5VTnvT7t4oEuo6HuoVXPuZ8/1ry5hsc1+ZUWM1nELD0vX7hXpKc9qPjHWYGihJ1XWv84mWlYHl/PIQLBFrrycORmEasd5l/ee0/MojFMEyE8SmG6ObPJJaAbXkNfqNPPnMaURxjTWh9GIj1S8kNLvOKDQUpsXJclRXPgy2r8pu32M5ybfF39uORmE/7ht7bjww93Uob6GBQnYBwfVP1Ru+mLPzXhNPa8q7XVB+i 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. Acked-by: Mike Rapoport (IBM) Signed-off-by: Vishal Moola (Oracle) --- 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 6aea8fb671f1..bc82a64e5f01 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2863,9 +2863,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) @@ -2881,15 +2881,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) @@ -2904,7 +2904,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; } @@ -2990,7 +2990,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)