Skip to content

Commit

Permalink
fs: Use this_cpu_inc_return in buffer.c
Browse files Browse the repository at this point in the history
__this_cpu_inc can create a single instruction with the same effect
as the _get_cpu_var(..)++ construct in buffer.c.

Cc: Wu Fengguang <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Acked-by: H. Peter Anvin <[email protected]>
Signed-off-by: Christoph Lameter <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
  • Loading branch information
Christoph Lameter authored and htejun committed Dec 17, 2010
1 parent cfb8243 commit ee1be86
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -3201,7 +3201,7 @@ static void recalc_bh_state(void)
int i;
int tot = 0;

if (__get_cpu_var(bh_accounting).ratelimit++ < 4096)
if (__this_cpu_inc_return(bh_accounting.ratelimit) - 1 < 4096)
return;
__this_cpu_write(bh_accounting.ratelimit, 0);
for_each_online_cpu(i)
Expand Down

0 comments on commit ee1be86

Please sign in to comment.