From patchwork Tue Jul 25 04:20:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325719 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 E4621C07E8F for ; Tue, 25 Jul 2023 04:21:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 765596B0080; Tue, 25 Jul 2023 00:21:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6C6816B0081; Tue, 25 Jul 2023 00:21:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 519016B0082; Tue, 25 Jul 2023 00:21:22 -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 3F17E6B0080 for ; Tue, 25 Jul 2023 00:21:22 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E86FA1A0B8D for ; Tue, 25 Jul 2023 04:21:21 +0000 (UTC) X-FDA: 81048834762.22.5579EEC Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) by imf30.hostedemail.com (Postfix) with ESMTP id 236E98000A for ; Tue, 25 Jul 2023 04:21:19 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=KDYHcYEd; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.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=1690258880; a=rsa-sha256; cv=none; b=oK0Ou32BLOK6wgSATKn58B4OU2kYNsUqyRpYPoDyKbyFrjOE7EIgqTUOG+sMvfn6nastKw +5msLIpz/Safj5Iks4NG2rXGWY7TVXREdzF6xk+ei/Xy3OroRpJuHdm5uKGRlu24lL69w7 E8EPX2xNOjuwHIbsAJwzDrAR6NKmOOI= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=KDYHcYEd; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.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=1690258880; 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=uNVCmnQN0ufsotHop6mLPsVoSXSsgvYy2QMaIqEOqi4=; b=U4vWh6MvvxyvRPzeSmVVDOC/6Y43oS76QdtwYkrLZFSLO1/7E7h7F+LIFSnwa9VRieN5vI 3a4ZjBAaIV341oJuYhlYWvbQv9Q8WcpzJqcmbOTQnhzDgx9H2nmQGNXu3loeGpDOY8OorL MwigYfbVaAlEKuReGsRcksqJsADnmo4= Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-d16889b3e93so620351276.0 for ; Mon, 24 Jul 2023 21:21:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258879; x=1690863679; 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=uNVCmnQN0ufsotHop6mLPsVoSXSsgvYy2QMaIqEOqi4=; b=KDYHcYEdfvpzUEFX0lNkksdcmQYTfb1isarY0fEljmc2IAYrJ5nDDg/7JZU04JTP3L c1QFP/HGIvTwW+tPYnlNpNTf+bNvT4Orf2hELyP6ANZ15n2MuBFPHNYtsv0S4hi5lotS plPoF0Qd+eEXR5m8DnmPEfjKpZQYq5r/wJZjYdNGeMiNfjBcVsPF+85ffm8Hp1058zGf E5mhpdv5sROIr4fRE4AWEGFCJJhFOSPgScin1k95zzp/7dsKEN0qwGECqGpXVDa6nTcU k6so3Cygyv6WxOWRYm0T8muDY8KTb9y3edYXGJvaWKcZYnoxLAplBnufWrEfQhIBMbq5 IGpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258879; x=1690863679; 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=uNVCmnQN0ufsotHop6mLPsVoSXSsgvYy2QMaIqEOqi4=; b=PRHMRQIvDg6ItY6rxN41+3hgFip/Bj80oW15C4+k0jGKrGbxWdsC8Zj8H4adY92O6j GjLK9nKOXMAvqgirMqLpMZCq9aPXETRRrAQDcygKcbxG1CiLHePR+CEmlPp9xCCfS0SA xLiR848Jyz9qC6oHgG33wDNWjT9PyZ1kqGt1792XpucAG+ud4i0qf9lL/kNif4qc9h3L pgFzFmp4XyVHztkUoe3i7/8YGHqG3WR1p5BgMgC/QCjgNvks0c4Y82154vX/SyaptXQt 5bMXEwOX+f1LsJxGFvyQaoAUwlKlmA42uPHGa1kwXtBTV7HTpFh4HAF7SnvruAIYHqX4 zg8Q== X-Gm-Message-State: ABy/qLbXJ/S6y/gKCK81Puu+evKXswupEAmq6/aqhwsocF+nSlVtlYs2 b1fKc2sfOMkd/PbOX40iVes= X-Google-Smtp-Source: APBJJlEiFrFEbevAO9Lv8rv0gB/m4nTd0LDSBWnZ0KZCrLtO0+gMBzxp+Bweq5U88z1Cb1Q1T0NNwg== X-Received: by 2002:a5b:cd2:0:b0:c1b:d362:4b49 with SMTP id e18-20020a5b0cd2000000b00c1bd3624b49mr9588966ybr.50.1690258879241; Mon, 24 Jul 2023 21:21:19 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:18 -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 v7 06/31] mm: Convert ptlock_ptr() to use ptdescs Date: Mon, 24 Jul 2023 21:20:26 -0700 Message-Id: <20230725042051.36691-7-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725042051.36691-1-vishal.moola@gmail.com> References: <20230725042051.36691-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 236E98000A X-Stat-Signature: bo11pmad6uzfrkuoc5qzcakmjug7r1rx X-Rspam-User: X-HE-Tag: 1690258879-649339 X-HE-Meta: U2FsdGVkX18u6ruupqFa3upMM5LDzdKkkkObvBX1dQHKx7QuB8A1AzqAXgTSWHw90i5qCcJPHF47gTonKhCEf4uYlCilRnc+bpEnCl1k9FXlrBjnXcrF5M5/H3EmbvNfgyPYAyUKQizTeDORXM8H/9cy72ox+KNR06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Q5pGSvaDVAjLLOQg1uWBXFJDdgYJt79rhcx1hzj24vFC79oNUQbdiaqzVSf32wervWRA8xkBC5nXhHYQGhcYUmjoxfi2Jk+4THb+CYnfcM4zRiC3V8AW8oRPZB4Urwln/0mp5nRdcSgOxEzzdk5aNiT7fXb1MO9MVro8WavXyu4BHilsZQ+vt8rAPv8eMb1Ao9/Srg5VMhCQuPpry7NFK7Eabzmt/F+hHNyy6ZEEE7AbI+QMlDLESfkr5d1GZY9Chu4LHU79sW58dw9l1gXlGTD8B87LatVHH972rK56PaEnoYIPAn/bX8QRsTiALzaOFHRx5M4AphMaTsi7Wox356FFB/lmo/L7YoxTZhXP89vFStssHFQ9sSJAFp5qCACoDD2ZSRQs= 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 b3fce0bfe201..c155f82dd2cc 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2844,9 +2844,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) @@ -2862,15 +2862,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) @@ -2885,7 +2885,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; } @@ -2971,7 +2971,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)