Lines Matching full:slots

3  * Manage cache of swap slots to be used for and returned from
10 * We allocate the swap slots from the global pool and put
17 * lock. We do not reuse the returned slots directly but
19 * allows the slots to coalesce and reduce fragmentation.
25 * The swap slots cache is protected by a mutex instead of
26 * a spin lock as when we search for slots with scan_swap_map,
43 /* Serialize swap slots cache enable/disable operations */
116 swp_entry_t *slots, *slots_ret; in alloc_swap_slot_cache() local
123 slots = kvcalloc(SWAP_SLOTS_CACHE_SIZE, sizeof(swp_entry_t), in alloc_swap_slot_cache()
125 if (!slots) in alloc_swap_slot_cache()
131 kvfree(slots); in alloc_swap_slot_cache()
137 if (cache->slots || cache->slots_ret) { in alloc_swap_slot_cache()
141 kvfree(slots); in alloc_swap_slot_cache()
157 * !cache->slots or !cache->slots_ret to know if it is safe to acquire in alloc_swap_slot_cache()
162 cache->slots = slots; in alloc_swap_slot_cache()
172 swp_entry_t *slots = NULL; in drain_slots_cache_cpu() local
175 if ((type & SLOTS_CACHE) && cache->slots) { in drain_slots_cache_cpu()
177 swapcache_free_entries(cache->slots + cache->cur, cache->nr); in drain_slots_cache_cpu()
180 if (free_slots && cache->slots) { in drain_slots_cache_cpu()
181 kvfree(cache->slots); in drain_slots_cache_cpu()
182 cache->slots = NULL; in drain_slots_cache_cpu()
191 slots = cache->slots_ret; in drain_slots_cache_cpu()
195 kvfree(slots); in drain_slots_cache_cpu()
206 * left over slots are in cache when we remove in __drain_swap_slots_cache()
209 * on swap slots when allocating memory and need in __drain_swap_slots_cache()
210 * to return swap slots to global pool. in __drain_swap_slots_cache()
223 * fill any swap slots in slots cache of such cpu. in __drain_swap_slots_cache()
224 * There are no slots on such cpu that need to be drained. in __drain_swap_slots_cache()
247 "without swap slots cache.\n", __func__)) in enable_swap_slots_cache()
267 cache->slots, 1); in refill_swap_slots_cache()
279 /* Swap slots cache may be deactivated before acquiring lock */ in free_swap_slot()
286 * Return slots to global pool. in free_swap_slot()
326 if (likely(check_cache_active() && cache->slots)) { in folio_alloc_swap()
328 if (cache->slots) { in folio_alloc_swap()
331 entry = cache->slots[cache->cur]; in folio_alloc_swap()
332 cache->slots[cache->cur++].val = 0; in folio_alloc_swap()