From patchwork Mon Jul 31 17:03:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13335113 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 44277C41513 for ; Mon, 31 Jul 2023 17:04:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AC4846B0178; Mon, 31 Jul 2023 13:04:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A71DF6B0179; Mon, 31 Jul 2023 13:04:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8EAE36B017A; Mon, 31 Jul 2023 13:04:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 7EE166B0178 for ; Mon, 31 Jul 2023 13:04:09 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 5A962160A4F for ; Mon, 31 Jul 2023 17:04:09 +0000 (UTC) X-FDA: 81072529818.20.7549D20 Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) by imf11.hostedemail.com (Postfix) with ESMTP id 01F234005D for ; Mon, 31 Jul 2023 17:03:54 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="V/96hykn"; spf=pass (imf11.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=1690823035; a=rsa-sha256; cv=none; b=T+CBVQonvKP+SNY/P3Zj09JX3Az/gx+awTnio0FoP5nlfLoWNgBGqB68XZh98L2F7trnsy z9xfhs3o+QxkKyYrO0GmyTybb7aaT2r2SZEpB7jJZuRi2W3Rd3J74tun7J3dbDJVRr0eJL o33/wZHYPf5mt54HZ2bcrb/jhMndoRg= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="V/96hykn"; spf=pass (imf11.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=1690823035; 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=iy/rMhqpUcv/05FOZn+4srvOxwPFLEA5us+pK4Rb6lw=; b=6fLQEtJIyZPFJJ9s/wNawuNwvC8a74GT+zeAjXkVLj42lOZPD8T2cTbJwzjMIJEpmmsg1Z GkvhgqQu7JTmnQc/VuggIfqjXL80chyW7aPSwIptMMvn5bX9QzCKH5fswKJBPMUR6o16Np 1vyZ2g+hxQjbLzts53dVb7TXaySHtUU= Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-bff89873d34so3787007276.2 for ; Mon, 31 Jul 2023 10:03:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823034; x=1691427834; 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=iy/rMhqpUcv/05FOZn+4srvOxwPFLEA5us+pK4Rb6lw=; b=V/96hykns8XVM5vLmRXG/u4xSypUgGiGwrOyC+rZQj+rcZ/GpgCOArv+BLqwnK6ndI s6FLSAxMDlFyUBDNQE2VhRek5g328y+/ccd+AsCeEjwXU0hVeTp7lQbn+jR0/Talq7yP X53eA6P253fr2h0Co5LkgUqrydVRI6I/ApD8z89cYAQIEmQbjgDCE+0t6nBNrgVReKu1 hKceHGETSaBcw+wqVyp5iupRKeJkqfupmvumPfxkbIwnP/D5j0bL4ZMnmoLVvjw3thur HGuYrC1zSSdz4NYzQoV0QVVrCZG7E5Ll8cUs/PSqUH3UyhbWaZjmYOzvlOZrxF4wqCJv qIEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823034; x=1691427834; 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=iy/rMhqpUcv/05FOZn+4srvOxwPFLEA5us+pK4Rb6lw=; b=E1dppH+h7H1LPStPmn/RnH2gUMSpuTe0OKwZrPviU2rwHd6pw27PQdbb0mTiFM33gm 6yZQM6+zcT5YKG3PD/00VL200tbe5Hf6U9/RIdQUTzdlanBTZugkhOUne8xF8YxVEzr2 BZyx4SzkmIBY7P3rMPe7AFgc5gx9ZrR5XkQ9GEfFiV3OHnKLaIOt7u2frc7QYmsUklQA TptKlQCq4BvE51c10BRUrRZuWOU85LHyMZUC2uoOvIdIoG0knx6CtsYuE6gQIcx8FRu1 wzfC20q4eGsGIIx9EY/temhMGssnPAMQnX6jOIMTPWa0pNekIzTUNfBC/fzE7MtYGsT+ 0nIA== X-Gm-Message-State: ABy/qLZ7NKddjscModK0V8mGNEpaN9FNYaiOVFG8fHMaF3WvZpDX+UrR azuKFtMNT4B/4Jf9eU6+ywc= X-Google-Smtp-Source: APBJJlFl3cMRdcyGTSqylTcgbFymQPUIeV+vjMCwSs3kC0GtKDKYI1e8i0USnYA5QForqJcTrXzM0w== X-Received: by 2002:a25:908d:0:b0:c67:5aea:97ba with SMTP id t13-20020a25908d000000b00c675aea97bamr7117064ybl.50.1690823033777; Mon, 31 Jul 2023 10:03:53 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.03.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:03:53 -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 v8 08/31] mm: Convert ptlock_init() to use ptdescs Date: Mon, 31 Jul 2023 10:03:09 -0700 Message-Id: <20230731170332.69404-9-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 01F234005D X-Stat-Signature: xnjmcmfr57idrpwep3he78ytm6ke9r8k X-Rspam-User: X-HE-Tag: 1690823034-874908 X-HE-Meta: U2FsdGVkX19SsyJi9C9PWeyoq1C+Uy2G33SkXSBme4nwmq2kQEy02cTs3TB/zuWfY2y2e66rSGcFzKis1ieQ2IAQxwmTUCyrijAifQXJjXq5GJeUnA90kqzuJUyOuPGmNxAWxiKrYD6zmronvfgvsPiTucnKaZW3cB6IvGSjgnuNpwwLrS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AFINYiS5dQvARxmhlONMeK5zDcGM/AtRNEX9/MP7qtGFfPSMK1uuA96I7LV36xHzREhKdi+B7sgyxDC5MKZPxNfA+2t5RhkZfGfnL/amZgMD2fkhUdQ+MrCVTETX1HqLs0z+41TPLISB0EZH0OJEnTKUOmPqYMoSlYytoIsTE9NnxbYBsCQNKpfT0RmjK5h32BXHoKFGGRXyfAii+gLeBVztngrP20gmddGiksHAXwHmnpSRXihU+jR8tLjoc+sP2K7JCtsKSWK2z1Br989tuwol7RYNua3JcX2vfLMGbnL+6F71WvortcxnrI6D//lVpvyD8dVcOvs/UZf4g7Bm3eaVYNfbWo3u8iRhsA6KI0G6gbNpXhsoZrrRHqE7vWXpWgjwEirU= 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 52ef09c100a2..675972d3f7e4 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2873,7 +2873,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) @@ -2882,10 +2882,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; } @@ -2898,13 +2898,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); @@ -2979,7 +2979,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)