@@ -1755,6 +1755,18 @@ static inline void count_objcg_event(struct obj_cgroup *objcg,
rcu_read_unlock();
}
+static inline bool memcg_need_recharge(struct mem_cgroup *memcg)
+{
+ if (!memcg || memcg == root_mem_cgroup)
+ return false;
+ /*
+ * Currently we only recharge pages from an offline memcg,
+ * in the future we may explicitly introduce a need_recharge
+ * state for the memcg which should be recharged.
+ */
+ return memcg->kmemcg_id == memcg->id.id ? false : true;
+}
+
#else
static inline bool mem_cgroup_kmem_disabled(void)
{
@@ -1806,6 +1818,11 @@ static inline void count_objcg_event(struct obj_cgroup *objcg,
{
}
+static inline bool memcg_need_recharge(struct mem_cgroup *memcg)
+{
+ return false;
+}
+
#endif /* CONFIG_MEMCG_KMEM */
#if defined(CONFIG_MEMCG_KMEM) && defined(CONFIG_ZSWAP)
Currently we only recharge pages from an offline memcg or reparented memcg. In the future we may explicitly introduce a need_recharge state for the memcg which should be recharged. Signed-off-by: Yafang Shao <laoar.shao@gmail.com> --- include/linux/memcontrol.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)