From: kernel test robot <lkp@intel.com>
To: "Kiryl Shutsemau (Meta)" <kas@kernel.org>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [kas:uffd/rfc-v3 2/9] mm/huge_memory.c:2644:43: error: 'PAGE_NONE' undeclared; did you mean 'PAGE_U_NONE'?
Date: Mon, 20 Apr 2026 18:36:53 +0800 [thread overview]
Message-ID: <202604201849.LXRq9cVf-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/kas/linux.git uffd/rfc-v3
head: fa6a4bc0ae172e756264bbe74bea1d95acb29b02
commit: 25dab3d3a0ffa02119bbf5873d46ba0af562a502 [2/9] mm: add MM_CP_UFFD_RWP change_protection() flag
config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20260420/202604201849.LXRq9cVf-lkp@intel.com/config)
compiler: arc-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260420/202604201849.LXRq9cVf-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604201849.LXRq9cVf-lkp@intel.com/
All errors (new ones prefixed by >>):
mm/huge_memory.c: In function 'change_huge_pmd':
>> mm/huge_memory.c:2644:43: error: 'PAGE_NONE' undeclared (first use in this function); did you mean 'PAGE_U_NONE'?
2644 | entry = pmd_modify(entry, PAGE_NONE);
| ^~~~~~~~~
| PAGE_U_NONE
mm/huge_memory.c:2644:43: note: each undeclared identifier is reported only once for each function it appears in
vim +2644 mm/huge_memory.c
2550
2551 /*
2552 * Returns
2553 * - 0 if PMD could not be locked
2554 * - 1 if PMD was locked but protections unchanged and TLB flush unnecessary
2555 * or if prot_numa but THP migration is not supported
2556 * - HPAGE_PMD_NR if protections changed and TLB flush necessary
2557 */
2558 int change_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
2559 pmd_t *pmd, unsigned long addr, pgprot_t newprot,
2560 unsigned long cp_flags)
2561 {
2562 struct mm_struct *mm = vma->vm_mm;
2563 spinlock_t *ptl;
2564 pmd_t oldpmd, entry;
2565 bool prot_numa = cp_flags & MM_CP_PROT_NUMA;
2566 bool uffd_rwp = cp_flags & MM_CP_UFFD_RWP;
2567 bool uffd_rwp_resolve = cp_flags & MM_CP_UFFD_RWP_RESOLVE;
2568 bool uffd_wp = cp_flags & MM_CP_UFFD_WP;
2569 bool uffd_wp_resolve = cp_flags & MM_CP_UFFD_WP_RESOLVE;
2570 int ret = 1;
2571
2572 tlb_change_page_size(tlb, HPAGE_PMD_SIZE);
2573
2574 if (prot_numa && !thp_migration_supported())
2575 return 1;
2576
2577 ptl = __pmd_trans_huge_lock(pmd, vma);
2578 if (!ptl)
2579 return 0;
2580
2581 if (thp_migration_supported() && pmd_is_valid_softleaf(*pmd)) {
2582 change_non_present_huge_pmd(mm, addr, pmd,
2583 uffd_wp || uffd_rwp,
2584 uffd_wp_resolve || uffd_rwp_resolve);
2585 goto unlock;
2586 }
2587
2588 /* Already in the desired state */
2589 if (prot_numa && pmd_protnone(*pmd))
2590 goto unlock;
2591 if (uffd_rwp && pmd_protnone(*pmd) && pmd_uffd_wp(*pmd))
2592 goto unlock;
2593
2594 if (prot_numa) {
2595
2596 /*
2597 * Avoid trapping faults against the zero page. The read-only
2598 * data is likely to be read-cached on the local CPU and
2599 * local/remote hits to the zero page are not interesting.
2600 */
2601 if (is_huge_zero_pmd(*pmd))
2602 goto unlock;
2603
2604 if (!folio_can_map_prot_numa(pmd_folio(*pmd), vma,
2605 vma_is_single_threaded_private(vma)))
2606 goto unlock;
2607 }
2608 /*
2609 * In case prot_numa, we are under mmap_read_lock(mm). It's critical
2610 * to not clear pmd intermittently to avoid race with MADV_DONTNEED
2611 * which is also under mmap_read_lock(mm):
2612 *
2613 * CPU0: CPU1:
2614 * change_huge_pmd(prot_numa=1)
2615 * pmdp_huge_get_and_clear_notify()
2616 * madvise_dontneed()
2617 * zap_pmd_range()
2618 * pmd_trans_huge(*pmd) == 0 (without ptl)
2619 * // skip the pmd
2620 * set_pmd_at();
2621 * // pmd is re-established
2622 *
2623 * The race makes MADV_DONTNEED miss the huge pmd and don't clear it
2624 * which may break userspace.
2625 *
2626 * pmdp_invalidate_ad() is required to make sure we don't miss
2627 * dirty/young flags set by hardware.
2628 */
2629 oldpmd = pmdp_invalidate_ad(vma, addr, pmd);
2630
2631 entry = pmd_modify(oldpmd, newprot);
2632 if (uffd_wp || uffd_rwp)
2633 entry = pmd_mkuffd_wp(entry);
2634 else if (uffd_wp_resolve || uffd_rwp_resolve)
2635 /*
2636 * Leave the write bit to be handled by PF interrupt
2637 * handler, then things like COW could be properly
2638 * handled.
2639 */
2640 entry = pmd_clear_uffd_wp(entry);
2641
2642 /* See change_pte_range(): preserve RWP protection across mprotect() */
2643 if (userfaultfd_rwp(vma) && pmd_uffd_wp(entry))
> 2644 entry = pmd_modify(entry, PAGE_NONE);
2645
2646 /* See change_pte_range(). */
2647 if ((cp_flags & MM_CP_TRY_CHANGE_WRITABLE) && !pmd_write(entry) &&
2648 can_change_pmd_writable(vma, addr, entry))
2649 entry = pmd_mkwrite(entry, vma);
2650
2651 ret = HPAGE_PMD_NR;
2652 set_pmd_at(mm, addr, pmd, entry);
2653
2654 if (huge_pmd_needs_flush(oldpmd, entry))
2655 tlb_flush_pmd_range(tlb, addr, HPAGE_PMD_SIZE);
2656 unlock:
2657 spin_unlock(ptl);
2658 return ret;
2659 }
2660
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-04-20 10:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202604201849.LXRq9cVf-lkp@intel.com \
--to=lkp@intel.com \
--cc=kas@kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.