From patchwork Sat Oct 22 11:14:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 7869 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1168852wrr; Sat, 22 Oct 2022 04:51:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4TsxKTZ3Uior8t5OpA5OwTzyU3Hk+gF2/Fn8EhamndLZcLqGCSOVOzYe78LJiKJ9XJ5Qtj X-Received: by 2002:aa7:86d4:0:b0:562:c5e2:a986 with SMTP id h20-20020aa786d4000000b00562c5e2a986mr23873112pfo.61.1666439502782; Sat, 22 Oct 2022 04:51:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666439502; cv=none; d=google.com; s=arc-20160816; b=mYDi+rTq0M6epdFiq33tVyGdlCH4HgyvTM+0/3VUM+zRgGsLC47VJ+4WTimhV+NdvU UV1n56hGF3pBvwJZUGdOS8DYYr277yik2+bLsZXR6Alne5OahdWr+20QxFGhCTDmkaud N54Ol3O7Lp57m9NkJHiXD81G+B2dETM2cn1htfSsNLQ/uAqROxUegEvGZKOikg1KC06F 6prCuiGTo9CaQPxdt4igzNNqW74+sV1sD6oQik8qWRJVWUKX4VfwNQwsKwCnh/BCZ1b0 spB0PknVxrE1kqbVMnmbURcJpIbrbI/7A4SN9rTUZI9IsbnTk9v72T7XBPB303ta+hx+ Ayqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=lkZdGp83/TthtV3rxO0LKzlFIb0aX3v3XYJ5iZQQNzg=; b=ZUx03LOhxwKs+DmZzGQQACWjH34KKa5VvmUrh6i9Y1D5HG2JZPzCSvyis3upQpyVXD am4Zp6s35Uzqx4H8O+MCp2TK+xPIy1oSaEyVd/YrqZUoYwLdi7DwDXB9GzbQ3PxkrHpJ Y6PGzp7uh4yhmdlPuiKbVW48spWxzxjcaLQsKuAsOMRdm/Zu4H2o+v6g22ScC94rJLIU yHT10rnS/9+/uyz2R0AjBi5Yw3dYnxnfWy+WS/FlM3qdoeKOaB5JEuq5W4W/vBbp1VJK RfUCjQx9tN3Q5dLGfhvuu1bMlL99VTtUa3JWrfr1CA7gfWo9BfI8E9iovhjPq45kEfSI GHww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=DvKf19ng; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b12-20020a170903228c00b00176a0d8780csi509095plh.285.2022.10.22.04.51.30; Sat, 22 Oct 2022 04:51:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=DvKf19ng; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229947AbiJVLs4 (ORCPT + 99 others); Sat, 22 Oct 2022 07:48:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229871AbiJVLsu (ORCPT ); Sat, 22 Oct 2022 07:48:50 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21121250293 for ; Sat, 22 Oct 2022 04:48:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=lkZdGp83/TthtV3rxO0LKzlFIb0aX3v3XYJ5iZQQNzg=; b=DvKf19ngBUpdzl0ij7xBmZMRXh ui/RMKslNxqoOsZHJQEPa5zDXLSQ3lYvqgHe3zbQqojpn0U9BuDn4pJaoxbaK86/AQqbdKJhh3oYD ktC6an0vkVyWJJKA9MR4FG0zwzprr5Xgm+MolIvlAy29FCTpuSFLo1xrWIqCK/O8Qs5Gsck/i8qIQ 4mfjWuAYUdAynm0EIt1Pp3+QSrXSg1pT6whi7abx5v7Sj6NZsGkXKAvhdlLwSQjvnDw18bP07Zv4y Mc6ZlO9yHBlrAsiBQYNLFfQ3Yhfz13CO5XsuOaulhx5bKEzAJXiaIYGya4dd4IzKwJEJA1YcKJKVh 2tGUPmqA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1omCzM-005XdR-WF; Sat, 22 Oct 2022 11:48:29 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id BDB32302D62; Sat, 22 Oct 2022 13:48:26 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 3015B28B8E511; Sat, 22 Oct 2022 13:48:26 +0200 (CEST) Message-ID: <20221022114424.841277397@infradead.org> User-Agent: quilt/0.66 Date: Sat, 22 Oct 2022 13:14:09 +0200 From: Peter Zijlstra To: x86@kernel.org, willy@infradead.org, torvalds@linux-foundation.org, akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, linux-mm@kvack.org, aarcange@redhat.com, kirill.shutemov@linux.intel.com, jroedel@suse.de, ubizjak@gmail.com Subject: [PATCH 06/13] mm: Rename pmd_read_atomic() References: <20221022111403.531902164@infradead.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747388467951036997?= X-GMAIL-MSGID: =?utf-8?q?1747388467951036997?= There's no point in having the identical routines for PTE/PMD have different names. Signed-off-by: Peter Zijlstra (Intel) --- include/linux/pgtable.h | 9 ++------- mm/hmm.c | 2 +- mm/khugepaged.c | 2 +- mm/mapping_dirty_helpers.c | 2 +- mm/mprotect.c | 2 +- mm/userfaultfd.c | 2 +- mm/vmscan.c | 4 ++-- 7 files changed, 9 insertions(+), 14 deletions(-) --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -1352,11 +1352,6 @@ static inline int pud_trans_unstable(pud #endif } -static inline pmd_t pmd_read_atomic(pmd_t *pmdp) -{ - return pmdp_get_lockless(pmdp); -} - #ifndef arch_needs_pgtable_deposit #define arch_needs_pgtable_deposit() (false) #endif @@ -1383,13 +1378,13 @@ static inline pmd_t pmd_read_atomic(pmd_ */ static inline int pmd_none_or_trans_huge_or_clear_bad(pmd_t *pmd) { - pmd_t pmdval = pmd_read_atomic(pmd); + pmd_t pmdval = pmdp_get_lockless(pmd); /* * The barrier will stabilize the pmdval in a register or on * the stack so that it will stop changing under the code. * * When CONFIG_TRANSPARENT_HUGEPAGE=y on x86 32bit PAE, - * pmd_read_atomic is allowed to return a not atomic pmdval + * pmdp_get_lockless is allowed to return a not atomic pmdval * (for example pointing to an hugepage that has never been * mapped in the pmd). The below checks will only care about * the low part of the pmd with 32bit PAE x86 anyway, with the --- a/mm/hmm.c +++ b/mm/hmm.c @@ -361,7 +361,7 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp, * huge or device mapping one and compute corresponding pfn * values. */ - pmd = pmd_read_atomic(pmdp); + pmd = pmdp_get_lockless(pmdp); barrier(); if (!pmd_devmap(pmd) && !pmd_trans_huge(pmd)) goto again; --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -862,7 +862,7 @@ static int find_pmd_or_thp_or_none(struc if (!*pmd) return SCAN_PMD_NULL; - pmde = pmd_read_atomic(*pmd); + pmde = pmdp_get_lockless(*pmd); #ifdef CONFIG_TRANSPARENT_HUGEPAGE /* See comments in pmd_none_or_trans_huge_or_clear_bad() */ --- a/mm/mapping_dirty_helpers.c +++ b/mm/mapping_dirty_helpers.c @@ -126,7 +126,7 @@ static int clean_record_pte(pte_t *pte, static int wp_clean_pmd_entry(pmd_t *pmd, unsigned long addr, unsigned long end, struct mm_walk *walk) { - pmd_t pmdval = pmd_read_atomic(pmd); + pmd_t pmdval = pmdp_get_lockless(pmd); if (!pmd_trans_unstable(&pmdval)) return 0; --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -292,7 +292,7 @@ static unsigned long change_pte_range(st */ static inline int pmd_none_or_clear_bad_unless_trans_huge(pmd_t *pmd) { - pmd_t pmdval = pmd_read_atomic(pmd); + pmd_t pmdval = pmdp_get_lockless(pmd); /* See pmd_none_or_trans_huge_or_clear_bad for info on barrier */ #ifdef CONFIG_TRANSPARENT_HUGEPAGE --- a/mm/userfaultfd.c +++ b/mm/userfaultfd.c @@ -613,7 +613,7 @@ static __always_inline ssize_t __mcopy_a break; } - dst_pmdval = pmd_read_atomic(dst_pmd); + dst_pmdval = pmdp_get_lockless(dst_pmd); /* * If the dst_pmd is mapped as THP don't * override it and just be strict. --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4039,9 +4039,9 @@ static void walk_pmd_range(pud_t *pud, u /* walk_pte_range() may call get_next_vma() */ vma = args->vma; for (i = pmd_index(start), addr = start; addr != end; i++, addr = next) { - pmd_t val = pmd_read_atomic(pmd + i); + pmd_t val = pmdp_get_lockless(pmd + i); - /* for pmd_read_atomic() */ + /* for pmdp_get_lockless() */ barrier(); next = pmd_addr_end(addr, end);