From patchwork Mon Aug 7 23:04:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345292 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 67317C04FE0 for ; Mon, 7 Aug 2023 23:05:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C105F94000D; Mon, 7 Aug 2023 19:05:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B4CD2940008; Mon, 7 Aug 2023 19:05:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 94DD994000D; Mon, 7 Aug 2023 19:05:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 877A7940008 for ; Mon, 7 Aug 2023 19:05:37 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 671AEA0BC6 for ; Mon, 7 Aug 2023 23:05:37 +0000 (UTC) X-FDA: 81098842314.13.5092C3E Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) by imf16.hostedemail.com (Postfix) with ESMTP id 80CC7180004 for ; Mon, 7 Aug 2023 23:05:35 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=doFuHRFv; spf=pass (imf16.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=1691449535; 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=qSt61pcnVgNBhKAHMe8eO3a6G9ChrNL9Px0NKJkznSI=; b=GjYumpcdvJtye0uwqvv/vikJv3VNqbyPZLU+MRI4R0g43v4ODR/21d5smrdQg2qKhtL7DA guapSCQ2UKV75IK0MXzc6xihSmI2vIpZArlkbyt563ETBmYDw42zb4xqoQ0D3veB7Rjz0L lbuyjyt31nrJ21le2LxPzUoC8W6yKDU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449535; a=rsa-sha256; cv=none; b=E30RQEOlsEt30zmOoOowdTk0g4E4fSh7W+JOw1ZPVhQq2IHQXS7npZdvVTtiXBLZYGhhdO Xw2qNctXcrTO1kpem9eiubH+VlnyGU5TWF1RUmtwECDXnqMqvy2PDj5Bt/5Zzs3ChHHdYr Z5Uu29J1wp64zuWb1/R9oiNBHZFQTZk= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=doFuHRFv; spf=pass (imf16.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 Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-d58b8d00d74so641559276.3 for ; Mon, 07 Aug 2023 16:05:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449534; x=1692054334; 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=qSt61pcnVgNBhKAHMe8eO3a6G9ChrNL9Px0NKJkznSI=; b=doFuHRFvbyMJN61tPnMQYXox+6stb50QdP4/3C93sFPuLhCWwxu1z+tfNZJ4b6Wpl+ E3E2D7c/fVsu9NK1PuuCIKOAph+/dD0UwiupTdpLzihtqamhwaXNn1+eSFxg36XE1nAW 9YCYbT+6Netay+dE7igP1FbsCv8QYjddLC3kVasHRyFjUe3vhlHJ5pPzAaFOmunT+EhT TypcY3libiW+1xTSZsvLq3CfCOXA2FWQUiU+MigDUHm3gt0TV6nV3mcKzhVGZgr0Qhni PeipZMs+ho2QZuOrtBA9RQFaTSU/S0o5wnK6eQ2hY8zhXlVshk/VfS/NqhE6JdbcRNTR jImw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449534; x=1692054334; 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=qSt61pcnVgNBhKAHMe8eO3a6G9ChrNL9Px0NKJkznSI=; b=P5VIzmQ0LrV8VdeWYySrcBmKSTZGufenI2vT3JipbwpEJaEZZFlvdw8BZwaAQjHJcz Pb0QGOi7YjZCrurVeAlT9xc72ERkrHxypT7HiR4mT3P0otk2/QTZ6ce9lucjG6o31lYl 6dR+M1h7h3sVDHR1YFDbgE+v07aPeG7l50rG75mlmJxQwkVrYvhxiN2DYJ2dDpZFwG8V C1B3n6ZZ5xLQyZM84VfnIYXBC4GtIUW9xVZTHZ9OIaez6JFNhKSPYGEyv4568afae/jk Rbzoh0EgblBlUDTLKHgEmMn2aZ6luMhy6wsv2+MaaXPb+mtYogGmfG3dTHtFlDl0h4/x WVHw== X-Gm-Message-State: AOJu0YzFJN1XquBuM8pRfdhL2T38DSSpPnYYY4KBD49+Fns5bHiXrh1q nSRBWH6pGzZccsgZYXyuGUk= X-Google-Smtp-Source: AGHT+IH78clSYv8jjRwrTCz7hdEyV6ONxxFaBIBEI75jS+XpTOJin8WaSgmj5CyKgW8Moog6FuLvdA== X-Received: by 2002:a25:4c86:0:b0:d0a:d15b:3b0f with SMTP id z128-20020a254c86000000b00d0ad15b3b0fmr10002278yba.33.1691449534448; Mon, 07 Aug 2023 16:05:34 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05:34 -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 08/31] mm: Convert ptlock_init() to use ptdescs Date: Mon, 7 Aug 2023 16:04:50 -0700 Message-Id: <20230807230513.102486-9-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: 80CC7180004 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: euxnbquqa74qz5nuqok8b95exzu1bx9j X-HE-Tag: 1691449535-901458 X-HE-Meta: U2FsdGVkX18oOHY6trCLvNPnX5VujFoxCSAdG4kJihIr42OwHfetfSeFYsfRXKHOoYR6FJzwxQhktGYrcJsgoWls50RQ4UGpQpKUXnxoEGwwYOdHjl0VhDbe6wvh1Al7VRa64UrXGEJ/LhYWS5QToQV8xyitOZSoI2LzUfB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HSUfd+ixk1sg3dIpyLHigDFZd8ZeNHjADlQVCd0NMTqsBVygDNjBqNOju2q/AFKWtOiPraIHqLf2+fdoCPja53wdxi5FTmwh5MQH44B9L9w1LjTkAJMbKIZbPuo23Pt2bXYz+5OA/JXVu9X4ENWdqOS4g6XJ5bLgqlvMrXy+cbDlmfOnJv978V5XEDIQuZkCcnGHk0x/BGbYK6Uc5p88kqNUvMkXbADDIrPSGSNq3mbB25+ybBthMdySVhvWb/LxI6UKgHUzbsYAjGTykM5kufv/xH47j+1vvnOXGiFxzs0Gz32lbJRti+DTtzrNbCZMaWlXM5TzoumHmI6yAI9CNGNaBbphbQf3jMxfNTF2GEPlD3+6hMXCADyrraNRI7FZefjWm9sZ2GfkPFLId9bNIzdaIJwxn4= 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) --- 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 040982fe9063..13947b17f25e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2892,7 +2892,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) @@ -2901,10 +2901,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; } @@ -2917,13 +2917,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); @@ -2998,7 +2998,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)