aboutsummaryrefslogtreecommitdiffstats
path: root/mm/hugetlb.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r--mm/hugetlb.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 246192929a2d..c82290b9c1fc 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1981,11 +1981,7 @@ static int __init hugetlb_init(void)
1981{ 1981{
1982 int i; 1982 int i;
1983 1983
1984 /* Some platform decide whether they support huge pages at boot 1984 if (!hugepages_supported())
1985 * time. On these, such as powerpc, HPAGE_SHIFT is set to 0 when
1986 * there is no such support
1987 */
1988 if (HPAGE_SHIFT == 0)
1989 return 0; 1985 return 0;
1990 1986
1991 if (!size_to_hstate(default_hstate_size)) { 1987 if (!size_to_hstate(default_hstate_size)) {
@@ -2112,6 +2108,9 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy,
2112 unsigned long tmp; 2108 unsigned long tmp;
2113 int ret; 2109 int ret;
2114 2110
2111 if (!hugepages_supported())
2112 return -ENOTSUPP;
2113
2115 tmp = h->max_huge_pages; 2114 tmp = h->max_huge_pages;
2116 2115
2117 if (write && h->order >= MAX_ORDER) 2116 if (write && h->order >= MAX_ORDER)
@@ -2165,6 +2164,9 @@ int hugetlb_overcommit_handler(struct ctl_table *table, int write,
2165 unsigned long tmp; 2164 unsigned long tmp;
2166 int ret; 2165 int ret;
2167 2166
2167 if (!hugepages_supported())
2168 return -ENOTSUPP;
2169
2168 tmp = h->nr_overcommit_huge_pages; 2170 tmp = h->nr_overcommit_huge_pages;
2169 2171
2170 if (write && h->order >= MAX_ORDER) 2172 if (write && h->order >= MAX_ORDER)
@@ -2190,6 +2192,8 @@ out:
2190void hugetlb_report_meminfo(struct seq_file *m) 2192void hugetlb_report_meminfo(struct seq_file *m)
2191{ 2193{
2192 struct hstate *h = &default_hstate; 2194 struct hstate *h = &default_hstate;
2195 if (!hugepages_supported())
2196 return;
2193 seq_printf(m, 2197 seq_printf(m,
2194 "HugePages_Total: %5lu\n" 2198 "HugePages_Total: %5lu\n"
2195 "HugePages_Free: %5lu\n" 2199 "HugePages_Free: %5lu\n"
@@ -2206,6 +2210,8 @@ void hugetlb_report_meminfo(struct seq_file *m)
2206int hugetlb_report_node_meminfo(int nid, char *buf) 2210int hugetlb_report_node_meminfo(int nid, char *buf)
2207{ 2211{
2208 struct hstate *h = &default_hstate; 2212 struct hstate *h = &default_hstate;
2213 if (!hugepages_supported())
2214 return 0;
2209 return sprintf(buf, 2215 return sprintf(buf,
2210 "Node %d HugePages_Total: %5u\n" 2216 "Node %d HugePages_Total: %5u\n"
2211 "Node %d HugePages_Free: %5u\n" 2217 "Node %d HugePages_Free: %5u\n"
@@ -2220,6 +2226,9 @@ void hugetlb_show_meminfo(void)
2220 struct hstate *h; 2226 struct hstate *h;
2221 int nid; 2227 int nid;
2222 2228
2229 if (!hugepages_supported())
2230 return;
2231
2223 for_each_node_state(nid, N_MEMORY) 2232 for_each_node_state(nid, N_MEMORY)
2224 for_each_hstate(h) 2233 for_each_hstate(h)
2225 pr_info("Node %d hugepages_total=%u hugepages_free=%u hugepages_surp=%u hugepages_size=%lukB\n", 2234 pr_info("Node %d hugepages_total=%u hugepages_free=%u hugepages_surp=%u hugepages_size=%lukB\n",