lkml.org 
[lkml]   [2009]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 05/10] writeback: support > 1 flusher thread per bdi
Artem Bityutskiy wrote:
> Jens Axboe wrote:
> >+static void bdi_queue_work(struct backing_dev_info *bdi, struct bdi_work
> >*work)
> >+{
> >+ if (work) {
> >+ work->seen = bdi->wb_mask;
> >+ BUG_ON(!work->seen);
> >+ atomic_set(&work->pending, bdi->wb_cnt);
> >+ BUG_ON(!bdi->wb_cnt);
> >+
> >+ /*
> >+ * Make sure stores are seen before it appears on the list
> >+ */
> >+ smp_mb();
> >+
> >+ spin_lock(&bdi->wb_lock);
> >+ list_add_tail_rcu(&work->list, &bdi->work_list);
> >+ spin_unlock(&bdi->wb_lock);
> >+ }
>
> Doesn't spin_lock() include an implicit memory barrier?
> After &bdi->wb_lock is acquired, it is guaranteed that all
> memory operations are finished.

I'm pretty sure spin_lock() is an "acquire" barrier, which just guarantees
loads/stores after the spin_lock() are done after taking the lock.

It doesn't guarantee anything about loads/stores before the spin_lock().

-- Jamie


\
 
 \ /
  Last update: 2009-07-06 15:53    [W:0.560 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site