[Devel] [PATCH RHEL7 COMMIT] ub: rename functions for reading/writing cgroup resources
Konstantin Khorenko
khorenko at virtuozzo.com
Tue Jun 9 07:45:19 PDT 2015
The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.11
------>
commit 2049eb3fad16bb590fd1e12e0c127856d72ca4e6
Author: Vladimir Davydov <vdavydov at parallels.com>
Date: Tue Jun 9 18:45:19 2015 +0400
ub: rename functions for reading/writing cgroup resources
I am going to use ub_cgroup_read/write names for a different purpose, so
rename these functions as follows.
ub_cgroup_read => ub_cgroup_resource_read
ub_cgroup_write_u64 => ub_cgroup_resource_write
The new names better reflect these functions' predestination anyway.
Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
Reviewed-by: Cyrill Gorcunov <gorcunov at openvz.org>
Related to patchset:
https://jira.sw.ru/browse/PSBM-34035
Vladimir Davydov (6):
cgroup: add function to lookup a cgroup by pathname
cgroup: make cgroup_kernel_attach safe against cgroup removal
ub: rename functions for reading/writing cgroup resources
ub: rework connection between ub and mem/blkio cgroups
memcg: pass struct mem_cgroup instead of cgroup to ub-related methods
ub: introduce ub_total_pages
---
kernel/bc/beancounter.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/kernel/bc/beancounter.c b/kernel/bc/beancounter.c
index 30762f5..4748393 100644
--- a/kernel/bc/beancounter.c
+++ b/kernel/bc/beancounter.c
@@ -518,9 +518,9 @@ enum {
#define UB_CGROUP_RES(val) (((val) >> 16) & 0xffff)
#define UB_CGROUP_ATTR(val) ((val) & 0xffff)
-static ssize_t ub_cgroup_read(struct cgroup *cg, struct cftype *cft,
- struct file *file, char __user *buf,
- size_t nbytes, loff_t *ppos)
+static ssize_t ub_cgroup_resource_read(struct cgroup *cg, struct cftype *cft,
+ struct file *file, char __user *buf,
+ size_t nbytes, loff_t *ppos)
{
struct user_beancounter *ub = cgroup_ub(cg);
struct ubparm *ubparm;
@@ -558,7 +558,8 @@ static ssize_t ub_cgroup_read(struct cgroup *cg, struct cftype *cft,
return simple_read_from_buffer(buf, nbytes, ppos, str, len);
}
-static int ub_cgroup_write_u64(struct cgroup *cg, struct cftype *cft, u64 val)
+static int ub_cgroup_resource_write(struct cgroup *cg, struct cftype *cft,
+ u64 val)
{
struct user_beancounter *ub = cgroup_ub(cg);
struct ubparm *ubparm;
@@ -607,33 +608,33 @@ static __init int ub_cgroup_init(void)
snprintf(cft->name, MAX_CFTYPE_NAME, "%s.held", ub_rnames[i]);
cft->flags = CFTYPE_NOT_ON_ROOT;
cft->private = UB_CGROUP_PRIVATE(i, UB_CGROUP_ATTR_HELD);
- cft->read = ub_cgroup_read;
+ cft->read = ub_cgroup_resource_read;
cft = &cgroup_files[j * UB_CGROUP_NR_ATTRS + 1];
snprintf(cft->name, MAX_CFTYPE_NAME, "%s.maxheld", ub_rnames[i]);
cft->flags = CFTYPE_NOT_ON_ROOT;
cft->private = UB_CGROUP_PRIVATE(i, UB_CGROUP_ATTR_MAXHELD);
- cft->read = ub_cgroup_read;
+ cft->read = ub_cgroup_resource_read;
cft = &cgroup_files[j * UB_CGROUP_NR_ATTRS + 2];
snprintf(cft->name, MAX_CFTYPE_NAME, "%s.barrier", ub_rnames[i]);
cft->flags = CFTYPE_NOT_ON_ROOT;
cft->private = UB_CGROUP_PRIVATE(i, UB_CGROUP_ATTR_BARRIER);
- cft->read = ub_cgroup_read;
- cft->write_u64 = ub_cgroup_write_u64;
+ cft->read = ub_cgroup_resource_read;
+ cft->write_u64 = ub_cgroup_resource_write;
cft = &cgroup_files[j * UB_CGROUP_NR_ATTRS + 3];
snprintf(cft->name, MAX_CFTYPE_NAME, "%s.limit", ub_rnames[i]);
cft->flags = CFTYPE_NOT_ON_ROOT;
cft->private = UB_CGROUP_PRIVATE(i, UB_CGROUP_ATTR_LIMIT);
- cft->read = ub_cgroup_read;
- cft->write_u64 = ub_cgroup_write_u64;
+ cft->read = ub_cgroup_resource_read;
+ cft->write_u64 = ub_cgroup_resource_write;
cft = &cgroup_files[j * UB_CGROUP_NR_ATTRS + 4];
snprintf(cft->name, MAX_CFTYPE_NAME, "%s.failcnt", ub_rnames[i]);
cft->flags = CFTYPE_NOT_ON_ROOT;
cft->private = UB_CGROUP_PRIVATE(i, UB_CGROUP_ATTR_FAILCNT);
- cft->read = ub_cgroup_read;
+ cft->read = ub_cgroup_resource_read;
j++;
}
More information about the Devel
mailing list