Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com> Tested-by: Peter Schneider <pschneider1968@googlemail.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org> Tested-by: Brett A C Sheffield <bacs@librecast.net> Tested-by: Mark Brown <broonie@kernel.org> Tested-by: Luna Jernberg <droidbittin@gmail.com> Tested-by: Ronald Warsow <rwarsow@gmx.de> Tested-by: Justin M. Forbes <jforbes@fedoraproject.org> Tested-by: Ron Economos <re@w6rz.net> Tested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
67 lines
1.9 KiB
C
67 lines
1.9 KiB
C
/* SPDX-License-Identifier: MIT */
|
|
/*
|
|
* Copyright © 2023-2024 Intel Corporation
|
|
*/
|
|
|
|
#ifndef _CGROUP_DMEM_H
|
|
#define _CGROUP_DMEM_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/llist.h>
|
|
|
|
struct dmem_cgroup_pool_state;
|
|
|
|
/* Opaque definition of a cgroup region, used internally */
|
|
struct dmem_cgroup_region;
|
|
|
|
#if IS_ENABLED(CONFIG_CGROUP_DMEM)
|
|
struct dmem_cgroup_region *dmem_cgroup_register_region(u64 size, const char *name_fmt, ...) __printf(2,3);
|
|
void dmem_cgroup_unregister_region(struct dmem_cgroup_region *region);
|
|
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);
|
|
void dmem_cgroup_uncharge(struct dmem_cgroup_pool_state *pool, u64 size);
|
|
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);
|
|
|
|
void dmem_cgroup_pool_state_put(struct dmem_cgroup_pool_state *pool);
|
|
#else
|
|
static inline __printf(2,3) struct dmem_cgroup_region *
|
|
dmem_cgroup_register_region(u64 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, u64 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
|
|
#endif /* _CGROUP_DMEM_H */
|