Lines Matching defs:cache
416 static void bio_alloc_irq_cache_splice(struct bio_alloc_cache *cache)
420 /* cache->free_list must be empty */
421 if (WARN_ON_ONCE(cache->free_list))
425 cache->free_list = cache->free_list_irq;
426 cache->free_list_irq = NULL;
427 cache->nr += cache->nr_irq;
428 cache->nr_irq = 0;
436 struct bio_alloc_cache *cache;
439 cache = per_cpu_ptr(bs->cache, get_cpu());
440 if (!cache->free_list) {
441 if (READ_ONCE(cache->nr_irq) >= ALLOC_CACHE_THRESHOLD)
442 bio_alloc_irq_cache_splice(cache);
443 if (!cache->free_list) {
448 bio = cache->free_list;
449 cache->free_list = bio->bi_next;
450 cache->nr--;
505 if (bs->cache && nr_vecs <= BIO_INLINE_VECS) {
512 * REQ_ALLOC_CACHE to particpate in per-cpu alloc cache.
703 static int __bio_alloc_cache_prune(struct bio_alloc_cache *cache,
709 while ((bio = cache->free_list) != NULL) {
710 cache->free_list = bio->bi_next;
711 cache->nr--;
719 static void bio_alloc_cache_prune(struct bio_alloc_cache *cache,
722 nr -= __bio_alloc_cache_prune(cache, nr);
723 if (!READ_ONCE(cache->free_list)) {
724 bio_alloc_irq_cache_splice(cache);
725 __bio_alloc_cache_prune(cache, nr);
734 if (bs->cache) {
735 struct bio_alloc_cache *cache = per_cpu_ptr(bs->cache, cpu);
737 bio_alloc_cache_prune(cache, -1U);
746 if (!bs->cache)
751 struct bio_alloc_cache *cache;
753 cache = per_cpu_ptr(bs->cache, cpu);
754 bio_alloc_cache_prune(cache, -1U);
756 free_percpu(bs->cache);
757 bs->cache = NULL;
762 struct bio_alloc_cache *cache;
764 cache = per_cpu_ptr(bio->bi_pool->cache, get_cpu());
765 if (READ_ONCE(cache->nr_irq) + cache->nr > ALLOC_CACHE_MAX) {
774 bio->bi_next = cache->free_list;
776 cache->free_list = bio;
777 cache->nr++;
782 bio->bi_next = cache->free_list_irq;
783 cache->free_list_irq = bio;
784 cache->nr_irq++;
1718 * @pool_size: Number of bio and bio_vecs to cache in the mempool
1769 bs->cache = alloc_percpu(struct bio_alloc_cache);
1770 if (!bs->cache)