_cleanup_closedir_ DIR *d = NULL;
struct dirent *de;
int ret;
+ int rootswappiness, memcgswappiness;
+ int changeswappiness = -1;
d = opendir(dir);
if (!d) {
return -errno;
}
+ ret = cgroup_read_node_int32(LOWMEM_ROOT_CGROUP, MEMCG_SWAPNESS_PATH,
+ &rootswappiness);
+ if (ret != RESOURCED_ERROR_NONE)
+ return -errno;
+
+ ret = cgroup_read_node_int32(dir, MEMCG_SWAPNESS_PATH,
+ &memcgswappiness);
+ if (ret != RESOURCED_ERROR_NONE)
+ return -errno;
+
+ if ((rootswappiness >=0) && (rootswappiness != memcgswappiness)) {
+ changeswappiness = rootswappiness;
+ ret = cgroup_write_node_uint32(dir,
+ MEMCG_SWAPNESS_PATH, changeswappiness);
+ if (ret != RESOURCED_ERROR_NONE) {
+ _I("failed to write %s %d to %s the",
+ MEMCG_SWAPNESS_PATH, changeswappiness, dir);
+ return -errno;
+ }
+ }
+
/*
* set memory limit
* The purpose of this operation is to make debug information
if (ret != RESOURCED_ERROR_NONE ||limit <= 0)
continue;
+ if (changeswappiness >= 0) {
+ ret = cgroup_write_node_uint32(path,
+ MEMCG_SWAPNESS_PATH, changeswappiness);
+ if (ret != RESOURCED_ERROR_NONE)
+ _I("failed to write %s %d to %s the",
+ MEMCG_SWAPNESS_PATH, changeswappiness, path);
+ }
+
lowmem_reassign_limit(path, limit);
}
return RESOURCED_ERROR_NONE;