|
@@ -1981,11 +1981,7 @@ static int __init hugetlb_init(void)
|
|
|
{
|
|
|
int i;
|
|
|
|
|
|
- /* Some platform decide whether they support huge pages at boot
|
|
|
- * time. On these, such as powerpc, HPAGE_SHIFT is set to 0 when
|
|
|
- * there is no such support
|
|
|
- */
|
|
|
- if (HPAGE_SHIFT == 0)
|
|
|
+ if (!hugepages_supported())
|
|
|
return 0;
|
|
|
|
|
|
if (!size_to_hstate(default_hstate_size)) {
|
|
@@ -2112,6 +2108,9 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy,
|
|
|
unsigned long tmp;
|
|
|
int ret;
|
|
|
|
|
|
+ if (!hugepages_supported())
|
|
|
+ return -ENOTSUPP;
|
|
|
+
|
|
|
tmp = h->max_huge_pages;
|
|
|
|
|
|
if (write && h->order >= MAX_ORDER)
|
|
@@ -2165,6 +2164,9 @@ int hugetlb_overcommit_handler(struct ctl_table *table, int write,
|
|
|
unsigned long tmp;
|
|
|
int ret;
|
|
|
|
|
|
+ if (!hugepages_supported())
|
|
|
+ return -ENOTSUPP;
|
|
|
+
|
|
|
tmp = h->nr_overcommit_huge_pages;
|
|
|
|
|
|
if (write && h->order >= MAX_ORDER)
|
|
@@ -2190,6 +2192,8 @@ out:
|
|
|
void hugetlb_report_meminfo(struct seq_file *m)
|
|
|
{
|
|
|
struct hstate *h = &default_hstate;
|
|
|
+ if (!hugepages_supported())
|
|
|
+ return;
|
|
|
seq_printf(m,
|
|
|
"HugePages_Total: %5lu\n"
|
|
|
"HugePages_Free: %5lu\n"
|
|
@@ -2206,6 +2210,8 @@ void hugetlb_report_meminfo(struct seq_file *m)
|
|
|
int hugetlb_report_node_meminfo(int nid, char *buf)
|
|
|
{
|
|
|
struct hstate *h = &default_hstate;
|
|
|
+ if (!hugepages_supported())
|
|
|
+ return 0;
|
|
|
return sprintf(buf,
|
|
|
"Node %d HugePages_Total: %5u\n"
|
|
|
"Node %d HugePages_Free: %5u\n"
|
|
@@ -2220,6 +2226,9 @@ void hugetlb_show_meminfo(void)
|
|
|
struct hstate *h;
|
|
|
int nid;
|
|
|
|
|
|
+ if (!hugepages_supported())
|
|
|
+ return;
|
|
|
+
|
|
|
for_each_node_state(nid, N_MEMORY)
|
|
|
for_each_hstate(h)
|
|
|
pr_info("Node %d hugepages_total=%u hugepages_free=%u hugepages_surp=%u hugepages_size=%lukB\n",
|