From patchwork Mon May 1 19:28: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: 13227929 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 60E3DC7EE24 for ; Mon, 1 May 2023 19:28:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 718D2280009; Mon, 1 May 2023 15:28:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6C99C280001; Mon, 1 May 2023 15:28:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 51A73280009; Mon, 1 May 2023 15:28:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 459E7280001 for ; Mon, 1 May 2023 15:28:51 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1EB971A07FF for ; Mon, 1 May 2023 19:28:51 +0000 (UTC) X-FDA: 80742673662.21.3BFD4B6 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by imf13.hostedemail.com (Postfix) with ESMTP id 44B982001D for ; Mon, 1 May 2023 19:28:49 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=PY19zV8e; spf=pass (imf13.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.180 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=1682969329; 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=wHprEtJ9ence/xzqPBz4IJf2z5UW2zl5tMMosQGe/i0=; b=ifJSKbUYLZrurUc0r2BXkg4CCN00TBdGVoDNbo6ILqCx5JEo5Us5WY2Z9yNFty9Ur7eesd 6YEPFpMPXeDFe3Jkz/taxJ9ldIZDg3Lwo09/xDSvhPQ0KwtSorzQkobiC5EkGf/VKqPj8I ya6YNZCxt6Q9g4PJfw8qx9xgQFmYr7w= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969329; a=rsa-sha256; cv=none; b=68e7ztmBU7M8gze90daFWxcalwKEZLxhgLsTOHwWAvW7MnuRl/9ffv1IS6JFxCRL1o+Q/D Vus/FpnO6Q6j2WqlIQQcaiBfZ4ckKo8TYWiLJ9hM1yhcj+KBWYpYmRHADENfCw6hxGBbWl TZpRpxLh86IrqX7tRw+ANa9jVz9KY58= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=PY19zV8e; spf=pass (imf13.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.180 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1aaff9c93a5so6141005ad.2 for ; Mon, 01 May 2023 12:28:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969328; x=1685561328; 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=wHprEtJ9ence/xzqPBz4IJf2z5UW2zl5tMMosQGe/i0=; b=PY19zV8eUjDo/XMGG1Fc34r7BzCEZH74vj9MdJuOaMu+i1F5EHabpfUbH5/UkV5r7u xDPodd9s+AIKUKlEgX8AIGrVTqPfTCCV19VkI5iB53+1hWJANYdEVCUSRnMghYWfpO7M cjlz4mTJKg6lVp3kGic5xzqQRsLBSUE+d02rlXiSiKdYRR/2g0lktCdvpXk87E+WP0bW PyWsq2WmVkZLx+/D9I3aZnTNSq5u2Ks8EcfSEB3bP53mV0saqVpK3cKwl8Vm7ptPZTKs sMCaD1Y/vK3rtRXkw0c64x6M8sUBtgZ+i4WFX1gLvu6Qtr7y6/c6crVIx9ttRb0VBr94 CwWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969328; x=1685561328; 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=wHprEtJ9ence/xzqPBz4IJf2z5UW2zl5tMMosQGe/i0=; b=RCGdfCR31QTo0Sa/TClYrHORNGsdZV5/vcZSCyRm23I+XlJx0EsQ7e8hbiD6fAgIoO etaVlIC0OmaSmhOXIOJjVKZ9yRyN2jws3DTfp2uyDgdQ5ICQ8oGvgdNya7inZ02PELU2 90iZaHB35rSOSihGDlIVJMfMpglsDekgaHSd9HY0bEFFmtAWW+rs/lhigGpLLMZNh/t4 Z4HNSibjXctaglcYaXR/veBIy+9g62Fa8//gE7j0Ye+E8LfINVd3wWwfIgnIeRDBh0BI pYmQ8UeZpgqJkZA0A0PyNZxOUZitehHvJWkoPCZ6YhC1WtvMexbYGGAL5K9PnCAF9TJI O8tQ== X-Gm-Message-State: AC+VfDzpLM0ay467h6PEwDKM/IXkyQKpfMf3naerQJpSYbsg6wbYcwrG VIX2BlXQdEVj9hVzGmOltqk= X-Google-Smtp-Source: ACHHUZ7Z//gnFWu5Wh7IVebCi2ECb1TkUFb7V74C+bMLVwpZ6jGbtiv1kPkjLZLQcQGCrs+Dltn26Q== X-Received: by 2002:a17:902:c745:b0:1a6:6fe3:df91 with SMTP id q5-20020a170902c74500b001a66fe3df91mr11845223plq.50.1682969328214; Mon, 01 May 2023 12:28:48 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28:47 -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 10/34] mm: Convert ptlock_init() to use ptdescs Date: Mon, 1 May 2023 12:28:05 -0700 Message-Id: <20230501192829.17086-11-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: 44B982001D X-Rspamd-Server: rspam09 X-Stat-Signature: iwmkubp1iuo9wrwx91w5w4zqjydkzci5 X-HE-Tag: 1682969329-380423 X-HE-Meta: U2FsdGVkX18V1nNIs98zZgX/wJ6BQzkzwspdhuRgAnzl0MUjHOL30J6dEj+xc5tbFw2PqYKj09EeGLC5kKoZJISv4w50AN3gHZ0h/UFspkHvbpxcxJcP8OSEVc0as2iWOKqf1An/wdkL5FeN4XcizhaBOHRPpnGxxBI/+Ch2wnjfhPmOFCLtbV4XsCo3IVz8XcT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IEWEzO5daZ6mTYRoR52rBZ7JRLT7QehjhIZR1hGQpk5HVl1inG4FjcMCrLE8dFni2TpsCA0zI2f1LCmR60wwLSfS3n/0XHUgbqH2OpvaSzj80Q5NnXVTi8t3LvwGCJhAmpMmWfbJo3tEs+98m7GfcxXRvOzAYp9tNm+zjhIYFQePBjMPXAbiPDKW8x7hHKmh95HxYBiwYWURQ+K08AGnmREeGKK/Atc3WLyjs5JBS7rIAd3jnMoCZNKf1xfslNogbunXh8ng7GbGTj9SN/MxxT9xmSJG+vyFkwyi8u92qoc3ajn9eSn+35BK9f/XkX/M+28H8= 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 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 044c9f874b47..bbd44f43e375 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2818,7 +2818,7 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) return ptlock_ptr(page_ptdesc(pmd_page(*pmd))); } -static inline bool ptlock_init(struct page *page) +static inline bool ptlock_init(struct ptdesc *ptdesc) { /* * prep_new_page() initialize page->private (and therefore page->ptl) @@ -2827,10 +2827,10 @@ static inline bool ptlock_init(struct page *page) * It can happen if arch try to use slab for page table allocation: * slab code uses page->slab_cache, which share storage with page->ptl. */ - VM_BUG_ON_PAGE(*(unsigned long *)&page->ptl, page); - if (!ptlock_alloc(page_ptdesc(page))) + VM_BUG_ON_PAGE(*(unsigned long *)&ptdesc->ptl, ptdesc_page(ptdesc)); + if (!ptlock_alloc(ptdesc)) return false; - spin_lock_init(ptlock_ptr(page_ptdesc(page))); + spin_lock_init(ptlock_ptr(ptdesc)); return true; } @@ -2843,13 +2843,13 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) return &mm->page_table_lock; } static inline void ptlock_cache_init(void) {} -static inline bool ptlock_init(struct page *page) { return true; } +static inline bool ptlock_init(struct ptdesc *ptdesc) { return true; } static inline void ptlock_free(struct page *page) {} #endif /* USE_SPLIT_PTE_PTLOCKS */ static inline bool pgtable_pte_page_ctor(struct page *page) { - if (!ptlock_init(page)) + if (!ptlock_init(page_ptdesc(page))) return false; __SetPageTable(page); inc_lruvec_page_state(page, NR_PAGETABLE); @@ -2908,7 +2908,7 @@ static inline bool pmd_ptlock_init(struct ptdesc *ptdesc) #ifdef CONFIG_TRANSPARENT_HUGEPAGE ptdesc->pmd_huge_pte = NULL; #endif - return ptlock_init(ptdesc_page(ptdesc)); + return ptlock_init(ptdesc); } static inline void pmd_ptlock_free(struct page *page)