[Devel] [PATCH 2/6 v7] cgroup: Added rcu node string wrapper for in-cgroup usage.
Valeriy Vdovin
valeriy.vdovin at virtuozzo.com
Wed Apr 15 21:26:34 MSK 2020
This will be used in further patches in same patchset.
Signed-off-by: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>
---
include/linux/cgroup.h | 7 +++++++
kernel/cgroup.c | 11 +++++++++++
2 files changed, 18 insertions(+)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index aa91e47..d671309 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -210,6 +210,13 @@ struct cgroup_name {
char name[];
};
+struct cgroup_rcu_string {
+ struct rcu_head rcu_head;
+ char val[];
+};
+
+struct cgroup_rcu_string *cgroup_rcu_strdup(const char *str, int len);
+
struct cgroup {
unsigned long flags; /* "unsigned long" so bitops work */
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 9ca8af9..2973782 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -772,6 +772,17 @@ static struct inode *cgroup_new_inode(umode_t mode, struct super_block *sb)
return inode;
}
+struct cgroup_rcu_string *cgroup_rcu_strdup(const char *str, int len)
+{
+ struct cgroup_rcu_string *result;
+
+ result = kmalloc(sizeof(*result) + len + 1, GFP_KERNEL);
+ if (!result)
+ return NULL;
+ strcpy(result->val, str);
+ return result;
+}
+
static struct cgroup_name *cgroup_alloc_name(struct dentry *dentry)
{
struct cgroup_name *name;
--
1.8.3.1
More information about the Devel
mailing list