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

Function exec_args_kva_lowmem

freebsd/kern/kern_exec.c:1362–1391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1360}
1361
1362static void
1363exec_args_kva_lowmem(void *arg __unused)
1364{
1365 SLIST_HEAD(, exec_args_kva) head;
1366 struct exec_args_kva *argkva;
1367 u_int gen;
1368 int i;
1369
1370 gen = atomic_fetchadd_int(&exec_args_gen, 1) + 1;
1371
1372 /*
1373 * Force an madvise of each KVA range. Any currently allocated ranges
1374 * will have MADV_FREE applied once they are freed.
1375 */
1376 SLIST_INIT(&head);
1377 mtx_lock(&exec_args_kva_mtx);
1378 SLIST_SWAP(&head, &exec_args_kva_freelist, exec_args_kva);
1379 mtx_unlock(&exec_args_kva_mtx);
1380 while ((argkva = SLIST_FIRST(&head)) != NULL) {
1381 SLIST_REMOVE_HEAD(&head, next);
1382 exec_release_args_kva(argkva, gen);
1383 }
1384
1385 CPU_FOREACH(i) {
1386 argkva = (void *)atomic_readandclear_ptr(
1387 (uintptr_t *)DPCPU_ID_PTR(i, exec_args_kva));
1388 if (argkva != NULL)
1389 exec_release_args_kva(argkva, gen);
1390 }
1391}
1392EVENTHANDLER_DEFINE(vm_lowmem, exec_args_kva_lowmem, NULL,
1393 EVENTHANDLER_PRI_ANY);
1394

Callers

nothing calls this directly

Calls 4

exec_release_args_kvaFunction · 0.85
mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70
atomic_fetchadd_intFunction · 0.50

Tested by

no test coverage detected