Commit df476a4d authored by Oleg Drokin's avatar Oleg Drokin Committed by Greg Kroah-Hartman

staging/lustre/obdclass: move max_dirty_mb from sysctl to sysfs

max_dirty_mb is now a parameter in /sys/fs/lustre/
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e2424a12
...@@ -100,48 +100,42 @@ static struct static_lustre_uintvalue_attr lustre_sattr_##name = \ ...@@ -100,48 +100,42 @@ static struct static_lustre_uintvalue_attr lustre_sattr_##name = \
LUSTRE_STATIC_UINT_ATTR(timeout, &obd_timeout); LUSTRE_STATIC_UINT_ATTR(timeout, &obd_timeout);
#ifdef CONFIG_SYSCTL static ssize_t max_dirty_mb_show(struct kobject *kobj, struct attribute *attr,
static int proc_max_dirty_pages_in_mb(struct ctl_table *table, int write, char *buf)
void __user *buffer, size_t *lenp, loff_t *ppos)
{ {
int rc = 0; return sprintf(buf, "%ul\n",
obd_max_dirty_pages / (1 << (20 - PAGE_CACHE_SHIFT)));
}
static ssize_t max_dirty_mb_store(struct kobject *kobj, struct attribute *attr,
const char *buffer, size_t count)
{
int rc;
unsigned long val;
rc = kstrtoul(buffer, 10, &val);
if (rc)
return rc;
val *= 1 << (20 - PAGE_CACHE_SHIFT); /* convert to pages */
if (!table->data || !table->maxlen || !*lenp || (*ppos && !write)) { if (val > ((totalram_pages / 10) * 9)) {
*lenp = 0; /* Somebody wants to assign too much memory to dirty pages */
return 0; return -EINVAL;
} }
if (write) {
rc = lprocfs_write_frac_helper(buffer, *lenp, if (val < 4 << (20 - PAGE_CACHE_SHIFT)) {
(unsigned int *)table->data, /* Less than 4 Mb for dirty cache is also bad */
1 << (20 - PAGE_CACHE_SHIFT)); return -EINVAL;
/* Don't allow them to let dirty pages exceed 90% of system
* memory and set a hard minimum of 4MB. */
if (obd_max_dirty_pages > ((totalram_pages / 10) * 9)) {
CERROR("Refusing to set max dirty pages to %u, which is more than 90%% of available RAM; setting to %lu\n",
obd_max_dirty_pages,
((totalram_pages / 10) * 9));
obd_max_dirty_pages = (totalram_pages / 10) * 9;
} else if (obd_max_dirty_pages < 4 << (20 - PAGE_CACHE_SHIFT)) {
obd_max_dirty_pages = 4 << (20 - PAGE_CACHE_SHIFT);
}
} else {
char buf[21];
int len;
len = lprocfs_read_frac_helper(buf, sizeof(buf),
*(unsigned int *)table->data,
1 << (20 - PAGE_CACHE_SHIFT));
if (len > *lenp)
len = *lenp;
buf[len] = '\0';
if (copy_to_user(buffer, buf, len))
return -EFAULT;
*lenp = len;
} }
*ppos += *lenp;
return rc; obd_max_dirty_pages = val;
return count;
} }
LUSTRE_RW_ATTR(max_dirty_mb);
#ifdef CONFIG_SYSCTL
static struct ctl_table obd_table[] = { static struct ctl_table obd_table[] = {
{ {
.procname = "debug_peer_on_timeout", .procname = "debug_peer_on_timeout",
...@@ -164,13 +158,6 @@ static struct ctl_table obd_table[] = { ...@@ -164,13 +158,6 @@ static struct ctl_table obd_table[] = {
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec .proc_handler = &proc_dointvec
}, },
{
.procname = "max_dirty_mb",
.data = &obd_max_dirty_pages,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_max_dirty_pages_in_mb
},
{ {
.procname = "at_min", .procname = "at_min",
.data = &at_min, .data = &at_min,
...@@ -223,6 +210,7 @@ static struct ctl_table parent_table[] = { ...@@ -223,6 +210,7 @@ static struct ctl_table parent_table[] = {
static struct attribute *lustre_attrs[] = { static struct attribute *lustre_attrs[] = {
&lustre_sattr_timeout.u.attr, &lustre_sattr_timeout.u.attr,
&lustre_attr_max_dirty_mb.attr,
NULL, NULL,
}; };
......
...@@ -52,6 +52,18 @@ Description: ...@@ -52,6 +52,18 @@ Description:
AT (adaptive timeouts). AT (adaptive timeouts).
Unit: seconds, default: 100 Unit: seconds, default: 100
What: /sys/fs/lustre/max_dirty_mb
Date: June 2015
Contact: "Oleg Drokin" <oleg.drokin@intel.com>
Description:
Controls total number of dirty cache (in megabytes) allowed
across all mounted lustre filesystems.
Since writeout of dirty pages in Lustre is somewhat expensive,
when you allow to many dirty pages, this might lead to
performance degradations as kernel tries to desperately
find some pages to free/writeout.
Default 1/2 RAM. Min value 4, max value 9/10 of RAM.
What: /sys/fs/lustre/llite/<fsname>-<uuid>/blocksize What: /sys/fs/lustre/llite/<fsname>-<uuid>/blocksize
Date: May 2015 Date: May 2015
Contact: "Oleg Drokin" <oleg.drokin@intel.com> Contact: "Oleg Drokin" <oleg.drokin@intel.com>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment