aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/backing-dev.c50
-rw-r--r--mm/page-writeback.c14
2 files changed, 37 insertions, 27 deletions
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index b41823cc05e6..d3ca2b3ee176 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -158,16 +158,16 @@ static ssize_t read_ahead_kb_store(struct device *dev,
158 const char *buf, size_t count) 158 const char *buf, size_t count)
159{ 159{
160 struct backing_dev_info *bdi = dev_get_drvdata(dev); 160 struct backing_dev_info *bdi = dev_get_drvdata(dev);
161 char *end;
162 unsigned long read_ahead_kb; 161 unsigned long read_ahead_kb;
163 ssize_t ret = -EINVAL; 162 ssize_t ret;
164 163
165 read_ahead_kb = simple_strtoul(buf, &end, 10); 164 ret = kstrtoul(buf, 10, &read_ahead_kb);
166 if (*buf && (end[0] == '\0' || (end[0] == '\n' && end[1] == '\0'))) { 165 if (ret < 0)
167 bdi->ra_pages = read_ahead_kb >> (PAGE_SHIFT - 10); 166 return ret;
168 ret = count; 167
169 } 168 bdi->ra_pages = read_ahead_kb >> (PAGE_SHIFT - 10);
170 return ret; 169
170 return count;
171} 171}
172 172
173#define K(pages) ((pages) << (PAGE_SHIFT - 10)) 173#define K(pages) ((pages) << (PAGE_SHIFT - 10))
@@ -187,16 +187,17 @@ static ssize_t min_ratio_store(struct device *dev,
187 struct device_attribute *attr, const char *buf, size_t count) 187 struct device_attribute *attr, const char *buf, size_t count)
188{ 188{
189 struct backing_dev_info *bdi = dev_get_drvdata(dev); 189 struct backing_dev_info *bdi = dev_get_drvdata(dev);
190 char *end;
191 unsigned int ratio; 190 unsigned int ratio;
192 ssize_t ret = -EINVAL; 191 ssize_t ret;
192
193 ret = kstrtouint(buf, 10, &ratio);
194 if (ret < 0)
195 return ret;
196
197 ret = bdi_set_min_ratio(bdi, ratio);
198 if (!ret)
199 ret = count;
193 200
194 ratio = simple_strtoul(buf, &end, 10);
195 if (*buf && (end[0] == '\0' || (end[0] == '\n' && end[1] == '\0'))) {
196 ret = bdi_set_min_ratio(bdi, ratio);
197 if (!ret)
198 ret = count;
199 }
200 return ret; 201 return ret;
201} 202}
202BDI_SHOW(min_ratio, bdi->min_ratio) 203BDI_SHOW(min_ratio, bdi->min_ratio)
@@ -205,16 +206,17 @@ static ssize_t max_ratio_store(struct device *dev,
205 struct device_attribute *attr, const char *buf, size_t count) 206 struct device_attribute *attr, const char *buf, size_t count)
206{ 207{
207 struct backing_dev_info *bdi = dev_get_drvdata(dev); 208 struct backing_dev_info *bdi = dev_get_drvdata(dev);
208 char *end;
209 unsigned int ratio; 209 unsigned int ratio;
210 ssize_t ret = -EINVAL; 210 ssize_t ret;
211
212 ret = kstrtouint(buf, 10, &ratio);
213 if (ret < 0)
214 return ret;
215
216 ret = bdi_set_max_ratio(bdi, ratio);
217 if (!ret)
218 ret = count;
211 219
212 ratio = simple_strtoul(buf, &end, 10);
213 if (*buf && (end[0] == '\0' || (end[0] == '\n' && end[1] == '\0'))) {
214 ret = bdi_set_max_ratio(bdi, ratio);
215 if (!ret)
216 ret = count;
217 }
218 return ret; 220 return ret;
219} 221}
220BDI_SHOW(max_ratio, bdi->max_ratio) 222BDI_SHOW(max_ratio, bdi->max_ratio)
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 5ad5ce23c1e0..830893b2b3c7 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -1602,10 +1602,18 @@ void writeback_set_ratelimit(void)
1602} 1602}
1603 1603
1604static int __cpuinit 1604static int __cpuinit
1605ratelimit_handler(struct notifier_block *self, unsigned long u, void *v) 1605ratelimit_handler(struct notifier_block *self, unsigned long action,
1606 void *hcpu)
1606{ 1607{
1607 writeback_set_ratelimit(); 1608
1608 return NOTIFY_DONE; 1609 switch (action & ~CPU_TASKS_FROZEN) {
1610 case CPU_ONLINE:
1611 case CPU_DEAD:
1612 writeback_set_ratelimit();
1613 return NOTIFY_OK;
1614 default:
1615 return NOTIFY_DONE;
1616 }
1609} 1617}
1610 1618
1611static struct notifier_block __cpuinitdata ratelimit_nb = { 1619static struct notifier_block __cpuinitdata ratelimit_nb = {