diff options
Diffstat (limited to 'kernel/ksysfs.c')
-rw-r--r-- | kernel/ksysfs.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index e83b26464061..b4e2fa52d8bc 100644 --- a/kernel/ksysfs.c +++ b/kernel/ksysfs.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include <linux/capability.h> | 20 | #include <linux/capability.h> |
21 | #include <linux/compiler.h> | 21 | #include <linux/compiler.h> |
22 | 22 | ||
23 | #include <linux/rcupdate.h> /* rcu_expedited */ | 23 | #include <linux/rcupdate.h> /* rcu_expedited and rcu_normal */ |
24 | 24 | ||
25 | #define KERNEL_ATTR_RO(_name) \ | 25 | #define KERNEL_ATTR_RO(_name) \ |
26 | static struct kobj_attribute _name##_attr = __ATTR_RO(_name) | 26 | static struct kobj_attribute _name##_attr = __ATTR_RO(_name) |
@@ -148,7 +148,7 @@ int rcu_expedited; | |||
148 | static ssize_t rcu_expedited_show(struct kobject *kobj, | 148 | static ssize_t rcu_expedited_show(struct kobject *kobj, |
149 | struct kobj_attribute *attr, char *buf) | 149 | struct kobj_attribute *attr, char *buf) |
150 | { | 150 | { |
151 | return sprintf(buf, "%d\n", rcu_expedited); | 151 | return sprintf(buf, "%d\n", READ_ONCE(rcu_expedited)); |
152 | } | 152 | } |
153 | static ssize_t rcu_expedited_store(struct kobject *kobj, | 153 | static ssize_t rcu_expedited_store(struct kobject *kobj, |
154 | struct kobj_attribute *attr, | 154 | struct kobj_attribute *attr, |
@@ -161,6 +161,23 @@ static ssize_t rcu_expedited_store(struct kobject *kobj, | |||
161 | } | 161 | } |
162 | KERNEL_ATTR_RW(rcu_expedited); | 162 | KERNEL_ATTR_RW(rcu_expedited); |
163 | 163 | ||
164 | int rcu_normal; | ||
165 | static ssize_t rcu_normal_show(struct kobject *kobj, | ||
166 | struct kobj_attribute *attr, char *buf) | ||
167 | { | ||
168 | return sprintf(buf, "%d\n", READ_ONCE(rcu_normal)); | ||
169 | } | ||
170 | static ssize_t rcu_normal_store(struct kobject *kobj, | ||
171 | struct kobj_attribute *attr, | ||
172 | const char *buf, size_t count) | ||
173 | { | ||
174 | if (kstrtoint(buf, 0, &rcu_normal)) | ||
175 | return -EINVAL; | ||
176 | |||
177 | return count; | ||
178 | } | ||
179 | KERNEL_ATTR_RW(rcu_normal); | ||
180 | |||
164 | /* | 181 | /* |
165 | * Make /sys/kernel/notes give the raw contents of our kernel .notes section. | 182 | * Make /sys/kernel/notes give the raw contents of our kernel .notes section. |
166 | */ | 183 | */ |
@@ -203,6 +220,7 @@ static struct attribute * kernel_attrs[] = { | |||
203 | &vmcoreinfo_attr.attr, | 220 | &vmcoreinfo_attr.attr, |
204 | #endif | 221 | #endif |
205 | &rcu_expedited_attr.attr, | 222 | &rcu_expedited_attr.attr, |
223 | &rcu_normal_attr.attr, | ||
206 | NULL | 224 | NULL |
207 | }; | 225 | }; |
208 | 226 | ||