mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-22 23:04:43 +00:00
percpu-refcount: one bit is enough for REF_STATUS
percpu-refcount currently reserves two lowest bits of its percpu pointer to indicate its state; however, only one bit is used for PCPU_REF_DEAD. Simplify it by removing PCPU_STATUS_BITS/MASK and testing PCPU_REF_DEAD directly. This also allows the compiler to choose a more efficient instruction depending on the architecture. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Kent Overstreet <kmo@daterainc.com> Cc: Christoph Lameter <cl@linux-foundation.org>
This commit is contained in:
parent
55c6c814ae
commit
d630dc4c9a
2 changed files with 2 additions and 4 deletions
|
@ -88,12 +88,10 @@ static inline void percpu_ref_kill(struct percpu_ref *ref)
|
|||
return percpu_ref_kill_and_confirm(ref, NULL);
|
||||
}
|
||||
|
||||
#define PCPU_STATUS_BITS 2
|
||||
#define PCPU_STATUS_MASK ((1 << PCPU_STATUS_BITS) - 1)
|
||||
#define PCPU_REF_PTR 0
|
||||
#define PCPU_REF_DEAD 1
|
||||
|
||||
#define REF_STATUS(count) (((unsigned long) count) & PCPU_STATUS_MASK)
|
||||
#define REF_STATUS(count) (((unsigned long) count) & PCPU_REF_DEAD)
|
||||
|
||||
/**
|
||||
* percpu_ref_get - increment a percpu refcount
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue