From patchwork Mon Apr 17 20:50:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214568 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 88C52C7EE45 for ; Mon, 17 Apr 2023 20:53:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 736A7900008; Mon, 17 Apr 2023 16:53:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6BD0F900004; Mon, 17 Apr 2023 16:53:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 55EBC900008; Mon, 17 Apr 2023 16:53:01 -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 43D73900004 for ; Mon, 17 Apr 2023 16:53:01 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0072F80595 for ; Mon, 17 Apr 2023 20:53:00 +0000 (UTC) X-FDA: 80692082562.14.6920354 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf07.hostedemail.com (Postfix) with ESMTP id 372DD40018 for ; Mon, 17 Apr 2023 20:52:58 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="I/h1pnbY"; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.179 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=1681764779; 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=X2z4+jy2VvwYGAEqDadtXD4/9gzlnrS5efeNMpJ5P9k=; b=3SZzDsisBsqZcB6I39s5UTa0mvKMPaEppBkojD+QqFz5+iW5avy2agDX1+lYxaRYdyqx+Q VHvjC3vCSbn0QTDPZxqM9mgRmyWQEfTNG5Gorjt14C/H2CqfP1/rMSGlQ/a+qSdAgUNNYL Z0/WjnjWhSotmha9vMCqXiNnAWUwz14= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="I/h1pnbY"; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.179 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=1681764779; a=rsa-sha256; cv=none; b=od4BklSLviqMzevu6PHlayMbfGvbJMy83ZkwuHsitvzVkmyrxxWlg+i6ohNT3Miso6hPGx ZXF/GXuBQ40LMk3nftVs5WZdg5EmpZzZvfqPjS+rjwe7WtaLAlDGa4Ff3rj+G2rXzKbyY/ ywcV1ING4mtR/gujX0SVrZOlCT12GmM= Received: by mail-pl1-f179.google.com with SMTP id w1so4513451plg.6 for ; Mon, 17 Apr 2023 13:52:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764778; x=1684356778; 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=X2z4+jy2VvwYGAEqDadtXD4/9gzlnrS5efeNMpJ5P9k=; b=I/h1pnbYM2DwgRZCSJteD0jcjPogajwYvoNTWu05FIt8Dug2P9e0wRrWLPxc4zYyi2 bF+AVTemVcp3diPO+7OSxLM72RxW/MppC8vSDXDjD8liqzM1pBLkxoUoebzionO/oxsa qHKGIp7d97W6jlem/3yxXQy6r/jNX2Q0ie6VB85Wwsz/8JpbJnzPVNlM6MFS7XC7iPJr OFMLKNx0UPHxfGtNqDckarA/92oBRif46FzIncuYkpkQ+fhRc09HfBoH8I7mBRTJiPxj c4VsiDutZTNuFgmpjh8q1KLiugVszPA4Gaz711F805EB6LUcut5gmvOb7RYuzrO1w3sO Wqsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764778; x=1684356778; 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=X2z4+jy2VvwYGAEqDadtXD4/9gzlnrS5efeNMpJ5P9k=; b=iuSHQetBQDwLjFD9uYc8xhatDl/rpjnjL6ECY3wdASHr4OuPcsvTqPoq0+FLMroIjf E5JSEATT2CT1nswvTr08lD0wX8K2gKZvkdeCBCVkZvabFJxhU2RcRlsA4G32hbV379GS 7T+TeslR+x9VrHC/QtwJbw9cIMulCqAKVOnLSND1DmleM1H4IR4sNZGRnbQNIOa5J/qF l1r3Xr0ddAk5ZFf0R93SgrQlvVVarnnjo8+qWSix/atoQXBCYIYzu7JAsnVLrgx0UuY1 cS2tX7AvfOL73iMGA3DMA2IFK0yicLzqB/CpuxiHEy0Q8QnXK4fIwg2R5v27ASocF5li CDJQ== X-Gm-Message-State: AAQBX9dMZf90cJ2SjreFkKmHGF6lZB2XZG9admpPHhE/nluwPjmDh5xT 8SY+ASPCXKU1bZ6TeSurlQY= X-Google-Smtp-Source: AKy350a6Xakm9Y4oYLvOvIWfyGM8BNUM3uv3d+WixCRDkQ1rcDDo2rZhVhsbndThyou7yfhT1XyHRg== X-Received: by 2002:a17:90a:8a04:b0:247:14ac:4d3a with SMTP id w4-20020a17090a8a0400b0024714ac4d3amr17877854pjn.20.1681764778063; Mon, 17 Apr 2023 13:52:58 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::c139]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm7609707pjt.22.2023.04.17.13.52.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:52:57 -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 09/33] mm: Convert ptlock_init() to use ptdescs Date: Mon, 17 Apr 2023 13:50:24 -0700 Message-Id: <20230417205048.15870-10-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417205048.15870-1-vishal.moola@gmail.com> References: <20230417205048.15870-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: u8ak93a13r7hxxeg8dekdtb7977jyuce X-Rspamd-Queue-Id: 372DD40018 X-HE-Tag: 1681764778-183561 X-HE-Meta: U2FsdGVkX18Xl8R72Z5Vv323DZUp1fIZizTypCpi8QLfuHJLQQBE8wR+KnC0Q6L/cpKQEoo4DtxJnfnDfd2M0KtoFMk3LsdjWmDxR9RQosqclZelKeGr+4fteyjVm2BKrMwNT76asoMsIOcQ2FAST4U05n9OEO5on0sljeN87ormfqJPpLgxocpXG/npXX7GvjFAvftdRmcFCUTSlY/CZGyb0Mh4E64c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Xr+c16xyJfhlSAO9qqJXOFWMd8wZ70xxrQvOlzdIU/3W3EgckDDMUdZL/JlrY6yTdUR/m59n7h7fqQayRRFYgMZP4WtnVmnqPzOvAWGqSPUotH5OuSvI7YGe6dFvaoX5DLr8IfLNPLOJeBWBqBWGak/So62rURtC28ggpO22Fg/ucNUu+g1YjNXaC98+8IdSnsIfkDd0R5Q6J+ocLrRkO09E2FkuHgUwEWAb6wIXHPKoe+OYgnkGMsimtC0iLXYUq7wMwg0a767XT0nYAj5dRFMvijCDg== 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 7eb562909b2c..d2485a110936 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)