Skip to content

Commit

Permalink
atomically read page_bitmaps
Browse files Browse the repository at this point in the history
page_bitmaps does not need to be volatile since it is going to be treated as atomic
  • Loading branch information
AreaZR committed Dec 25, 2023
1 parent ee39300 commit 823ac37
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/shims/atomic_sfb.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
// Returns UINT_MAX if all the bits in p were already set.
DISPATCH_ALWAYS_INLINE
static inline unsigned int
os_atomic_set_first_bit(volatile unsigned long *p, unsigned int max)
os_atomic_set_first_bit(unsigned long *p, unsigned int max)
{
unsigned long val, bit;
if (max > (sizeof(val) * 8)) {
Expand Down Expand Up @@ -82,7 +82,7 @@ os_atomic_set_first_bit(volatile unsigned long *p, unsigned int max)

DISPATCH_ALWAYS_INLINE
static inline unsigned int
os_atomic_set_first_bit(volatile unsigned long *p, unsigned int max_index)
os_atomic_set_first_bit(unsigned long *p, unsigned int max)
{
unsigned int index;
unsigned long b, b_masked;
Expand All @@ -94,7 +94,7 @@ os_atomic_set_first_bit(volatile unsigned long *p, unsigned int max_index)
os_atomic_rmw_loop_give_up(return UINT_MAX);
}
index--;
if (unlikely(index > max_index)) {
if (unlikely(index > max)) {
os_atomic_rmw_loop_give_up(return UINT_MAX);
}
b_masked = b | (1UL << index);
Expand Down

0 comments on commit 823ac37

Please sign in to comment.