From patchwork Mon Nov 30 11:27:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 11940249 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E24AC64E7B for ; Mon, 30 Nov 2020 11:38:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ADF1220855 for ; Mon, 30 Nov 2020 11:38:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="CGwc8xq0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ADF1220855 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B5A3B8D0009; Mon, 30 Nov 2020 06:38:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A46998D0007; Mon, 30 Nov 2020 06:38:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 73F398D0008; Mon, 30 Nov 2020 06:38:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 4433D8D0001 for ; Mon, 30 Nov 2020 06:38:25 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 0DF7C180AD830 for ; Mon, 30 Nov 2020 11:38:25 +0000 (UTC) X-FDA: 77540886570.04.uncle84_230a500273a1 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id E866C800C89D for ; Mon, 30 Nov 2020 11:38:24 +0000 (UTC) X-HE-Tag: uncle84_230a500273a1 X-Filterd-Recvd-Size: 3083 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Mon, 30 Nov 2020 11:38:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; 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=/uoQQYbsRyNoJjZQKQhQxCD1OTCWXbPOIVU6csr5cic=; b=CGwc8xq0mLRcSMz/aOXXnK7TYg A2heKgcQG+T24YsWMXOGDcvBAeE8VacWZsbVXt0acpnu+OXthiOUr+O0fD0F6fsQZVHAThCi7QRaQ nzKGoTgxmD8/H0VuMiVBKYqOUjmyJcVoKNR7LTQeHJBeVv777uU9AHZs3OJ5E+DgIc7+ALuq6gUp1 wA68Golu7aKnkZP8goRA0SS2/t5N0DYpd/+M5Nmlt95Z5SofsIDIHAjZvld+eVDVsBC3JChqSkT2b GuRbLWBeMbyLUVWCXi336BxcKffs4F8logOqgGNRLmen/I35IgdiKaJ3767if4YeDAcad1+tG8g5A 8qk6Jgxg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kjhVc-0006CX-TD; Mon, 30 Nov 2020 11:38:21 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 38C87307890; Mon, 30 Nov 2020 12:38:18 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id E9F922B84F9C9; Mon, 30 Nov 2020 12:38:17 +0100 (CET) Message-ID: <20201130113603.205586001@infradead.org> User-Agent: quilt/0.66 Date: Mon, 30 Nov 2020 12:27:12 +0100 From: Peter Zijlstra To: x86@kernel.org, willy@infradead.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, aarcange@redhat.com, kirill.shutemov@linux.intel.com, jroedel@suse.de, peterz@infradead.org Subject: [RFC][PATCH 7/9] x86/mm/pae: Dont (ab)use atomic64 References: <20201130112705.900705277@infradead.org> MIME-Version: 1.0 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: PAE implies CX8, write readable code. Signed-off-by: Peter Zijlstra (Intel) --- arch/x86/include/asm/pgtable-3level.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/arch/x86/include/asm/pgtable-3level.h +++ b/arch/x86/include/asm/pgtable-3level.h @@ -2,8 +2,6 @@ #ifndef _ASM_X86_PGTABLE_3LEVEL_H #define _ASM_X86_PGTABLE_3LEVEL_H -#include - /* * Intel Physical Address Extension (PAE) Mode - three-level page * tables on PPro+ CPUs. @@ -96,11 +94,13 @@ static inline void pud_clear(pud_t *pudp #ifdef CONFIG_SMP static inline pte_t native_ptep_get_and_clear(pte_t *ptep) { - pte_t res; + pte_t old; - res.pte = (pteval_t)arch_atomic64_xchg((atomic64_t *)ptep, 0); + do { + old = *ptep; + } while (cmpxchg64(&ptep->pte, old.pte, 0ULL) != old.pte); - return res; + return old; } #else #define native_ptep_get_and_clear(xp) native_local_ptep_get_and_clear(xp)