From patchwork Mon Apr 17 20:50:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13214570 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 CE732C77B7A for ; Mon, 17 Apr 2023 20:53:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B55E790000A; Mon, 17 Apr 2023 16:53:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AB490900004; Mon, 17 Apr 2023 16:53:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9564E90000A; Mon, 17 Apr 2023 16:53:03 -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 86920900004 for ; Mon, 17 Apr 2023 16:53:03 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 47C151206DC for ; Mon, 17 Apr 2023 20:53:03 +0000 (UTC) X-FDA: 80692082646.25.E289C4B Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by imf30.hostedemail.com (Postfix) with ESMTP id 7B1F28000B for ; Mon, 17 Apr 2023 20:53:01 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=FTIIrhTe; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.49 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=1681764781; 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=Hc0m/U8RaSqOAaIvHe2pZ8la6AwQPtvql1ppirfWYYQ=; b=CbBw8SweAqsaScsQrS6e71PMkuULXEgn5W3S902B1HAEMna9TU4Ku5CRyZv1fAx88mzsoM YXh7sOlDe4OIK5Lj7kx0iwk1PHpPBuZtUBhqUOMcMq5OMth5SQc7QA/c70g1CGL9/EoZ9Q UOvJeAyqb7nDehHZUQuWwQlq0CuC6m0= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=FTIIrhTe; spf=pass (imf30.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.49 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=1681764781; a=rsa-sha256; cv=none; b=MJq8ctvc8tm9FNoZN4IkZoR7YGqhpmuLESi8Ir65yq5o41GJ7gMbnVUy5wRQO4yJeva2G6 z96W00LnF+pCKLgdgzTvyYlVFvaLvgYI8u4G6Qo+X2Vcl1xo27g3H0NLtHyf0DBzXUcY95 iIJguDmMbe4XL4uOC5kqONPTjMvOfK0= Received: by mail-pj1-f49.google.com with SMTP id kx14so7222701pjb.1 for ; Mon, 17 Apr 2023 13:53:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681764781; x=1684356781; 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=Hc0m/U8RaSqOAaIvHe2pZ8la6AwQPtvql1ppirfWYYQ=; b=FTIIrhTe8vfWt4jgLQ0zryZ+NfsJ/OFhYpHyrwEJjHtN6fYrjayv1wmbuEiWrZWNBG Ab6oC0JEVFKaVtr5ERs/HGyia4m0cuJPp54Y6qKJvGxwoWwnKA3jL+mq6GAMCgFGvFWn bEbIp/iuCRzaSQasJ9iYfHsEIZ8C5L6UBjIsqJjVLRNCdj3wFA0VCJaoyvqsQShlPxAr nn14k2m42+J6xR2hfl2ffw8tFItkZsF+DKNsuBC18vZWoMB4mE4FcDOZiJ4pqP0DqYky PjLPxBMY5gAsTXZg/iGvnD4lxFGHfkuFymQLt7EWHTlIBpCDY+iSj33ZpMo6EFdNFztz HYrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681764781; x=1684356781; 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=Hc0m/U8RaSqOAaIvHe2pZ8la6AwQPtvql1ppirfWYYQ=; b=HFgR0OfLf1Er0VcyeO9+loDBs/dogp4NOEcNc/GUvW35lVGZf9bsblvyTzkl741MAy nrSj9beNeHyfIGm2yydwy8TrMl+YJJR05tcCn8L3T5CazTs9r6eISlwb/YzZ2Ry/8UPB /hMG7KZtHVTHoXOCNUX9nsHIW7Jm6INArlLRDWfwTvVnCmUpL3U70D41J92+Wa6VqFOL TFQL3Sc4qXklSx2A6pLgn+g410nNN1ZUaIkwDZy6oKYEKm0uoL8u/Zp0n2EgGYmREcsr vSQ/+HQAKIEdEN/H7HinSb73u9zOLyJunlvzYTZOK8Z+coni8DipLl38zx0NctQt6hK+ 2NlQ== X-Gm-Message-State: AAQBX9fnYXS81IBNlMJun+/4H74CgDJdvs2IbfZLyojxXhdstu2QLRpW RIhkNKiRBKyDfwk63t3Q7wE= X-Google-Smtp-Source: AKy350ZMofF2taT9lCtSfGwXj3mTLikp6R4dNTLL/p579XSegIqzslR/71TUEAWTkG6EWBZpLey91g== X-Received: by 2002:a17:90a:d143:b0:23b:2c51:6e7 with SMTP id t3-20020a17090ad14300b0023b2c5106e7mr16554327pjw.21.1681764780697; Mon, 17 Apr 2023 13:53:00 -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.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 13:53:00 -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 11/33] mm: Convert ptlock_free() to use ptdescs Date: Mon, 17 Apr 2023 13:50:26 -0700 Message-Id: <20230417205048.15870-12-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: ria6wfar4zftc3e6xh44714ebw6qtdz9 X-Rspamd-Queue-Id: 7B1F28000B X-HE-Tag: 1681764781-89734 X-HE-Meta: U2FsdGVkX18CCruIihucx4u2Pop/xyg1UlSkfhpSyxgrUzQYdIjnWE+9S8p803YS08G4wMcVxi9RA7LclBGHpZ5MUctluejZ29BC0AlofZMb9WLkf8TnCjP9jzOw40nlKakq0zlYtKPqxUrVOt82qI1AO0WdvySFF2yw4v6L9SR8C1J4yAshlp3CmIfS5BUPojHI1Lx7arElU+YW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T33hIOou1GFuYRi8/3H8eFoYlqIWT8mReJQ6/TE/TjEGL4Na9ie8juJLfkTkwIt5dDDnBfLZ2fMTmHL1vsLxhcn2jWWUOwy3uU/EyidcJkJEOpGiugUqwshFJaLPIBL6guXWtW2XGYfDXXyag+G1osSIzyux4PJFspWAdrDuIla87zDGGSK9R6KcIyWvMR3mIamchbCsboEMMJssOgi00+vwmpzXJY4mcczP4z0EDDuH8dxiqZyp7Df0DLGR21VD6Hjs7kxBme16GFxSzIbdfvHKPplBunaKuJLIog== 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 | 10 +++++----- mm/memory.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 2390fc2542aa..17a64cfd1430 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2787,7 +2787,7 @@ static inline void ptdesc_clear(void *x) #if ALLOC_SPLIT_PTLOCKS void __init ptlock_cache_init(void); bool ptlock_alloc(struct ptdesc *ptdesc); -extern void ptlock_free(struct page *page); +void ptlock_free(struct ptdesc *ptdesc); static inline spinlock_t *ptlock_ptr(struct ptdesc *ptdesc) { @@ -2803,7 +2803,7 @@ static inline bool ptlock_alloc(struct ptdesc *ptdesc) return true; } -static inline void ptlock_free(struct page *page) +static inline void ptlock_free(struct ptdesc *ptdesc) { } @@ -2844,7 +2844,7 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) } static inline void ptlock_cache_init(void) {} static inline bool ptlock_init(struct ptdesc *ptdesc) { return true; } -static inline void ptlock_free(struct page *page) {} +static inline void ptlock_free(struct ptdesc *ptdesc) {} #endif /* USE_SPLIT_PTE_PTLOCKS */ static inline bool pgtable_pte_page_ctor(struct page *page) @@ -2858,7 +2858,7 @@ static inline bool pgtable_pte_page_ctor(struct page *page) static inline void pgtable_pte_page_dtor(struct page *page) { - ptlock_free(page); + ptlock_free(page_ptdesc(page)); __ClearPageTable(page); dec_lruvec_page_state(page, NR_PAGETABLE); } @@ -2916,7 +2916,7 @@ static inline void pmd_ptlock_free(struct ptdesc *ptdesc) #ifdef CONFIG_TRANSPARENT_HUGEPAGE VM_BUG_ON_PAGE(ptdesc->pmd_huge_pte, ptdesc_page(ptdesc)); #endif - ptlock_free(ptdesc_page(ptdesc)); + ptlock_free(ptdesc); } #define pmd_huge_pte(mm, pmd) (pmd_ptdesc(pmd)->pmd_huge_pte) diff --git a/mm/memory.c b/mm/memory.c index 37d408ac1b8d..ca74425c9405 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5937,8 +5937,8 @@ bool ptlock_alloc(struct ptdesc *ptdesc) return true; } -void ptlock_free(struct page *page) +void ptlock_free(struct ptdesc *ptdesc) { - kmem_cache_free(page_ptl_cachep, page->ptl); + kmem_cache_free(page_ptl_cachep, ptdesc->ptl); } #endif