Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 230823
b: refs/heads/master
c: adbe872
h: refs/heads/master
i:
  230821: 39f500f
  230819: c467284
  230815: 7f80343
v: v3
  • Loading branch information
Eric B Munson authored and Linus Torvalds committed Jan 14, 2011
1 parent 482ef66 commit fa216e8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 08d4a24659f1284f33e574211435aa12ce968477
refs/heads/master: adbe8726dc2a3805630d517270db17e3af86e526
23 changes: 21 additions & 2 deletions trunk/mm/hugetlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1363,6 +1363,7 @@ static ssize_t nr_hugepages_show_common(struct kobject *kobj,

return sprintf(buf, "%lu\n", nr_huge_pages);
}

static ssize_t nr_hugepages_store_common(bool obey_mempolicy,
struct kobject *kobj, struct kobj_attribute *attr,
const char *buf, size_t len)
Expand All @@ -1375,11 +1376,16 @@ static ssize_t nr_hugepages_store_common(bool obey_mempolicy,

err = strict_strtoul(buf, 10, &count);
if (err) {
NODEMASK_FREE(nodes_allowed);
return 0;
err = 0; /* This seems wrong */
goto out;
}

h = kobj_to_hstate(kobj, &nid);
if (h->order >= MAX_ORDER) {
err = -EINVAL;
goto out;
}

if (nid == NUMA_NO_NODE) {
/*
* global hstate attribute
Expand All @@ -1405,6 +1411,9 @@ static ssize_t nr_hugepages_store_common(bool obey_mempolicy,
NODEMASK_FREE(nodes_allowed);

return len;
out:
NODEMASK_FREE(nodes_allowed);
return err;
}

static ssize_t nr_hugepages_show(struct kobject *kobj,
Expand Down Expand Up @@ -1447,13 +1456,17 @@ static ssize_t nr_overcommit_hugepages_show(struct kobject *kobj,
struct hstate *h = kobj_to_hstate(kobj, NULL);
return sprintf(buf, "%lu\n", h->nr_overcommit_huge_pages);
}

static ssize_t nr_overcommit_hugepages_store(struct kobject *kobj,
struct kobj_attribute *attr, const char *buf, size_t count)
{
int err;
unsigned long input;
struct hstate *h = kobj_to_hstate(kobj, NULL);

if (h->order >= MAX_ORDER)
return -EINVAL;

err = strict_strtoul(buf, 10, &input);
if (err)
return 0;
Expand Down Expand Up @@ -1864,6 +1877,9 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy,
if (!write)
tmp = h->max_huge_pages;

if (write && h->order >= MAX_ORDER)
return -EINVAL;

table->data = &tmp;
table->maxlen = sizeof(unsigned long);
ret = proc_doulongvec_minmax(table, write, buffer, length, ppos);
Expand Down Expand Up @@ -1927,6 +1943,9 @@ int hugetlb_overcommit_handler(struct ctl_table *table, int write,
if (!write)
tmp = h->nr_overcommit_huge_pages;

if (write && h->order >= MAX_ORDER)
return -EINVAL;

table->data = &tmp;
table->maxlen = sizeof(unsigned long);
ret = proc_doulongvec_minmax(table, write, buffer, length, ppos);
Expand Down

0 comments on commit fa216e8

Please sign in to comment.