lkml.org 
[lkml]   [2012]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCH 5/6] implement per-cpu&per-domain state machine call_srcu()
From
Date
On Tue, 2012-03-06 at 17:57 +0800, Lai Jiangshan wrote:
> +void srcu_barrier(struct srcu_struct *sp)
> +{
> + struct srcu_sync sync;
> + struct srcu_head *head = &sync.head;
> + unsigned long chck_seq; /* snap */
> +
> + int idle_loop = 0;
> + int cpu;
> + struct srcu_cpu_struct *scp;
> +
> + spin_lock_irq(&sp->gp_lock);
> + chck_seq = sp->chck_seq;
> + for_each_possible_cpu(cpu) {

ARGH!! this is really not ok.. so we spend all this time killing
srcu_sync_expidited and co because they prod at all cpus for no good
reason, and what do you do?

Also, what happens if your cpu isn't actually online?


> + scp = per_cpu_ptr(sp->srcu_per_cpu, cpu);
> + if (scp->head && !safe_less_than(chck_seq, scp->head->chck_seq,
> + sp->chck_seq)) {
> + /* this path is likely enterred only once */
> + init_completion(&sync.completion);
> + srcu_queue_callback(sp, scp, head,
> + __synchronize_srcu_callback);
> + /* don't need to wakeup the woken state machine */
> + spin_unlock_irq(&sp->gp_lock);
> + wait_for_completion(&sync.completion);
> + spin_lock_irq(&sp->gp_lock);
> + } else {
> + if ((++idle_loop & 0xF) == 0) {
> + spin_unlock_irq(&sp->gp_lock);
> + udelay(1);
> + spin_lock_irq(&sp->gp_lock);
> + }

The purpose of this bit isn't quite clear to me, is this simply a lock
break?

> + }
> + }
> + spin_unlock_irq(&sp->gp_lock);
> +
> + flush_workqueue(srcu_callback_wq);

Since you already waited for the completions one by one, what's the
purpose of this?

> +}
> +EXPORT_SYMBOL_GPL(srcu_barrier);


\
 
 \ /
  Last update: 2012-03-06 12:55    [W:0.237 / U:13.672 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site