thp: disable transparent hugepages by default on small systems
[firefly-linux-kernel-4.4.55.git] / mm / huge_memory.c
index 45b6d53bcfbc5bec3b5ba81c20d1abb7473933e6..892d8a17a7e5e25172c4731f11b0fc871d4ab757 100644 (file)
@@ -527,6 +527,14 @@ static int __init hugepage_init(void)
                goto out;
        }
 
+       /*
+        * By default disable transparent hugepages on smaller systems,
+        * where the extra memory used could hurt more than TLB overhead
+        * is likely to save.  The admin can still enable it through /sys.
+        */
+       if (totalram_pages < (512 << (20 - PAGE_SHIFT)))
+               transparent_hugepage_flags = 0;
+
        start_khugepaged();
 
        set_recommended_min_free_kbytes();