| 1360 | } |
| 1361 | |
| 1362 | static void |
| 1363 | exec_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 | } |
| 1392 | EVENTHANDLER_DEFINE(vm_lowmem, exec_args_kva_lowmem, NULL, |
| 1393 | EVENTHANDLER_PRI_ANY); |
| 1394 |
nothing calls this directly
no test coverage detected