1
0
Fork 0
remarkable-linux/block
Vivek Goyal 04a6b516cd blk-throttle: Correct the placement of smp_rmb()
o I was discussing what are the variable being updated without spin lock and
  why do we need barriers and Oleg pointed out that location of smp_rmb()
  should be between read of td->limits_changed and tg->limits_changed. This
  patch fixes it.

o Following is one possible sequence of events. Say cpu0 is executing
  throtl_update_blkio_group_read_bps() and cpu1 is executing
  throtl_process_limit_change().

 cpu0                                                cpu1

 tg->limits_changed = true;
 smp_mb__before_atomic_inc();
 atomic_inc(&td->limits_changed);

                                     if (!atomic_read(&td->limits_changed))
                                             return;

                                     if (tg->limits_changed)
                                             do_something;

 If cpu0 has updated tg->limits_changed and td->limits_changed, we want to
 make sure that if update to td->limits_changed is visible on cpu1, then
 update to tg->limits_changed should also be visible.

 Oleg pointed out to ensure that we need to insert an smp_rmb() between
 td->limits_changed read and tg->limits_changed read.

o I had erroneously put smp_rmb() before atomic_read(&td->limits_changed).
  This patch fixes it.

Reported-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
2010-12-01 19:34:52 +01:00
..
Kconfig blkio: Core implementation of throttle policy 2010-09-16 08:42:52 +02:00
Kconfig.iosched blk-cgroup: config options re-arrangement 2010-04-26 19:27:56 +02:00
Makefile Merge branch 'for-2.6.37/barrier' of git://git.kernel.dk/linux-2.6-block 2010-10-22 17:07:18 -07:00
blk-cgroup.c Merge branch 'for-2.6.37/core' of git://git.kernel.dk/linux-2.6-block 2010-10-22 17:00:32 -07:00
blk-cgroup.h blkio-throttle: limit max iops value to UINT_MAX 2010-10-01 21:16:41 +02:00
blk-core.c block: remove REQ_HARDBARRIER 2010-11-10 14:54:09 +01:00
blk-exec.c block: Prevent hang_check firing during long I/O 2010-09-24 15:52:09 +02:00
blk-flush.c block: remove BLKDEV_IFL_WAIT 2010-09-16 20:52:58 +02:00
blk-integrity.c block: Fix double free in blk_integrity_unregister 2010-10-15 15:49:18 +02:00
blk-ioc.c block: remove unused copy_io_context() 2010-11-11 13:40:11 +01:00
blk-iopoll.c tree-wide: fix assorted typos all over the place 2009-12-04 15:39:55 +01:00
blk-lib.c block: remove BLKDEV_IFL_WAIT 2010-09-16 20:52:58 +02:00
blk-map.c block: check for proper length of iov entries earlier in blk_rq_map_user_iov() 2010-11-29 10:04:50 +01:00
blk-merge.c Revert "block: fix accounting bug on cross partition merges" 2010-10-24 22:06:02 +02:00
blk-settings.c Merge branch 'for-2.6.37/barrier' of git://git.kernel.dk/linux-2.6-block 2010-10-22 17:07:18 -07:00
blk-softirq.c generic-ipi: remove CSD_FLAG_WAIT 2009-02-25 14:13:44 +01:00
blk-sysfs.c block: fix use-after-free bug in blk throttle code 2010-10-23 20:40:26 +02:00
blk-tag.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
blk-throttle.c blk-throttle: Correct the placement of smp_rmb() 2010-12-01 19:34:52 +01:00
blk-timeout.c block: ensure jiffies wrap is handled correctly in blk_rq_timed_out_timer 2010-04-21 17:42:08 +02:00
blk.h Revert "block: fix accounting bug on cross partition merges" 2010-10-24 22:06:02 +02:00
bsg.c Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl 2010-10-22 10:52:56 -07:00
cfq-iosched.c Merge branch 'for-2.6.37/core' of git://git.kernel.dk/linux-2.6-block 2010-10-22 17:00:32 -07:00
cfq.h blk-cgroup: Prepare the base for supporting more than one IO control policies 2010-09-16 08:42:04 +02:00
compat_ioctl.c BKL: remove extraneous #include <smp_lock.h> 2010-11-17 08:59:32 -08:00
deadline-iosched.c block: convert to pos and nr_sectors accessors 2009-05-11 09:50:54 +02:00
elevator.c block: remove REQ_HARDBARRIER 2010-11-10 14:54:09 +01:00
genhd.c Revert "block: fix accounting bug on cross partition merges" 2010-10-24 22:06:02 +02:00
ioctl.c BKL: remove extraneous #include <smp_lock.h> 2010-11-17 08:59:32 -08:00
noop-iosched.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
scsi_ioctl.c block: take care not to overflow when calculating total iov length 2010-11-10 14:40:42 +01:00