summaryrefslogtreecommitdiff
path: root/tools/testing/memblock/linux/mmzone.h
diff options
context:
space:
mode:
authorKarolina Drobnik <karolinadrobnik@gmail.com>2022-02-02 14:03:09 +0300
committerMike Rapoport <rppt@linux.ibm.com>2022-02-20 09:44:37 +0300
commit16802e55dea9534c18a30bd8eeefea8a06337916 (patch)
tree3baa119284c22435f524bf65c86e0ef00968dae0 /tools/testing/memblock/linux/mmzone.h
parent62183279ad2f52d36b40365eb3a27c7a4a2284f8 (diff)
downloadlinux-16802e55dea9534c18a30bd8eeefea8a06337916.tar.xz
memblock tests: Add skeleton of the memblock simulator
Add basic project files, together with local stubs of required headers. Update tools/include/slab.h to include definitions used by memblock. Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com> Signed-off-by: Mike Rapoport <rppt@kernel.org> Link: https://lore.kernel.org/r/d296fceb023a04b316a31fbff9acf1e76ac684e4.1643796665.git.karolinadrobnik@gmail.com
Diffstat (limited to 'tools/testing/memblock/linux/mmzone.h')
-rw-r--r--tools/testing/memblock/linux/mmzone.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/testing/memblock/linux/mmzone.h b/tools/testing/memblock/linux/mmzone.h
new file mode 100644
index 000000000000..7c2eb5c9bb54
--- /dev/null
+++ b/tools/testing/memblock/linux/mmzone.h
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _TOOLS_MMZONE_H
+#define _TOOLS_MMZONE_H
+
+#include <linux/atomic.h>
+
+struct pglist_data *first_online_pgdat(void);
+struct pglist_data *next_online_pgdat(struct pglist_data *pgdat);
+
+#define for_each_online_pgdat(pgdat) \
+ for (pgdat = first_online_pgdat(); \
+ pgdat; \
+ pgdat = next_online_pgdat(pgdat))
+
+enum zone_type {
+ __MAX_NR_ZONES
+};
+
+#define MAX_NR_ZONES __MAX_NR_ZONES
+#define MAX_ORDER 11
+#define MAX_ORDER_NR_PAGES (1 << (MAX_ORDER - 1))
+
+#define pageblock_order (MAX_ORDER - 1)
+#define pageblock_nr_pages BIT(pageblock_order)
+
+struct zone {
+ atomic_long_t managed_pages;
+};
+
+typedef struct pglist_data {
+ struct zone node_zones[MAX_NR_ZONES];
+
+} pg_data_t;
+
+#endif