Lines Matching refs:scratch
71 struct scomp_scratch *scratch; in crypto_scomp_free_scratches() local
75 scratch = per_cpu_ptr(&scomp_scratch, i); in crypto_scomp_free_scratches()
77 free_page(scratch->saddr); in crypto_scomp_free_scratches()
78 scratch->src = NULL; in crypto_scomp_free_scratches()
82 static int scomp_alloc_scratch(struct scomp_scratch *scratch, int cpu) in scomp_alloc_scratch() argument
90 spin_lock_bh(&scratch->lock); in scomp_alloc_scratch()
91 scratch->src = page_address(page); in scomp_alloc_scratch()
92 spin_unlock_bh(&scratch->lock); in scomp_alloc_scratch()
101 struct scomp_scratch *scratch; in scomp_scratch_workfn() local
103 scratch = per_cpu_ptr(&scomp_scratch, cpu); in scomp_scratch_workfn()
104 if (scratch->src) in scomp_scratch_workfn()
106 if (scomp_alloc_scratch(scratch, cpu)) in scomp_scratch_workfn()
116 struct scomp_scratch *scratch; in crypto_scomp_alloc_scratches() local
118 scratch = per_cpu_ptr(&scomp_scratch, i); in crypto_scomp_alloc_scratches()
119 return scomp_alloc_scratch(scratch, i); in crypto_scomp_alloc_scratches()
142 static struct scomp_scratch *scomp_lock_scratch(void) __acquires(scratch) in scomp_lock_scratch()
145 struct scomp_scratch *scratch; in scomp_lock_scratch() local
147 scratch = per_cpu_ptr(&scomp_scratch, cpu); in scomp_lock_scratch()
148 spin_lock(&scratch->lock); in scomp_lock_scratch()
149 if (likely(scratch->src)) in scomp_lock_scratch()
150 return scratch; in scomp_lock_scratch()
151 spin_unlock(&scratch->lock); in scomp_lock_scratch()
156 scratch = per_cpu_ptr(&scomp_scratch, cpumask_first(cpu_possible_mask)); in scomp_lock_scratch()
157 spin_lock(&scratch->lock); in scomp_lock_scratch()
158 return scratch; in scomp_lock_scratch()
161 static inline void scomp_unlock_scratch(struct scomp_scratch *scratch) in scomp_unlock_scratch() argument
162 __releases(scratch) in scomp_unlock_scratch()
164 spin_unlock(&scratch->lock); in scomp_unlock_scratch()
175 struct scomp_scratch *scratch; in scomp_acomp_comp_decomp() local
240 scratch = scomp_lock_scratch(); in scomp_acomp_comp_decomp()
241 src = scratch->src; in scomp_acomp_comp_decomp()
242 memcpy_from_sglist(scratch->src, req->src, 0, slen); in scomp_acomp_comp_decomp()
251 scomp_unlock_scratch(scratch); in scomp_acomp_comp_decomp()