See uma.h */
| 4955 | |
| 4956 | /* See uma.h */ |
| 4957 | void |
| 4958 | uma_reclaim(int req) |
| 4959 | { |
| 4960 | |
| 4961 | CTR0(KTR_UMA, "UMA: vm asked us to release pages!"); |
| 4962 | sx_xlock(&uma_reclaim_lock); |
| 4963 | bucket_enable(); |
| 4964 | |
| 4965 | switch (req) { |
| 4966 | case UMA_RECLAIM_TRIM: |
| 4967 | zone_foreach(zone_trim, NULL); |
| 4968 | break; |
| 4969 | case UMA_RECLAIM_DRAIN: |
| 4970 | case UMA_RECLAIM_DRAIN_CPU: |
| 4971 | zone_foreach(zone_drain, NULL); |
| 4972 | if (req == UMA_RECLAIM_DRAIN_CPU) { |
| 4973 | pcpu_cache_drain_safe(NULL); |
| 4974 | zone_foreach(zone_drain, NULL); |
| 4975 | } |
| 4976 | break; |
| 4977 | default: |
| 4978 | panic("unhandled reclamation request %d", req); |
| 4979 | } |
| 4980 | |
| 4981 | /* |
| 4982 | * Some slabs may have been freed but this zone will be visited early |
| 4983 | * we visit again so that we can free pages that are empty once other |
| 4984 | * zones are drained. We have to do the same for buckets. |
| 4985 | */ |
| 4986 | zone_drain(slabzones[0], NULL); |
| 4987 | zone_drain(slabzones[1], NULL); |
| 4988 | bucket_zone_drain(); |
| 4989 | sx_xunlock(&uma_reclaim_lock); |
| 4990 | } |
| 4991 | |
| 4992 | static volatile int uma_reclaim_needed; |
| 4993 |
no test coverage detected