Add unit(in variable) & fix bugs
[platform/core/system/resourced.git] / src / common / cgroup / memory-cgroup.h
index f3258ec..10189e1 100644 (file)
@@ -143,7 +143,7 @@ struct mem_threshold {
 };
 
 struct mem_action {
-       unsigned int memory;    /* Byte */
+       unsigned long long memory_bytes;        /* Byte */
        int action;
 };
 
@@ -164,10 +164,10 @@ struct memcg_info {
        /* parent id */
        /* limit ratio, if don't want to set limit, use NO_LIMIT*/
        float limit_ratio;
-       unsigned int limit;
+       unsigned long long limit_bytes;
        /* thresholds, normal, swap, low, medium, and leave */
-       unsigned int threshold[MEM_LEVEL_MAX];  /* MB */
-       unsigned int threshold_leave;                   /* MB */
+       unsigned int threshold_mb[MEM_LEVEL_MAX];       /* MB */
+       unsigned int threshold_leave_mb;                        /* MB */
        int evfd;
        int swappiness;
 };
@@ -183,6 +183,7 @@ struct cgroup_memory_stat {
        long long value[CGROUP_MEMORY_STAT_MAX];
 };
 
+void register_totalram_bytes(unsigned long long ram_bytes);
 int set_mem_action_conf(struct mem_action *mem_action, const char *value);
 int set_memcg_conf_threshold(bool percent, char size, int lvl, const char *value);
 struct memcg_conf *get_memcg_conf(void);
@@ -197,8 +198,8 @@ int memcg_write_optimizer_params(void);
 void memcg_set_threshold(int type, int level, int value);
 void memcg_set_leave_threshold(int type, int value);
 
-void memcg_info_set_limit(struct memcg_info *memcg_info, float ratio,
-       unsigned int totalram);
+void memcg_info_set_limit(struct memcg_info *mi, float ratio,
+       unsigned long long totalram_bytes);
 void memcg_set_default_swappiness(int swappiness);
 void memcg_info_set_swappiness(struct memcg_info *mi, int swappiness);
 int memcg_get_memory_stat(const char *name, struct cgroup_memory_stat **mem_stat);
@@ -207,13 +208,13 @@ int memcg_get_memory_stat(const char *name, struct cgroup_memory_stat **mem_stat
  * @desc get anon memory usage of cgroup based on memory.stat
  * @return 0 if the value was correctly read
  */
-int memcg_get_anon_usage(char *memcg, unsigned int *anon_usage);
+int memcg_get_anon_usage(char *memcg, unsigned long long *anon_usage);
 
 /**
  * @desc get swapped memory usage of cgroup mi based on memory.stat
  * @return 0 if the value was correctly read
  */
-int memcg_get_swap_usage(char *memcg, unsigned int *usage);
+int memcg_get_swap_usage(char *memcg, unsigned long long *usage);
 
 /**
  * @desc register eventfd to the memory cgroup with desired value
@@ -222,7 +223,7 @@ int memcg_get_swap_usage(char *memcg, unsigned int *usage);
 int memcg_set_eventfd(const char *memcg, const char *event, const char *value);
 int memcg_init_eventfd(int evfd, const char *memcg, const char *event, const char *value);
 
-int check_oom_and_set_limit(const char *dir, unsigned int limit);
+int check_oom_and_set_limit(const char *dir, unsigned long long limit);
 
 struct memcg_info *get_root_memcg_info(void);
 void memcg_params_init(void);