Messages in this thread | | | Date | Tue, 21 Apr 2009 21:39:24 +0200 | From | Ingo Molnar <> | Subject | Re: [PATCH] netfilter: use per-cpu recursive lock (v11) |
| |
* Stephen Hemminger <shemminger@vyatta.com> wrote:
> +void xt_info_wrunlock_bh(void) > + __releases(xt_info_lock) > +{ > + unsigned int i; > + > + for_each_possible_cpu(i) { > +#if NR_CPUS > (PREEMPT_MASK - 1) > + /* > + * Spin_unlock calls preempt_enable, but since we had > + * to adjust the count in xt_info_wrlock_bh, do it again > + */ > + preempt_disable(); > +#endif > + write_unlock(&per_cpu(xt_info_locks, i)); > + } > + local_bh_enable(); > +}
In the global/local lock scheme i proposed this would become:
global_write_unlock(void) { write_unlock(&global_lock); }
As we dont hold the local locks during the write-locked critical section. No loop needed over CPUs, no preempt nesting complications, no lockdep complications, etc.
Ingo
| |