Skip to content

Commit

Permalink
scx_flatcg: Make good use of __sync_fetch_and_sub()
Browse files Browse the repository at this point in the history
Fetch the value of "delta" directly from the returned value from
__sync_fetch_and_sub, as it returns the origin value of
cgc->cvtime_delta.

Additional fetching instruction of cgc->cvtime_delta would be redundant
here.

Signed-off-by: I Hsin Cheng <[email protected]>
  • Loading branch information
vax-r committed Jul 4, 2024
1 parent a72c905 commit 16a713a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions scheds/c/scx_flatcg.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,7 @@ static void cgrp_cap_budget(struct cgv_node *cgv_node, struct fcg_cgrp_ctx *cgc)
* and thus can't be updated and repositioned. Instead, we collect the
* vtime deltas separately and apply it asynchronously here.
*/
delta = cgc->cvtime_delta;
__sync_fetch_and_sub(&cgc->cvtime_delta, delta);
delta = __sync_fetch_and_sub(&cgc->cvtime_delta, delta);
cvtime = cgv_node->cvtime + delta;

/*
Expand Down

0 comments on commit 16a713a

Please sign in to comment.