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: Oleg Drokin <green@linuxhacker.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e2424a1265
commit
df476a4d5d
2 changed files with 46 additions and 46 deletions
|
@ -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)));
|
||||||
if (!table->data || !table->maxlen || !*lenp || (*ppos && !write)) {
|
|
||||||
*lenp = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (write) {
|
|
||||||
rc = lprocfs_write_frac_helper(buffer, *lenp,
|
|
||||||
(unsigned int *)table->data,
|
|
||||||
1 << (20 - PAGE_CACHE_SHIFT));
|
|
||||||
/* 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 (val > ((totalram_pages / 10) * 9)) {
|
||||||
|
/* Somebody wants to assign too much memory to dirty pages */
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (val < 4 << (20 - PAGE_CACHE_SHIFT)) {
|
||||||
|
/* Less than 4 Mb for dirty cache is also bad */
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
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[] = {
|
||||||
.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[] = {
|
||||||
|
|
||||||
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:
|
||||||
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>
|
||||||
|
|
Loading…
Add table
Reference in a new issue