git: b55cc81fcf97 - main - linuxkpi: Add <linux/cgroup_dmem.h>

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Wed, 24 Jun 2026 16:47:54 UTC
The branch main has been updated by dumbbell:

URL: https://cgit.FreeBSD.org/src/commit/?id=b55cc81fcf9718887a51b22f1436f6cc369fa47b

commit b55cc81fcf9718887a51b22f1436f6cc369fa47b
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2026-06-17 17:22:12 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2026-06-24 16:47:09 +0000

    linuxkpi: Add <linux/cgroup_dmem.h>
    
    In this header, we declare empty stubs for all functions, as if
    `CONFIG_CGROUP_DMEM` was disabled is Linux.
    
    The DRM TTM memory manager started to use this in Linux 6.14.
    
    Reviewed by:    emaste
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D57702
---
 .../linuxkpi/common/include/linux/cgroup_dmem.h    | 58 ++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/cgroup_dmem.h b/sys/compat/linuxkpi/common/include/linux/cgroup_dmem.h
new file mode 100644
index 000000000000..03c0600c1bee
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/linux/cgroup_dmem.h
@@ -0,0 +1,58 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2026 The FreeBSD Foundation
+ */
+
+#ifndef _LINUXKPI_LINUX_CGROUP_DMEM_H_
+#define	_LINUXKPI_LINUX_CGROUP_DMEM_H_
+
+#include <linux/types.h>
+#include <linux/llist.h>
+
+struct dmem_cgroup_pool_state;
+struct dmem_cgroup_region;
+
+static inline __printf(2,3) struct dmem_cgroup_region *
+dmem_cgroup_register_region(uint64_t size, const char *name_fmt, ...)
+{
+	return (NULL);
+}
+
+static inline void
+dmem_cgroup_unregister_region(struct dmem_cgroup_region *region)
+{
+}
+
+static inline int
+dmem_cgroup_try_charge(struct dmem_cgroup_region *region, u64 size,
+    struct dmem_cgroup_pool_state **ret_pool,
+    struct dmem_cgroup_pool_state **ret_limit_pool)
+{
+	*ret_pool = NULL;
+
+	if (ret_limit_pool)
+		*ret_limit_pool = NULL;
+
+	return (0);
+}
+
+static inline void
+dmem_cgroup_uncharge(struct dmem_cgroup_pool_state *pool, uint64_t size)
+{
+}
+
+static inline
+bool dmem_cgroup_state_evict_valuable(struct dmem_cgroup_pool_state *limit_pool,
+    struct dmem_cgroup_pool_state *test_pool,
+    bool ignore_low, bool *ret_hit_low)
+{
+	return (true);
+}
+
+static inline void
+dmem_cgroup_pool_state_put(struct dmem_cgroup_pool_state *pool)
+{
+}
+
+#endif /* _LINUXKPI_LINUX_CGROUP_DMEM_H_ */