Skip to content

Commit

Permalink
bfq: Fix the missing barrier in __bfq_entity_update_weight_prio
Browse files Browse the repository at this point in the history
The comment of bfq_group_set_weight says the reading of prio_changed
should happen before the reading of weight, but a memory barrier is
missing here. Add it now, to match the smp_wmb() there.

Signed-off-by: Fam Zheng <zhengfeiran@bytedance.com>
Reviewed-by: Paolo Valente <paolo.valente@linaro.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Fam Zheng authored and Jens Axboe committed Sep 6, 2019
1 parent a261425 commit e9d3c86
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions block/bfq-wf2q.c
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,8 @@ __bfq_entity_update_weight_prio(struct bfq_service_tree *old_st,
}
#endif

/* Matches the smp_wmb() in bfq_group_set_weight. */
smp_rmb();
old_st->wsum -= entity->weight;

if (entity->new_weight != entity->orig_weight) {
Expand Down

0 comments on commit e9d3c86

Please sign in to comment.