Page MenuHomeFreeBSD

D61913.1795412944.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D61913.1795412944.diff

diff --git a/sys/compat/linuxkpi/common/include/linux/topology.h b/sys/compat/linuxkpi/common/include/linux/topology.h
--- a/sys/compat/linuxkpi/common/include/linux/topology.h
+++ b/sys/compat/linuxkpi/common/include/linux/topology.h
@@ -1,6 +1,9 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
* Copyright (c) 2025 The FreeBSD Foundation
* Copyright (c) 2025 Jean-Sébastien Pédron
+ * Copyright (c) 2026 The FreeBSD Foundation
*
* This software was developed by Jean-Sébastien Pédron under sponsorship
* from the FreeBSD Foundation.
@@ -30,6 +33,37 @@
#ifndef _LINUXKPI_LINUX_TOPOLOGY_H_
#define _LINUXKPI_LINUX_TOPOLOGY_H_
+#include <sys/param.h>
+#include <sys/smp.h>
+
+#include <vm/vm.h>
+
+#include <linux/cpumask.h>
+
#include <asm/topology.h>
+#define LOCAL_DISTANCE 10
+#define REMOTE_DISTANCE 20
+#define DISTANCE_BITS 8
+
+static inline const struct cpumask *
+cpumask_of_node(int node)
+{
+ if (node < 0)
+ return ((const struct cpumask *)&cpu_online_mask);
+ if (node >= vm_ndomains)
+ return (cpu_none_mask);
+ return ((const struct cpumask *)&cpuset_domain[node]);
+}
+
+/*
+ * The distance between NUMA nodes is not known, so only distinguish
+ * between local and remote nodes.
+ */
+static inline int
+node_distance(int from, int to)
+{
+ return (from == to ? LOCAL_DISTANCE : REMOTE_DISTANCE);
+}
+
#endif /* _LINUXKPI_LINUX_TOPOLOGY_H_ */

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 23, 5:49 AM (23 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41924123
Default Alt Text
D61913.1795412944.diff (1 KB)

Event Timeline