MCPcopy Create free account
hub / github.com/F-Stack/f-stack / kmem_alloc_contig_pages

Function kmem_alloc_contig_pages

freebsd/vm/vm_kern.c:173–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171}
172
173static vm_page_t
174kmem_alloc_contig_pages(vm_object_t object, vm_pindex_t pindex, int domain,
175 int pflags, u_long npages, vm_paddr_t low, vm_paddr_t high,
176 u_long alignment, vm_paddr_t boundary, vm_memattr_t memattr)
177{
178 vm_page_t m;
179 int tries;
180 bool wait;
181
182 VM_OBJECT_ASSERT_WLOCKED(object);
183
184 wait = (pflags & VM_ALLOC_WAITOK) != 0;
185 pflags &= ~(VM_ALLOC_NOWAIT | VM_ALLOC_WAITOK | VM_ALLOC_WAITFAIL);
186 pflags |= VM_ALLOC_NOWAIT;
187 for (tries = wait ? 3 : 1;; tries--) {
188 m = vm_page_alloc_contig_domain(object, pindex, domain, pflags,
189 npages, low, high, alignment, boundary, memattr);
190 if (m != NULL || tries == 0)
191 break;
192
193 VM_OBJECT_WUNLOCK(object);
194 if (!vm_page_reclaim_contig_domain(domain, pflags, npages,
195 low, high, alignment, boundary) && wait)
196 vm_wait_domain(domain);
197 VM_OBJECT_WLOCK(object);
198 }
199 return (m);
200}
201
202/*
203 * Allocates a region from the kernel address map and physical pages

Callers 2

kmem_alloc_attr_domainFunction · 0.85
kmem_alloc_contig_domainFunction · 0.85

Calls 3

vm_wait_domainFunction · 0.85

Tested by

no test coverage detected