[RFC v2 PATCH 1/3] mm: add PG2KB/KB2PG helper macros

From: Oleksandr Natalenko
Date: Sun Sep 19 2021 - 09:13:03 EST


Signed-off-by: Oleksandr Natalenko <oleksandr@xxxxxxxxxxxxxx>
---
include/linux/mm.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 00bb2d938df4..0a7e950ac8aa 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -98,6 +98,9 @@ extern int mmap_rnd_compat_bits __read_mostly;
#include <asm/page.h>
#include <asm/processor.h>

+#define PG2KB(x) ((x) << (PAGE_SHIFT - 10))
+#define KB2PG(x) ((x) >> (PAGE_SHIFT - 10))
+
/*
* Architectures that support memory tagging (assigning tags to memory regions,
* embedding these tags into addresses that point to these memory regions, and
--
2.33.0