Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4868575ybb; Tue, 24 Mar 2020 06:50:46 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtniGrQxWq/ZCKHWja2HJWuyFNR35GgGIZxn/aBwqLkWMiiJAIZXjhbjzB9sxhSmnSnyr73 X-Received: by 2002:aca:d40f:: with SMTP id l15mr3342474oig.90.1585057845855; Tue, 24 Mar 2020 06:50:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585057845; cv=none; d=google.com; s=arc-20160816; b=wK9SveoHF2sk26gLwD6WYVJuqvZSymhNy5k669cgjpTQE9DO+FtsyYm7MvHEGthlDx wfbXDcZtnL0oMqGrF1MtH3xGapqanJ7cPF3XQYaPZe2FbV82773BpuS8bbquuWyP7bGB dV/uLwniS06qRxtP//SMC9Qw0SgctZYthN/rEJ89KZvXOMXiI7AlzZ0D4hEZ0VzhPBr7 /rHxcZ3I6Aa2Jf6csQnmeaB9lD9nZNR//PTHEVB1/fupEiMG0qrp5PrzhO8PK8W8Toru tCHNbrbdqX1mDgwU1s4tOWgUDLQRgC4gLjj6YyvqwvY/bCt94zN3O8PRy6ld2PnOVfxi jYyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=8dsnkMmWq/iloT9BLCQENozUydbE9XYCZ/I/Y24ta4g=; b=Jsnpq6LjVVaczGNnz9WJDEkX2KVa7CcvFu3r/nvt9blH1JFyjbYbZ9b03jjEpBFPtK pbT7EwsgJM0+IWKhSWJsY08oReHKcv6LMZ2zw1sfVFefE+FAPWoYsPSClf+I+9vdYFPH WdP/QU63+rW3ItH/E7S3NP6HQoOuzO21KGlb40UPGKP3sl5KYHP+R8rWxr8Zp3tTTOjN YB9Wh+wjif8oOGfKydShhNOAUSfD3roZhqho+iZEba8zYeb946pLM8EwMKVNay3OX/6l Iy6lSqOv0gnLTzw97pem0W+YXgYKoFs5+IPrJQfgU0/7M8KDb1kJSowGNSNy7UwTbOhM IjMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u66si6773283oib.159.2020.03.24.06.50.32; Tue, 24 Mar 2020 06:50:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727510AbgCXNuJ (ORCPT + 99 others); Tue, 24 Mar 2020 09:50:09 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:45900 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727289AbgCXNuI (ORCPT ); Tue, 24 Mar 2020 09:50:08 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 5368CAA17414541C128E; Tue, 24 Mar 2020 21:46:11 +0800 (CST) Received: from DESKTOP-KKJBAGG.china.huawei.com (10.173.220.25) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.487.0; Tue, 24 Mar 2020 21:46:04 +0800 From: Zhenyu Ye To: , , , , , , , , , , , , , , , , CC: , , , , , , , , Subject: [RFC PATCH v4 4/6] mm: Add page table level flags to vm_flags Date: Tue, 24 Mar 2020 21:45:32 +0800 Message-ID: <20200324134534.1570-5-yezhenyu2@huawei.com> X-Mailer: git-send-email 2.22.0.windows.1 In-Reply-To: <20200324134534.1570-1-yezhenyu2@huawei.com> References: <20200324134534.1570-1-yezhenyu2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.173.220.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add VM_LEVEL_[PUD|PMD|PTE] to vm_flags to indicate which level of the page tables the vma is in. Those flags can be used to reduce the cost of TLB invalidation. These should be common flags for all architectures, however, those flags are only available in 64-bits system currently, because the lower-order flags are fully used. These flags are only used by ARM64 architecture now. See in next patch. Signed-off-by: Zhenyu Ye --- include/linux/mm.h | 10 ++++++++++ include/trace/events/mmflags.h | 15 ++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index c54fb96cb1e6..3ff16ffa5e83 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -313,6 +313,16 @@ extern unsigned int kobjsize(const void *objp); #endif #endif /* CONFIG_ARCH_HAS_PKEYS */ +#ifdef CONFIG_64BIT +# define VM_LEVEL_PUD BIT(37) /* vma is in pud-level of page table */ +# define VM_LEVEL_PMD BIT(38) /* vma is in pmd-level of page table */ +# define VM_LEVEL_PTE BIT(39) /* vma is in pte-level of page table */ +#else +# define VM_LEVEL_PUD 0 +# define VM_LEVEL_PMD 0 +# define VM_LEVEL_PTE 0 +#endif /* CONFIG_64BIT */ + #if defined(CONFIG_X86) # define VM_PAT VM_ARCH_1 /* PAT reserves whole VMA at once (x86) */ #elif defined(CONFIG_PPC) diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index a1675d43777e..9f13cfa96f9f 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -130,6 +130,16 @@ IF_HAVE_PG_IDLE(PG_idle, "idle" ) #define IF_HAVE_VM_SOFTDIRTY(flag,name) #endif +#ifdef CONFIG_64BIT +#define IF_HAVE_VM_LEVEL_PUD(flag,name) {flag, name} +#define IF_HAVE_VM_LEVEL_PMD(flag,name) {flag, name} +#define IF_HAVE_VM_LEVEL_PTE(flag,name) {flag, name} +#else +#define IF_HAVE_VM_LEVEL_PUD(flag,name) +#define IF_HAVE_VM_LEVEL_PMD(flag,name) +#define IF_HAVE_VM_LEVEL_PTE(flag,name) +#endif + #define __def_vmaflag_names \ {VM_READ, "read" }, \ {VM_WRITE, "write" }, \ @@ -161,7 +171,10 @@ IF_HAVE_VM_SOFTDIRTY(VM_SOFTDIRTY, "softdirty" ) \ {VM_MIXEDMAP, "mixedmap" }, \ {VM_HUGEPAGE, "hugepage" }, \ {VM_NOHUGEPAGE, "nohugepage" }, \ - {VM_MERGEABLE, "mergeable" } \ + {VM_MERGEABLE, "mergeable" }, \ +IF_HAVE_VM_LEVEL_PUD(VM_LEVEL_PUD, "pud-level" ), \ +IF_HAVE_VM_LEVEL_PMD(VM_LEVEL_PMD, "pmd-level" ), \ +IF_HAVE_VM_LEVEL_PTE(VM_LEVEL_PTE, "pte-level" ) \ #define show_vma_flags(flags) \ (flags) ? __print_flags(flags, "|", \ -- 2.19.1