From patchwork Tue Jul 30 06:46:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexs@kernel.org X-Patchwork-Id: 13746739 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 89455C3DA49 for ; Tue, 30 Jul 2024 06:43:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1FE6E6B0089; Tue, 30 Jul 2024 02:43:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1AF8F6B008A; Tue, 30 Jul 2024 02:43:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 04F5C6B008C; Tue, 30 Jul 2024 02:43:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D869D6B0089 for ; Tue, 30 Jul 2024 02:43:06 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 5823C1A0125 for ; Tue, 30 Jul 2024 06:43:06 +0000 (UTC) X-FDA: 82395476772.23.ECDF4A1 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf06.hostedemail.com (Postfix) with ESMTP id 0F8BE180003 for ; Tue, 30 Jul 2024 06:43:03 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=EMNS+x8H; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf06.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722321724; 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=V0na607WtZKq9jFIl957V3oWGKmAxAbj4CzF+NzIBXc=; b=8C4uH/XnL4Y2LgtE+SuO0MxNXxpv6wTM9ASL2jpExMJ+8egz1jhBQQpETyvcY2r3sBCZXQ Vz9wCjz8E4d0rxXzhOqgjlx4w89xPLZVIGGTqwGAf5bxvDaQnEg6yxaFnrK/vUxzNlGgOd V4KwnTcESm3qsHEHGDMDB0MY1lB6lqk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722321724; a=rsa-sha256; cv=none; b=heTf8PsFa0WOeDWNUfPCFSI1Ok74UaScTD0+3XMwhqlOYYlUOh2AzXZIQ4sO07EKyLL55c b/WiOBjfbopSvGrKXiuThlN0ugNoCHPewsA45/yEK+S0//EZbmOEsdPHxQK+DfMdi07kkY aiL1v/vCxj6CoS8wKato/j74HlXA5Bs= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=EMNS+x8H; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf06.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=alexs@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 87D5DCE0E11; Tue, 30 Jul 2024 06:43:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD7E2C4AF10; Tue, 30 Jul 2024 06:42:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722321779; bh=gTArplwlUTbTCuHNeuVct9T0SiQYRSRnIpLhqPQ+rcE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EMNS+x8HI+8Q08E7NcZ4WD5BkiWh9xAxJgNUSeEC7wUsbadoC1FFu91tQMZE7Hy2S IUmoRLjOcThG09j1Sqjri8IS5v5L/GqTmjdQarB0bmky4bNiqAj/NZnJ7JFHJeD8eM xp4GUDXu8Pgl+WLlnMHA4AQrs4fRuuLAioV9xJyUj3Qfg+O5uVNHyjdnKujlXeeMze y4pE/ENss3Y27SBqOaPJvTM3lQjwDoA5fmkCORb6Q7jSG49BTJJjCdSyOBxPURAgT7 N7ujc9Lmfynti/YNZ3I4QClP7CXUI+TSJh/h+u7SmrhYbHOtbMTzdHI4QxlG3cF9IU WbYLxc+yhe31Q== From: alexs@kernel.org To: Will Deacon , "Aneesh Kumar K . V" , Nick Piggin , Peter Zijlstra , Russell King , Catalin Marinas , Brian Cain , WANG Xuerui , Geert Uytterhoeven , Jonas Bonn , Stefan Kristiansson , Stafford Horne , Michael Ellerman , Naveen N Rao , Paul Walmsley , Albert Ou , Thomas Gleixner , Borislav Petkov , Dave Hansen , x86@kernel.org, "H . Peter Anvin" , Andy Lutomirski , Bibo Mao , Baolin Wang , linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , Qi Zheng , Vishal Moola , "Aneesh Kumar K . V" , Kemeng Shi , Lance Yang , Peter Xu , Barry Song , linux-s390@vger.kernel.org Cc: Guo Ren , Christophe Leroy , Palmer Dabbelt , Mike Rapoport , Oscar Salvador , Alexandre Ghiti , Jisheng Zhang , Samuel Holland , Anup Patel , Josh Poimboeuf , Breno Leitao , Alexander Gordeev , Gerald Schaefer , Hugh Dickins , David Hildenbrand , Ryan Roberts , Matthew Wilcox , Alex Shi , Andrew Morton Subject: [RFC PATCH 01/18] mm/pgtable: use ptdesc in pte_free_now/pte_free_defer Date: Tue, 30 Jul 2024 14:46:55 +0800 Message-ID: <20240730064712.3714387-2-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240730064712.3714387-1-alexs@kernel.org> References: <20240730064712.3714387-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 0F8BE180003 X-Stat-Signature: cpqfcegqhondz3p4fksqjjztb7gz4hdc X-Rspam-User: X-HE-Tag: 1722321783-288743 X-HE-Meta: U2FsdGVkX1/AmQpObQuLiO9PnlioIDjHcfNy3mMPJ8KYjb3k9/HxdKJMYFi1Ev2CY3utiLkFC+BNRT1UKeR79DsQHHpWmRD6+pC8SQO88GjuGoJe1cEyZk/8OPLLxpntXcmjpXQN7EwnTEsBIGeDho2rzxr7B3BRIkzMaKHUp6bHIJgo24hVQLz32v1b+7Rb/+dol7Fvq38SAXBJnkgXi9YZkd6P2xAdOSn7bHSpgEw/3n7BBLMbsOZA2ChMqiCeXiDaP1zm1LDP4htqfHKpNkNLAxpKcGrXmNQIf+uqm1jqbU1n4Plq4uqo9BCrNMeWA41+6QCsFcBEAz2maniwCYvjJiLtkYUlDkSnynJ4+6hVPaaLgynXZSqcSOzutTo+brMLHNLDjiXOsAJD2N9k6NGtmlDD71DDGHTYAX9ecB30cermmZQg2/JRykB0TncYP/v2hv5q/jRlC1dkBTaLKBrtly6ANKfQLARXLOA9L7h8TZQU+baQlf3At08SYw92PwZoSHEyyndB/lCoaCV9l+AKGL0B2tt7kn/uKIZdyCpUJjUXpyMaGUcMV8R601v3TfTA/zOqQIK0AZbji7sB2hPneD1zGVCSHK8+wGUMrM1jK4VUCSyxOVKJe2z+VUOAbLBsFfaPlsxTCuILjC0HMSKbkBRFxEWXYLBgeWlKgP2uqZyV1NT2pbq2pIS+fDQ5Jb1K2HtS6ugWkOOxqsYmqrWCfVOPBKe5MahAFCE9lH/EwOxiwR+KVs32aDfWZysRd8cdhJ9ucxiAIkJlbKGivOvTVrIUdt50z5/BPlO1+uNhf6dH8EjEv14h8eW4Jp1g1Nt8/EVSd7sClOt2MKe0VS7Tj8oagKZZkf2XPTXWFQ++6msDkMPGTv0shSpB1nvo0J2eWCAaQ9qrpLd2/AlTpWfPIFHfyQTO64NdzVW60fZeXxP71XS+D1+nsj5INe7De7ha1o4d7QTg1f6/jH8 bN+aOqPw pTo2RlCWE4z2F1al+dlkik+g3uqgPNZsiM87AnIPNmH0/xwBuQIwCn7gFjGiw4b37blg/iTB2a72jV0Z5KFAFdX74nnyz04HOUXbGh20Nb9/zeNewECVQUz8/VVFWmz28fZN/6XzWz8gqXXAxywzW30KYOtwu9h0LGRxW6Cj67WE5cXilo6rc2ogmspx7knvcxt/Pd5yuw3MN0lfiy/GHUIV6m6/CXyOxlJW+vv1mABnmeotoQOHaVZ6SFVUusm/XOlAPhKCILv2mTlKM7EUoKPV+oxy8dwTrbTZX4UJCNYTCsaJxrSCmr/k0onbsDZ8n8x55QkxRSL47QJ/PRmGB+6BuOGHXJmpnB/EhkvBVmTleHgBbWjRITlEcGhW0lDVg7FitL/COVFHI08lQ7U/yTQWi2+QwWsqaRLSkGI1ToFBJEQBlono7LWwGjR7b6NB2NS5JhEXHMkaO8f34Bs+ZMbz7/sZACETXyM+0cF+hVuHx9udaw91v2rmdyLsEE2hbLx+emha6Loa9yyze4D56ZdGG9YpbYZdL5sIzOaaCSlpB1Pw= 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: List-Subscribe: List-Unsubscribe: From: Alex Shi page table descriptor is splited from struct page, use it to replace struct page in right place. Signed-off-by: Alex Shi Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org Cc: Andrew Morton Cc: Matthew Wilcox Cc: David Hildenbrand --- mm/pgtable-generic.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c index 13a7705df3f8..2ce714f1dd15 100644 --- a/mm/pgtable-generic.c +++ b/mm/pgtable-generic.c @@ -238,18 +238,17 @@ pmd_t pmdp_collapse_flush(struct vm_area_struct *vma, unsigned long address, #ifndef pte_free_defer static void pte_free_now(struct rcu_head *head) { - struct page *page; + struct ptdesc *ptdesc; - page = container_of(head, struct page, rcu_head); - pte_free(NULL /* mm not passed and not used */, (pgtable_t)page); + ptdesc = container_of(head, struct ptdesc, pt_rcu_head); + pte_free(NULL /* mm not passed and not used */, (pgtable_t)ptdesc); } void pte_free_defer(struct mm_struct *mm, pgtable_t pgtable) { - struct page *page; + struct ptdesc *ptdesc = page_ptdesc(pgtable); - page = pgtable; - call_rcu(&page->rcu_head, pte_free_now); + call_rcu(&ptdesc->pt_rcu_head, pte_free_now); } #endif /* pte_free_defer */ #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ @@ -330,7 +329,7 @@ pte_t *pte_offset_map_nolock(struct mm_struct *mm, pmd_t *pmd, * kmapped if necessary (when CONFIG_HIGHPTE), and locked against concurrent * modification by software, with a pointer to that spinlock in ptlp (in some * configs mm->page_table_lock, in SPLIT_PTLOCK configs a spinlock in table's - * struct page). pte_unmap_unlock(pte, ptl) to unlock and unmap afterwards. + * struct ptdesc). pte_unmap_unlock(pte, ptl) to unlock and unmap afterwards. * * But it is unsuccessful, returning NULL with *ptlp unchanged, if there is no * page table at *pmd: if, for example, the page table has just been removed,