Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2321630pxu; Mon, 7 Dec 2020 03:41:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJyha/zcnetPdOcDPeIaixrueZNZo/d9STDk28eN7L+h3ctDxVGO4rXsEEfuk1VbhmxfkCGF X-Received: by 2002:a05:6402:d09:: with SMTP id eb9mr19132354edb.71.1607341301840; Mon, 07 Dec 2020 03:41:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607341301; cv=none; d=google.com; s=arc-20160816; b=ILfWLOQlm16gv57UmTVrKtX1ffN6SqP5rd93r7+yku+iSKmMfb/1YAAOHw1kBkYT6O YMs7n6woqHHb7SPhplta9xPRtQvRgQC4GA7pKmcSrU3yAOLWO7gUMeIdug7IDbGtnk3b +zULZWMUoBI4mcX5/7nkWrUqR+mgcHLtlBr6M4aZjj3cYnaIj6i9nzyNb4qOxNwWnqKA YswkKYnFcdcbBlJbFbQRPqo1WCtbASovG7wmQCykYtQCD2P9ycg9wXkIywCc5xJ6C3la bwJwqXw7ZX6cht9/r0Z5h9zRDOlHebqqDVHunCzIn9CcQiJiX75WQSVKlNdcZiSWNV2Z PPNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wOxoYAByFgjYHcAfYN08FzgKY6QNyvq8eeqHRPrva4Q=; b=M77iqaJvvbwS//jCUMX2rRfNJNuKhyCD0ZGbn2MspcJL4+mmGDUNhRRtv0V79+bmLe IwCHreLEYkAdAaeoIAYtKjNIOtrIss5z+5Lz5f3G6LbzsHSieApbih+yah4otq6pyoJy e/7PJVql74qMZjLqx3s/+6hVlobaVQpdBrLHBJgPqH/8ln5klihhMJLf0FCAIHMPXJlI i1kBgsYLAE3BkpsYbBGVarttahUDiuxOnAJsM9rWgpGJ31cebJqcklCLauTq3uqPehpx AeQ0QNFLXAgsicebF4bUnzHT8fGnilyzIsjvxR8C8p2+MZqe1iL633xIIwelzGdE1myJ NVsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="IJifq/wH"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h17si833477eds.404.2020.12.07.03.41.19; Mon, 07 Dec 2020 03:41:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="IJifq/wH"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727739AbgLGLhP (ORCPT + 99 others); Mon, 7 Dec 2020 06:37:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727412AbgLGLfa (ORCPT ); Mon, 7 Dec 2020 06:35:30 -0500 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17ED3C094242; Mon, 7 Dec 2020 03:35:09 -0800 (PST) Received: by mail-pf1-x432.google.com with SMTP id 131so9601916pfb.9; Mon, 07 Dec 2020 03:35:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wOxoYAByFgjYHcAfYN08FzgKY6QNyvq8eeqHRPrva4Q=; b=IJifq/wHL5++Uh9KafwXFdFhAIVbfzAETWaT0Wz412DL1zioa8ks0IHqQMobHE0lb7 il49a16YoybvNwcEnH1LbheLRq9esiNl+KUZTTKeEYT3GykktEU9CyjsiyRRlcrL8V9i xjdjnm7I93RF446dlPxAOTolle3sJKf7sCBQPeMYaghlxfkhBNp+bJGbw3s+o46xRf18 SFvcQ0hHzZ5p8+RSv8+DKLLtLxoiI57o2MK8qgH6IXd7lmwhhobC8+LpPY6VhvKxG+CC hFuzLfRe+F25M9UbsIsS/AdyWNtgCGjD+2gfmnfUtyTDHFpMLDYdfzABVdQIvMR60xX3 6Y1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wOxoYAByFgjYHcAfYN08FzgKY6QNyvq8eeqHRPrva4Q=; b=WpIjKRUrjstbjaJjmBIzi0qiMmbYP24njIDLy62SinlTwq9gNLNCOyGr+N9vAdvfG3 1aHn+xI+YWAQkoHqy2mLXT234rT1nXTteRKFrIszZEv0F9sSIECIvAIZv25sS5ZcOXGh IsTIrPf1LtygUxfwxNG0p3/BbLIguu2Zb4tv9oUuYB12EZaV6rNiqNwvshkU16zMa8XJ k4L5jPNoaNUGjfIq89dTeTpQl7jC38g7+1KielYkN1aDo81MDV8cK259AeMfaW11PVkh NiSlxnCk3x9/OcRQHDJdOLSJ2ihcYYBHhQbScf2ei0V4RWyavSmAwnF3Q/ion8taMJQd +diQ== X-Gm-Message-State: AOAM533hJB0hsk24Vc130O/6FJxfByAq0f7btPBcY9mXdCOQXmzhOwPv b8RIhxtgyabgcYzmu231I34= X-Received: by 2002:a62:80ce:0:b029:19d:b280:5019 with SMTP id j197-20020a6280ce0000b029019db2805019mr15544917pfd.43.1607340908718; Mon, 07 Dec 2020 03:35:08 -0800 (PST) Received: from localhost.localdomain ([203.205.141.39]) by smtp.gmail.com with ESMTPSA id d4sm14219822pfo.127.2020.12.07.03.35.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Dec 2020 03:35:08 -0800 (PST) From: yulei.kernel@gmail.com X-Google-Original-From: yuleixzhang@tencent.com To: linux-mm@kvack.org, akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, naoya.horiguchi@nec.com, viro@zeniv.linux.org.uk, pbonzini@redhat.com Cc: joao.m.martins@oracle.com, rdunlap@infradead.org, sean.j.christopherson@intel.com, xiaoguangrong.eric@gmail.com, kernellwp@gmail.com, lihaiwei.kernel@gmail.com, Yulei Zhang , Chen Zhuo Subject: [RFC V2 26/37] mm, dmem: introduce pud_special() for dmem huge pud support Date: Mon, 7 Dec 2020 19:31:19 +0800 Message-Id: <24c19b7db2fa3b405358489fc74a02cf648bfaf1.1607332046.git.yuleixzhang@tencent.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yulei Zhang pud_special() will check both _PAGE_SPECIAL and _PAGE_DMEM bit as pmd_special() does. Signed-off-by: Chen Zhuo Signed-off-by: Yulei Zhang --- arch/x86/include/asm/pgtable.h | 13 +++++++++++++ include/linux/pgtable.h | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 6ce85d4..9e36d42 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -281,6 +281,12 @@ static inline int pmd_special(pmd_t pmd) return (pmd_val(pmd) & (_PAGE_SPECIAL | _PAGE_DMEM)) == (_PAGE_SPECIAL | _PAGE_DMEM); } + +static inline int pud_special(pud_t pud) +{ + return (pud_val(pud) & (_PAGE_SPECIAL | _PAGE_DMEM)) == + (_PAGE_SPECIAL | _PAGE_DMEM); +} #endif #ifdef CONFIG_ARCH_HAS_PTE_DEVMAP @@ -516,6 +522,13 @@ static inline pud_t pud_mkdirty(pud_t pud) return pud_set_flags(pud, _PAGE_DIRTY | _PAGE_SOFT_DIRTY); } +#ifdef CONFIG_ARCH_HAS_PTE_DMEM +static inline pud_t pud_mkdmem(pud_t pud) +{ + return pud_set_flags(pud, _PAGE_SPECIAL | _PAGE_DMEM); +} +#endif + static inline pud_t pud_mkdevmap(pud_t pud) { return pud_set_flags(pud, _PAGE_DEVMAP); diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 30342b8..0ef03ff 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -1167,6 +1167,16 @@ static inline int pmd_special(pmd_t pmd) { return 0; } + +static inline pud_t pud_mkdmem(pud_t pud) +{ + return pud; +} + +static inline int pud_special(pud_t pud) +{ + return 0; +} #endif #ifndef pmd_read_atomic -- 1.8.3.1