[..]
I think it is correct, but I used it wrong in once place, in+static inline void __cgroup_rstat_lock(struct cgroup *cgrp, int cpu_in_loop,Should this be the other way around?
+ bool already_contended)
__acquires(&cgroup_rstat_lock)
{
- bool contended;
+ bool locked = false;
- contended = !spin_trylock_irq(&cgroup_rstat_lock);
- if (contended) {
- trace_cgroup_rstat_lock_contended(cgrp, cpu_in_loop, contended);
+ if (already_contended) /* Skip trylock if already contended */
+ locked = __cgroup_rstat_trylock(cgrp, cpu_in_loop);
cgroup_rstat_flush_hold(), as cgroup_rstat_trylock_flusher() returning
false doesn't mean it was already_contended, but that ongoing flusher
"skipped" (and waited for) a flush. I need to correct this.
Something isn't adding up here as well. The comment says skip trylock
if already contended, then if already_contended is true we do a
trylock. Am I confusing myself here? 🙂