xref: /freebsd/sys/compat/linuxkpi/common/include/linux/cgroup_dmem.h (revision b55cc81fcf9718887a51b22f1436f6cc369fa47b)
1 /*
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2026 The FreeBSD Foundation
5  */
6 
7 #ifndef _LINUXKPI_LINUX_CGROUP_DMEM_H_
8 #define	_LINUXKPI_LINUX_CGROUP_DMEM_H_
9 
10 #include <linux/types.h>
11 #include <linux/llist.h>
12 
13 struct dmem_cgroup_pool_state;
14 struct dmem_cgroup_region;
15 
16 static inline __printf(2,3) struct dmem_cgroup_region *
dmem_cgroup_register_region(uint64_t size,const char * name_fmt,...)17 dmem_cgroup_register_region(uint64_t size, const char *name_fmt, ...)
18 {
19 	return (NULL);
20 }
21 
22 static inline void
dmem_cgroup_unregister_region(struct dmem_cgroup_region * region)23 dmem_cgroup_unregister_region(struct dmem_cgroup_region *region)
24 {
25 }
26 
27 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)28 dmem_cgroup_try_charge(struct dmem_cgroup_region *region, u64 size,
29     struct dmem_cgroup_pool_state **ret_pool,
30     struct dmem_cgroup_pool_state **ret_limit_pool)
31 {
32 	*ret_pool = NULL;
33 
34 	if (ret_limit_pool)
35 		*ret_limit_pool = NULL;
36 
37 	return (0);
38 }
39 
40 static inline void
dmem_cgroup_uncharge(struct dmem_cgroup_pool_state * pool,uint64_t size)41 dmem_cgroup_uncharge(struct dmem_cgroup_pool_state *pool, uint64_t size)
42 {
43 }
44 
45 static inline
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)46 bool dmem_cgroup_state_evict_valuable(struct dmem_cgroup_pool_state *limit_pool,
47     struct dmem_cgroup_pool_state *test_pool,
48     bool ignore_low, bool *ret_hit_low)
49 {
50 	return (true);
51 }
52 
53 static inline void
dmem_cgroup_pool_state_put(struct dmem_cgroup_pool_state * pool)54 dmem_cgroup_pool_state_put(struct dmem_cgroup_pool_state *pool)
55 {
56 }
57 
58 #endif /* _LINUXKPI_LINUX_CGROUP_DMEM_H_ */
59