Merge branch 'master' of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into dma-mapping-for-next
Pull in the latest 5.9 tree for the commit to revert the V4L2_FLAG_MEMORY_NON_CONSISTENT uapi addition.
This commit is contained in:
49
mm/hugetlb.c
49
mm/hugetlb.c
@@ -1250,21 +1250,32 @@ static struct page *alloc_gigantic_page(struct hstate *h, gfp_t gfp_mask,
|
||||
int nid, nodemask_t *nodemask)
|
||||
{
|
||||
unsigned long nr_pages = 1UL << huge_page_order(h);
|
||||
if (nid == NUMA_NO_NODE)
|
||||
nid = numa_mem_id();
|
||||
|
||||
#ifdef CONFIG_CMA
|
||||
{
|
||||
struct page *page;
|
||||
int node;
|
||||
|
||||
for_each_node_mask(node, *nodemask) {
|
||||
if (!hugetlb_cma[node])
|
||||
continue;
|
||||
|
||||
page = cma_alloc(hugetlb_cma[node], nr_pages,
|
||||
huge_page_order(h), true);
|
||||
if (hugetlb_cma[nid]) {
|
||||
page = cma_alloc(hugetlb_cma[nid], nr_pages,
|
||||
huge_page_order(h), true);
|
||||
if (page)
|
||||
return page;
|
||||
}
|
||||
|
||||
if (!(gfp_mask & __GFP_THISNODE)) {
|
||||
for_each_node_mask(node, *nodemask) {
|
||||
if (node == nid || !hugetlb_cma[node])
|
||||
continue;
|
||||
|
||||
page = cma_alloc(hugetlb_cma[node], nr_pages,
|
||||
huge_page_order(h), true);
|
||||
if (page)
|
||||
return page;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -3454,6 +3465,22 @@ static unsigned int allowed_mems_nr(struct hstate *h)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
static int proc_hugetlb_doulongvec_minmax(struct ctl_table *table, int write,
|
||||
void *buffer, size_t *length,
|
||||
loff_t *ppos, unsigned long *out)
|
||||
{
|
||||
struct ctl_table dup_table;
|
||||
|
||||
/*
|
||||
* In order to avoid races with __do_proc_doulongvec_minmax(), we
|
||||
* can duplicate the @table and alter the duplicate of it.
|
||||
*/
|
||||
dup_table = *table;
|
||||
dup_table.data = out;
|
||||
|
||||
return proc_doulongvec_minmax(&dup_table, write, buffer, length, ppos);
|
||||
}
|
||||
|
||||
static int hugetlb_sysctl_handler_common(bool obey_mempolicy,
|
||||
struct ctl_table *table, int write,
|
||||
void *buffer, size_t *length, loff_t *ppos)
|
||||
@@ -3465,9 +3492,8 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy,
|
||||
if (!hugepages_supported())
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
table->data = &tmp;
|
||||
table->maxlen = sizeof(unsigned long);
|
||||
ret = proc_doulongvec_minmax(table, write, buffer, length, ppos);
|
||||
ret = proc_hugetlb_doulongvec_minmax(table, write, buffer, length, ppos,
|
||||
&tmp);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
@@ -3510,9 +3536,8 @@ int hugetlb_overcommit_handler(struct ctl_table *table, int write,
|
||||
if (write && hstate_is_gigantic(h))
|
||||
return -EINVAL;
|
||||
|
||||
table->data = &tmp;
|
||||
table->maxlen = sizeof(unsigned long);
|
||||
ret = proc_doulongvec_minmax(table, write, buffer, length, ppos);
|
||||
ret = proc_hugetlb_doulongvec_minmax(table, write, buffer, length, ppos,
|
||||
&tmp);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user