• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * include/linux/memcg_policy.h
4  *
5  * Copyright (c) 2020-2022 Huawei Technologies Co., Ltd.
6  *
7  */
8 #ifndef _MEMCG_POLICY_H
9 #define _MEMCG_POLICY_H
10 
11 struct mem_cgroup;
12 struct pglist_data;
13 struct scan_control;
14 
15 
16 extern struct list_head score_head;
17 extern bool score_head_inited;
18 extern rwlock_t score_list_lock;
19 extern struct cgroup_subsys memory_cgrp_subsys;
20 #ifdef CONFIG_HYPERHOLD_FILE_LRU
21 void shrink_anon_memcg(struct pglist_data *pgdat,
22 		struct mem_cgroup *memcg, struct scan_control *sc,
23 		unsigned long *nr);
24 bool shrink_node_hyperhold(struct pglist_data *pgdat, struct scan_control *sc);
25 #endif /* CONFIG_HYPERHOLD_FILE_LRU */
26 
27 #ifdef CONFIG_HYPERHOLD_MEMCG
28 struct mem_cgroup *get_next_memcg(struct mem_cgroup *prev);
29 void get_next_memcg_break(struct mem_cgroup *memcg);
30 void memcg_app_score_update(struct mem_cgroup *target);
31 
32 struct memcg_reclaim {
33 	atomic64_t app_score;
34 	atomic64_t ub_ufs2zram_ratio;
35 #ifdef CONFIG_HYPERHOLD_ZSWAPD
36 	atomic_t ub_zram2ufs_ratio;
37 	atomic_t ub_mem2zram_ratio;
38 	atomic_t refault_threshold;
39 	/* anon refault */
40 	unsigned long long reclaimed_pagefault;
41 #endif
42 };
43 #define MAX_APP_SCORE 1000
44 #endif
45 
46 
47 #endif /* _LINUX_MEMCG_POLICY_H */
48