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 coaellesce 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,
42 /* Serialize swap slots cache enable/disable operations */
117 swp_entry_t *slots, *slots_ret;
124 slots = kvcalloc(SWAP_SLOTS_CACHE_SIZE, sizeof(swp_entry_t),
126 if (!slots)
132 kvfree(slots);
138 if (cache->slots || cache->slots_ret) {
142 kvfree(slots);
158 * !cache->slots or !cache->slots_ret to know if it is safe to acquire
163 cache->slots = slots;
173 swp_entry_t *slots = NULL;
176 if ((type & SLOTS_CACHE) && cache->slots) {
178 swapcache_free_entries(cache->slots + cache->cur, cache->nr);
181 if (free_slots && cache->slots) {
182 kvfree(cache->slots);
183 cache->slots = NULL;
192 slots = cache->slots_ret;
196 if (slots)
197 kvfree(slots);
208 * left over slots are in cache when we remove
211 * on swap slots when allocating memory and need
212 * to return swap slots to global pool.
225 * fill any swap slots in slots cache of such cpu.
226 * There are no slots on such cpu that need to be drained.
249 "without swap slots cache.\n", __func__))
269 cache->slots, 1);
281 /* Swap slots cache may be deactivated before acquiring lock */
288 * Return slots to global pool.
330 if (likely(check_cache_active() && cache->slots)) {
332 if (cache->slots) {
335 entry = cache->slots[cache->cur];
336 cache->slots[cache->cur++].val = 0;