Skip to content

Commit 27bbe9d

Browse files
Stefan Roeschakpm00
authored andcommitted
mm: add knob /sys/class/bdi/<bdi>/strict_limit
Add a new knob to /sys/class/bdi/<bdi>/strict_limit. This new knob allows to set/unset the flag BDI_CAP_STRICTLIMIT in the bdi capabilities. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Stefan Roesch <[email protected]> Cc: Chris Mason <[email protected]> Cc: Jens Axboe <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 8e9d5ea commit 27bbe9d

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

mm/backing-dev.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,40 @@ static ssize_t stable_pages_required_show(struct device *dev,
209209
}
210210
static DEVICE_ATTR_RO(stable_pages_required);
211211

212+
static ssize_t strict_limit_store(struct device *dev,
213+
struct device_attribute *attr, const char *buf, size_t count)
214+
{
215+
struct backing_dev_info *bdi = dev_get_drvdata(dev);
216+
unsigned int strict_limit;
217+
ssize_t ret;
218+
219+
ret = kstrtouint(buf, 10, &strict_limit);
220+
if (ret < 0)
221+
return ret;
222+
223+
ret = bdi_set_strict_limit(bdi, strict_limit);
224+
if (!ret)
225+
ret = count;
226+
227+
return ret;
228+
}
229+
230+
static ssize_t strict_limit_show(struct device *dev,
231+
struct device_attribute *attr, char *buf)
232+
{
233+
struct backing_dev_info *bdi = dev_get_drvdata(dev);
234+
235+
return sysfs_emit(buf, "%d\n",
236+
!!(bdi->capabilities & BDI_CAP_STRICTLIMIT));
237+
}
238+
static DEVICE_ATTR_RW(strict_limit);
239+
212240
static struct attribute *bdi_dev_attrs[] = {
213241
&dev_attr_read_ahead_kb.attr,
214242
&dev_attr_min_ratio.attr,
215243
&dev_attr_max_ratio.attr,
216244
&dev_attr_stable_pages_required.attr,
245+
&dev_attr_strict_limit.attr,
217246
NULL,
218247
};
219248
ATTRIBUTE_GROUPS(bdi_dev);

0 commit comments

Comments
 (0)