Dev Jain
ebcfc63d6b
mm: abstract THP allocation
Patch series "Do not shatter hugezeropage on wp-fault", v7.
It was observed at [1] and [2] that the current kernel behaviour of
shattering a hugezeropage is inconsistent and suboptimal. For a VMA with
a THP allowable order, when we write-fault on it, the kernel installs a
PMD-mapped THP. On the other hand, if we first get a read fault, we get a
PMD pointing to the hugezeropage; subsequent write will trigger a
write-protection fault, shattering the hugezeropage into one writable
page, and all the other PTEs write-protected. The conclusion being, as
compared to the case of a single write-fault, applications have to suffer
512 extra page faults if they were to use the VMA as such, plus we get the
overhead of khugepaged trying to replace that area with a THP anyway.
Instead, replace the hugezeropage with a THP on wp-fault.
[1]: https://lore.kernel.org/all/3743d7e1-0b79-4eaf-82d5-d1ca29fe347d@arm.com/
[2]: https://lore.kernel.org/all/1cfae0c0-96a2-4308-9c62-f7a640520242@arm.com/
This patch (of 2):
In preparation for the second patch, abstract away the THP allocation
logic present in the create_huge_pmd() path, which corresponds to the
faulting case when no page is present.
There should be no functional change as a result of applying this patch,
except that, as David notes at [1], a PMD-aligned address should be passed
to update_mmu_cache_pmd().
[1]: https://lore.kernel.org/all/ddd3fcd2-48b3-4170-bcaa-2fe66e093f43@redhat.com/
Link: https://lkml.kernel.org/r/20241008061746.285961-1-dev.jain@arm.com
Link: https://lkml.kernel.org/r/20241008061746.285961-2-dev.jain@arm.com
Signed-off-by: Dev Jain <dev.jain@arm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@kernel.org>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Barry Song <baohua@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christoph Lameter <cl@gentwo.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Lance Yang <ioworker0@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Will Deacon <will@kernel.org>
Cc: Yang Shi <yang@os.amperecomputing.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-11-06 20:11:11 -08:00
..
2024-11-05 16:56:21 -08:00
2024-11-05 16:56:21 -08:00
2024-09-26 14:01:44 -07:00
2024-07-03 19:30:26 -07:00
2024-05-05 17:53:51 -07:00
2024-07-03 19:30:00 -07:00
2023-10-25 16:47:13 -07:00
2024-02-22 10:24:57 -08:00
2024-11-05 16:56:30 -08:00
2024-02-22 10:24:57 -08:00
2024-09-03 21:15:47 -07:00
2024-04-25 20:56:04 -07:00
2024-09-17 01:07:01 -07:00
2024-09-03 21:15:43 -07:00
2024-07-03 19:29:58 -07:00
2023-12-05 11:17:58 +01:00
2023-06-09 16:25:56 -07:00
2024-05-14 00:31:43 -07:00
2024-08-12 22:00:43 -04:00
2024-09-01 20:43:33 -07:00
2024-09-01 20:43:33 -07:00
2024-11-05 16:56:26 -08:00
2024-09-09 16:38:59 -07:00
2023-06-23 16:58:19 -07:00
2024-11-06 20:11:08 -08:00
2024-07-03 19:30:06 -07:00
2024-07-12 15:52:15 -07:00
2024-11-06 20:11:11 -08:00
2024-09-01 20:25:50 -07:00
2024-09-01 20:25:45 -07:00
2023-10-25 16:47:14 -07:00
2024-09-26 14:01:43 -07:00
2024-07-03 19:29:58 -07:00
2023-12-12 10:11:32 +01:00
2024-11-06 20:11:08 -08:00
2023-08-18 10:12:36 -07:00
2024-10-28 21:40:39 -07:00
2024-08-27 14:12:51 +02:00
2024-11-05 16:56:27 -08:00
2024-09-03 21:15:38 -07:00
2024-11-06 20:11:08 -08:00
2024-08-07 18:33:56 -07:00
2023-04-12 17:36:23 -07:00
2024-11-05 16:56:25 -08:00
2024-09-03 21:15:31 -07:00
2023-08-24 16:20:30 -07:00
2024-09-25 11:35:19 -07:00
2024-11-05 16:49:54 -08:00
2024-09-17 01:07:00 -07:00
2024-11-05 16:56:21 -08:00
2024-09-26 14:01:44 -07:00
2024-09-21 07:29:05 -07:00
2024-09-03 21:15:59 -07:00
2024-09-26 14:01:44 -07:00
2024-11-06 20:11:11 -08:00
2024-11-05 16:56:25 -08:00
2024-06-05 19:19:26 -07:00
2024-05-05 17:53:49 -07:00
2024-03-13 12:12:21 -07:00
2024-09-09 16:39:03 -07:00
2024-11-05 16:56:29 -08:00
2024-07-12 15:52:15 -07:00
2024-07-24 10:29:50 -07:00
2024-09-03 21:15:28 -07:00
2024-07-03 19:30:26 -07:00
2024-11-06 20:11:09 -08:00
2024-02-22 15:27:17 -08:00
2024-09-01 20:25:54 -07:00
2024-09-01 20:25:55 -07:00
2024-11-05 16:49:55 -08:00
2024-11-05 16:56:28 -08:00
2024-09-21 07:29:05 -07:00
2024-11-05 16:49:55 -08:00
2024-09-03 21:15:31 -07:00
2024-10-28 21:40:40 -07:00
2024-09-03 21:15:32 -07:00
2024-11-05 16:56:26 -08:00
2024-11-05 16:49:54 -08:00
2024-09-01 20:25:53 -07:00
2024-08-15 22:16:14 -07:00
2023-01-18 17:12:52 -08:00
2024-11-06 20:11:09 -08:00
2024-09-03 21:15:40 -07:00
2024-05-19 14:40:44 -07:00
2023-12-10 16:51:50 -08:00
2024-01-08 15:27:15 -08:00
2024-06-15 10:43:04 -07:00
2024-11-05 16:56:28 -08:00
2024-09-21 07:29:05 -07:00
2024-10-28 21:40:38 -07:00
2024-07-10 12:14:54 -07:00
2024-04-25 20:55:49 -07:00
2024-11-06 20:11:11 -08:00
2024-11-05 16:56:29 -08:00
2024-11-05 16:56:23 -08:00
2024-02-22 10:24:47 -08:00
2024-09-23 09:35:36 -07:00
2024-11-03 10:47:03 -08:00
2024-10-09 12:47:19 -07:00
2024-09-01 20:25:45 -07:00
2024-11-05 16:56:20 -08:00
2024-09-17 01:07:00 -07:00
2024-09-03 21:15:40 -07:00
2024-10-31 20:27:04 -07:00
2024-01-08 15:27:15 -08:00
2024-10-29 10:40:53 +01:00
2024-10-02 16:28:46 +02:00
2024-10-02 16:28:46 +02:00
2024-10-21 22:11:19 +08:00
2024-09-01 14:43:08 -07:00
2024-09-03 21:15:33 -07:00
2024-04-25 20:56:37 -07:00
2024-09-17 01:07:01 -07:00
2024-11-05 16:49:54 -08:00
2024-09-17 01:07:01 -07:00
2024-10-30 20:14:11 -07:00
2024-11-06 20:11:09 -08:00
2023-04-12 17:36:23 -07:00
2024-11-05 16:56:28 -08:00
2024-09-01 20:26:02 -07:00
2024-09-01 20:26:02 -07:00
2024-11-06 20:11:09 -08:00
2024-11-05 16:49:55 -08:00
2024-11-05 16:56:21 -08:00
2023-11-28 14:08:38 +01:00
2024-11-06 20:11:09 -08:00
2024-09-09 16:39:04 -07:00
2024-07-03 22:40:37 -07:00
2024-09-01 20:25:56 -07:00
2024-04-25 20:55:48 -07:00
2024-04-25 20:55:48 -07:00
2024-09-21 07:29:05 -07:00
2024-10-09 12:47:19 -07:00