From patchwork Thu Jun 22 20:57:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13289606 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 A0CACEB64DC for ; Thu, 22 Jun 2023 20:58:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 43C888D000C; Thu, 22 Jun 2023 16:58:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3EC348D0001; Thu, 22 Jun 2023 16:58:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 28E9E8D000C; Thu, 22 Jun 2023 16:58:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id F00F38D0001 for ; Thu, 22 Jun 2023 16:58:17 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id C19D41A04EA for ; Thu, 22 Jun 2023 20:58:17 +0000 (UTC) X-FDA: 80931596634.30.5FE908A Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) by imf12.hostedemail.com (Postfix) with ESMTP id B880F4000B for ; Thu, 22 Jun 2023 20:58:15 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=HsKWFMjg; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687467495; 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=uRcW1jW+95PozpJhE7MOWGztyyXp9a8KAqI8T3AvQGQ=; b=8IKeMYIzKy33QoKtvNjfMBeazKeDBhQmynsqxO+xuNle+0R9Ih9zfjXYGE50CoAXxH/Fzk U6pVxlCscEptTU87QNvqNVlhWiEpeUXO3zEwd6M87Uz86/L9pHTKR7vZM0QX6tD8N3BNn7 2SsmTAFd31zp/9V0/gf40FOVdSiKN9A= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=HsKWFMjg; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467495; a=rsa-sha256; cv=none; b=VNN4RWFKQ51YOdpoSAp7VLJ4pt3k7i4rOlxV0YWC2QjjEl7uD2mJbz+T3ehygUPC8FhL5J 86JBKLdRJowhH/1WclF8q1imTf2fclAgYD8CQmhpD8MOZg3KkE9gd2CmPDZXcnPpKCb8Dr GBrb/FxkHWsksPnhVFM5by9aX7JH8Ww= Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-bcde2b13fe2so7398476276.3 for ; Thu, 22 Jun 2023 13:58:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467494; x=1690059494; 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=uRcW1jW+95PozpJhE7MOWGztyyXp9a8KAqI8T3AvQGQ=; b=HsKWFMjgc4nubz/CGqFDPycebn/IPCG8iEQx6Mn71pJrvZNcRYxgpmqqwFpryLpJLe U6CGU7xvBFlirMshzGg8T6i9YZLzGTtKn+CcBm+t56pm6lJ3TVyGOGzuaYqSKVupajIy 2DQcn5crUg65j6RvjiPUyIXYF96jtw4qqx3rhyDnmY0a3BGeHq9tpmXxMVnvgVEpyfbE yzd/PSl+jlwziFt4f/K0ChaqSr0HvoaTl5CqhIJz/dAvHyE0NXDWuGcwuqDlT7PKZ2aX gZRI6eIDsk4xWFnXPJdwPbiPss9pl0UJqOUtsNLHKXkhccURxnMshNZ4JT+gJbW9Nc9s Wlpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467494; x=1690059494; 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=uRcW1jW+95PozpJhE7MOWGztyyXp9a8KAqI8T3AvQGQ=; b=SbT+C5iuXZCYRJUnm6+wZp/u1ePTydLwFQHlCrKXqLC88YN9Mysy82zAZWybgzfTD2 ZSsJi1UuBhjpLPnwINYsKEkJ8ooihDOXfoD5dqUBuveSgwfCnoiOeCNLc0Q3PKkgPKbn voziTG4Zy/g8nUfiPHp/7hBF+DngCs0uGqONwJxxAy6CHF60DJDUjlef9LcWfRY5Wtvl 700omFIiIiGn16CVHTRIlC+xD0O7KnO4eWXig0W/2s6Ggqdb0PmBo1p5jeR0XvYS9Nrw VpyDf0mJ+r7PKTiNg90oDZvMSJ/g/yRWl7KjgFON0nd+sysUaxuoLOtFGZQpFF6k0diT W2lw== X-Gm-Message-State: AC+VfDzuWcw6ihdnayH49uD12i+Nd3hWboWG08aXjsjuqYOeHdt3+F5H 5XRtVy6ntsGSZot/Ikp/aiU= X-Google-Smtp-Source: ACHHUZ6cGkwHgROFidQ6wg7SrcN0EGNFb8Fy55CY8QeCStx6HVI/iqe9yVRaoh7RjiWHDP58CRtZwQ== X-Received: by 2002:a25:f902:0:b0:bff:209a:9034 with SMTP id q2-20020a25f902000000b00bff209a9034mr4880542ybe.22.1687467494535; Thu, 22 Jun 2023 13:58:14 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58:14 -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 v5 09/33] mm: Convert ptlock_init() to use ptdescs Date: Thu, 22 Jun 2023 13:57:21 -0700 Message-Id: <20230622205745.79707-10-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: B880F4000B X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: e5opcniiskrhk1tuxyz7f9cj1ze8opxg X-HE-Tag: 1687467495-814385 X-HE-Meta: U2FsdGVkX1+QPZfs/B0VAE0SWKx8tUgZ+1Advrdxw2m74wWlhwzQXIBXu7y3Lcguri8wa8C4Q53QmcbbDg44w1kCsJoKH2FPj/fXYLaXj/+ISrRD8DRPBzHNMEv+NKiwwdPT9S1hY2m6ddk5by3tHK4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Q+q+nQHKOtRJSULYVy6a4x+g16Gp7i1hTZtla0PG4KSFKFk1Go5SwuFLpdCFeTorOZr+JQAwfxujR6vtwvWhMrqO3mKi7mgSN2hcMnekE1hmMh43yIS2/PWgGMxSjZUwIfQyqfIFd1kZgLlLw462fUHYwlulLGiak1gNL+UswitkC4W+lp91ozPZ6IMT0KZOgB7ZOV9jBfiFMFMkFSJJtai3Fxxe1r9CUviiHAewUK8x7Gxns6e6NqrpoW16fyx85LWYx+YTFO2Ckq54/PWUWxa8T+iwEATv0gQePVbZT+UJFDOSPT06wZOmhxJmrmQ4E4NUznTybm8lW/rQFGSF34Kpen0s7KeJLyJSNfTAfchjXvxcMKJA+fhVn2IcP5+wIA4jTCpcGzNxX/rV6zwKqkz10nG1/+TT+mZSZSV49H1AgIkVbM0TcXFQT5vdvANVlKk9GUetGyZimr7ekB07DxzCA== 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) --- 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 1c4c6a7b69b3..4af424e4015a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2830,7 +2830,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) @@ -2839,10 +2839,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; } @@ -2855,13 +2855,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); @@ -2931,7 +2931,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)