[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230810085743.25977-1-yan.y.zhao@intel.com>
Date: Thu, 10 Aug 2023 16:57:43 +0800
From: Yan Zhao <yan.y.zhao@...el.com>
To: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Cc: pbonzini@...hat.com, seanjc@...gle.com, mike.kravetz@...cle.com,
apopple@...dia.com, jgg@...dia.com, rppt@...nel.org,
akpm@...ux-foundation.org, kevin.tian@...el.com, david@...hat.com,
Yan Zhao <yan.y.zhao@...el.com>
Subject: [RFC PATCH v2 1/5] mm/mmu_notifier: introduce a new mmu notifier flag MMU_NOTIFIER_RANGE_NUMA
Introduce a new mmu notifier flag MMU_NOTIFIER_RANGE_NUMA to indicate the
notification of MMU_NOTIFY_PROTECTION_VMA is for NUMA balance purpose
specifically.
So that, the subscriber of mmu notifier, like KVM, can recognize this
type of notification and do numa protection specific operations in the
handler.
Signed-off-by: Yan Zhao <yan.y.zhao@...el.com>
---
include/linux/mmu_notifier.h | 1 +
mm/mprotect.c | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index 64a3e051c3c4..a6dc829a4bce 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -60,6 +60,7 @@ enum mmu_notifier_event {
};
#define MMU_NOTIFIER_RANGE_BLOCKABLE (1 << 0)
+#define MMU_NOTIFIER_RANGE_NUMA (1 << 1)
struct mmu_notifier_ops {
/*
diff --git a/mm/mprotect.c b/mm/mprotect.c
index 6f658d483704..cb99a7d66467 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -381,7 +381,9 @@ static inline long change_pmd_range(struct mmu_gather *tlb,
/* invoke the mmu notifier if the pmd is populated */
if (!range.start) {
mmu_notifier_range_init(&range,
- MMU_NOTIFY_PROTECTION_VMA, 0,
+ MMU_NOTIFY_PROTECTION_VMA,
+ cp_flags & MM_CP_PROT_NUMA ?
+ MMU_NOTIFIER_RANGE_NUMA : 0,
vma->vm_mm, addr, end);
mmu_notifier_invalidate_range_start(&range);
}
--
2.17.1
Powered by blists - more mailing lists