Lines Matching defs:cid

3252 static inline void __mm_cid_put(struct mm_struct *mm, int cid)
3254 if (cid < 0)
3256 cpumask_clear_cpu(cid, mm_cidmask(mm));
3260 * The per-mm/cpu cid can have the MM_CID_LAZY_PUT flag set or transition to
3271 int cid;
3274 cid = __this_cpu_read(pcpu_cid->cid);
3275 if (!mm_cid_is_lazy_put(cid) ||
3276 !try_cmpxchg(&this_cpu_ptr(pcpu_cid)->cid, &cid, MM_CID_UNSET))
3278 __mm_cid_put(mm, mm_cid_clear_lazy_put(cid));
3284 int cid, res;
3287 cid = __this_cpu_read(pcpu_cid->cid);
3289 if (mm_cid_is_unset(cid))
3294 res = cmpxchg(&this_cpu_ptr(pcpu_cid)->cid, cid, MM_CID_UNSET);
3295 if (res == cid)
3297 cid = res;
3299 return cid;
3304 int cid;
3307 cid = mm_cid_pcpu_unset(mm);
3308 if (cid == MM_CID_UNSET)
3310 __mm_cid_put(mm, mm_cid_clear_lazy_put(cid));
3316 int cid;
3322 * which owns a cid without holding a rq lock.
3325 cid = cpumask_first_zero(cpumask);
3326 if (cid < nr_cpu_ids)
3330 if (cpumask_test_and_set_cpu(cid, cpumask))
3332 return cid;
3337 * with the per-cpu cid value, allowing to estimate how recently it was used.
3349 int cid;
3353 * use_cid_lock is set, hold the cid_lock to perform cid allocation to
3357 cid = __mm_cid_try_get(mm);
3358 if (cid >= 0)
3363 cid = __mm_cid_try_get(mm);
3364 if (cid >= 0)
3369 * cid concurrently allocated. Retry while forcing following
3383 cid = __mm_cid_try_get(mm);
3385 } while (cid < 0);
3396 return cid;
3403 int cid;
3407 cid = __this_cpu_read(pcpu_cid->cid);
3408 if (mm_cid_is_valid(cid)) {
3410 return cid;
3412 if (mm_cid_is_lazy_put(cid)) {
3413 if (try_cmpxchg(&this_cpu_ptr(pcpu_cid)->cid, &cid, MM_CID_UNSET))
3414 __mm_cid_put(mm, mm_cid_clear_lazy_put(cid));
3416 cid = __mm_cid_get(rq, mm);
3417 __this_cpu_write(pcpu_cid->cid, cid);
3418 return cid;