Hi!
I'm looking at supporting huge pmds and puds on VM_MIXEDMAPs for the TTM
graphics memory manager. While huge puds might not be that common, huge
pmds will probably be.
We would also want to support vrite-notify vmas, in which case we need
to split the pud / pmds, and handle the write-notification on the pte
level. Today we also support cow mappings, but I'm not sure anyone ever
used it in this context. I figure in this case we just split the huge
puds / pmds and we should be fine.
In any case, over to the questions:
In __handle_mm_fault() we call pmd_alloc() without considering puds
being unstable (somewone faulting in a huge pud entry, or madvise()
removing a huge pud entry). Is there some kind of special mechanism
taking care of that potential race?
https://elixir.bootlin.com/linux/latest/source/mm/memory.c#L3931
In wp_huge_pmd() and wp_huge_pud(), if huge_fault() returns
VM_FAULT_FALLBACK, and there is an existing read-only huge entry, we
don't split that entry, causing the write fault to be endlessly retried.
Is this an oversight or is the huge_fault handler responsible for
splitting the huge entry?
https://elixir.bootlin.com/linux/latest/source/mm/memory.c#L3738
https://elixir.bootlin.com/linux/latest/source/mm/memory.c#L3769
Any insight or comments would be appreciated.
Thanks,
Thomas