| 1737 | |
| 1738 | #ifndef FSTACK |
| 1739 | static void * |
| 1740 | pcpu_page_alloc(uma_zone_t zone, vm_size_t bytes, int domain, uint8_t *pflag, |
| 1741 | int wait) |
| 1742 | { |
| 1743 | struct pglist alloctail; |
| 1744 | vm_offset_t addr, zkva; |
| 1745 | int cpu, flags; |
| 1746 | vm_page_t p, p_next; |
| 1747 | #ifdef NUMA |
| 1748 | struct pcpu *pc; |
| 1749 | #endif |
| 1750 | |
| 1751 | MPASS(bytes == (mp_maxid + 1) * PAGE_SIZE); |
| 1752 | |
| 1753 | TAILQ_INIT(&alloctail); |
| 1754 | flags = VM_ALLOC_SYSTEM | VM_ALLOC_WIRED | VM_ALLOC_NOOBJ | |
| 1755 | malloc2vm_flags(wait); |
| 1756 | *pflag = UMA_SLAB_KERNEL; |
| 1757 | for (cpu = 0; cpu <= mp_maxid; cpu++) { |
| 1758 | if (CPU_ABSENT(cpu)) { |
| 1759 | p = vm_page_alloc(NULL, 0, flags); |
| 1760 | } else { |
| 1761 | #ifndef NUMA |
| 1762 | p = vm_page_alloc(NULL, 0, flags); |
| 1763 | #else |
| 1764 | pc = pcpu_find(cpu); |
| 1765 | if (__predict_false(VM_DOMAIN_EMPTY(pc->pc_domain))) |
| 1766 | p = NULL; |
| 1767 | else |
| 1768 | p = vm_page_alloc_domain(NULL, 0, |
| 1769 | pc->pc_domain, flags); |
| 1770 | if (__predict_false(p == NULL)) |
| 1771 | p = vm_page_alloc(NULL, 0, flags); |
| 1772 | #endif |
| 1773 | } |
| 1774 | if (__predict_false(p == NULL)) |
| 1775 | goto fail; |
| 1776 | TAILQ_INSERT_TAIL(&alloctail, p, listq); |
| 1777 | } |
| 1778 | if ((addr = kva_alloc(bytes)) == 0) |
| 1779 | goto fail; |
| 1780 | zkva = addr; |
| 1781 | TAILQ_FOREACH(p, &alloctail, listq) { |
| 1782 | pmap_qenter(zkva, &p, 1); |
| 1783 | zkva += PAGE_SIZE; |
| 1784 | } |
| 1785 | return ((void*)addr); |
| 1786 | fail: |
| 1787 | TAILQ_FOREACH_SAFE(p, &alloctail, listq, p_next) { |
| 1788 | vm_page_unwire_noq(p); |
| 1789 | vm_page_free(p); |
| 1790 | } |
| 1791 | return (NULL); |
| 1792 | } |
| 1793 | |
| 1794 | /* |
| 1795 | * Allocates a number of pages from within an object |
nothing calls this directly
no test coverage detected