File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -6262,6 +6262,25 @@ int hugetlb_mfill_atomic_pte(pte_t *dst_pte,
62626262 int writable ;
62636263 bool folio_in_pagecache = false;
62646264
6265+ if (uffd_flags_mode_is (flags , MFILL_ATOMIC_POISON )) {
6266+ ptl = huge_pte_lock (h , dst_mm , dst_pte );
6267+
6268+ /* Don't overwrite any existing PTEs (even markers) */
6269+ if (!huge_pte_none (huge_ptep_get (dst_pte ))) {
6270+ spin_unlock (ptl );
6271+ return - EEXIST ;
6272+ }
6273+
6274+ _dst_pte = make_pte_marker (PTE_MARKER_POISONED );
6275+ set_huge_pte_at (dst_mm , dst_addr , dst_pte , _dst_pte );
6276+
6277+ /* No need to invalidate - it was non-present before */
6278+ update_mmu_cache (dst_vma , dst_addr , dst_pte );
6279+
6280+ spin_unlock (ptl );
6281+ return 0 ;
6282+ }
6283+
62656284 if (is_continue ) {
62666285 ret = - EFAULT ;
62676286 folio = filemap_lock_folio (mapping , idx );
Original file line number Diff line number Diff line change @@ -377,8 +377,7 @@ static __always_inline ssize_t mfill_atomic_hugetlb(
377377 * by THP. Since we can not reliably insert a zero page, this
378378 * feature is not supported.
379379 */
380- if (uffd_flags_mode_is (flags , MFILL_ATOMIC_ZEROPAGE ) ||
381- uffd_flags_mode_is (flags , MFILL_ATOMIC_POISON )) {
380+ if (uffd_flags_mode_is (flags , MFILL_ATOMIC_ZEROPAGE )) {
382381 mmap_read_unlock (dst_mm );
383382 return - EINVAL ;
384383 }
You can’t perform that action at this time.
0 commit comments