summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>2021-02-24 12:07:32 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-14 16:56:50 +0200
commit9b0b9edea1d3a08bb448465b27569b1f378900e5 (patch)
treeb4715787831c9a79755e9b2e20ff1dd9135ac386 /mm
parent0885ea1d4759adaf62404e49c570b740ec27ad1f (diff)
downloadlinux-stable-9b0b9edea1d3a08bb448465b27569b1f378900e5.tar.gz
linux-stable-9b0b9edea1d3a08bb448465b27569b1f378900e5.tar.bz2
linux-stable-9b0b9edea1d3a08bb448465b27569b1f378900e5.zip
mm/pmem: avoid inserting hugepage PTE entry with fsdax if hugepage support is disabled
[ Upstream commit bae84953815793f68ddd8edeadd3f4e32676a2c8 ] Differentiate between hardware not supporting hugepages and user disabling THP via 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' For the devdax namespace, the kernel handles the above via the supported_alignment attribute and failing to initialize the namespace if the namespace align value is not supported on the platform. For the fsdax namespace, the kernel will continue to initialize the namespace. This can result in the kernel creating a huge pte entry even though the hardware don't support the same. We do want hugepage support with pmem even if the end-user disabled THP via sysfs file (/sys/kernel/mm/transparent_hugepage/enabled). Hence differentiate between hardware/firmware lacking support vs user-controlled disable of THP and prevent a huge fault if the hardware lacks hugepage support. Link: https://lkml.kernel.org/r/20210205023956.417587-1-aneesh.kumar@linux.ibm.com Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com> Cc: Jan Kara <jack@suse.cz> Cc: David Hildenbrand <david@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/huge_memory.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 6301ecc1f679..f1432d4d81c7 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -375,7 +375,11 @@ static int __init hugepage_init(void)
struct kobject *hugepage_kobj;
if (!has_transparent_hugepage()) {
- transparent_hugepage_flags = 0;
+ /*
+ * Hardware doesn't support hugepages, hence disable
+ * DAX PMD support.
+ */
+ transparent_hugepage_flags = 1 << TRANSPARENT_HUGEPAGE_NEVER_DAX;
return -EINVAL;
}