Lines Matching refs: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;
123 slots = kvcalloc(SWAP_SLOTS_CACHE_SIZE, sizeof(swp_entry_t),
125 if (!slots)
131 kvfree(slots);
137 if (cache->slots || cache->slots_ret) {
141 kvfree(slots);
157 * !cache->slots or !cache->slots_ret to know if it is safe to acquire
162 cache->slots = slots;
172 swp_entry_t *slots = NULL;
175 if ((type & SLOTS_CACHE) && cache->slots) {
177 swapcache_free_entries(cache->slots + cache->cur, cache->nr);
180 if (free_slots && cache->slots) {
181 kvfree(cache->slots);
182 cache->slots = NULL;
191 slots = cache->slots_ret;
195 kvfree(slots);
206 * left over slots are in cache when we remove
209 * on swap slots when allocating memory and need
210 * to return swap slots to global pool.
223 * fill any swap slots in slots cache of such cpu.
224 * There are no slots on such cpu that need to be drained.
247 "without swap slots cache.\n", __func__))
267 cache->slots, 0);
282 /* Swap slots cache may be deactivated before acquiring lock */
289 * Return slots to global pool.
329 if (likely(check_cache_active() && cache->slots)) {
331 if (cache->slots) {
334 entry = cache->slots[cache->cur];
335 cache->slots[cache->cur++].val = 0;