Displaying 6 results from an estimated 6 matches for "ticket_lock_batch_mask".
2014 May 28
7
[RFC] Implement Batched (group) ticket lock
...kets new;
inc = xadd(&lock->tickets, inc);
- if (likely(inc.head == inc.tail))
- goto out;
inc.tail &= ~TICKET_SLOWPATH_FLAG;
for (;;) {
unsigned count = SPIN_THRESHOLD;
do {
- if (ACCESS_ONCE(lock->tickets.head) == inc.tail)
- goto out;
+ if ((inc.head & TICKET_LOCK_BATCH_MASK) == (inc.tail &
+ TICKET_LOCK_BATCH_MASK))
+ goto spin;
cpu_relax();
+ inc.head = ACCESS_ONCE(lock->tickets.head);
} while (--count);
__ticket_lock_spinning(lock, inc.tail);
}
+spin:
+ for (;;) {
+ inc.head = ACCESS_ONCE(lock->tickets.head);
+ if (!(inc.head &...
2014 May 28
7
[RFC] Implement Batched (group) ticket lock
...kets new;
inc = xadd(&lock->tickets, inc);
- if (likely(inc.head == inc.tail))
- goto out;
inc.tail &= ~TICKET_SLOWPATH_FLAG;
for (;;) {
unsigned count = SPIN_THRESHOLD;
do {
- if (ACCESS_ONCE(lock->tickets.head) == inc.tail)
- goto out;
+ if ((inc.head & TICKET_LOCK_BATCH_MASK) == (inc.tail &
+ TICKET_LOCK_BATCH_MASK))
+ goto spin;
cpu_relax();
+ inc.head = ACCESS_ONCE(lock->tickets.head);
} while (--count);
__ticket_lock_spinning(lock, inc.tail);
}
+spin:
+ for (;;) {
+ inc.head = ACCESS_ONCE(lock->tickets.head);
+ if (!(inc.head &...
2014 May 29
0
[RFC] Implement Batched (group) ticket lock
...> - if (likely(inc.head == inc.tail))
> - goto out;
>
> inc.tail&= ~TICKET_SLOWPATH_FLAG;
> for (;;) {
> unsigned count = SPIN_THRESHOLD;
>
> do {
> - if (ACCESS_ONCE(lock->tickets.head) == inc.tail)
> - goto out;
> + if ((inc.head& TICKET_LOCK_BATCH_MASK) == (inc.tail&
> + TICKET_LOCK_BATCH_MASK))
> + goto spin;
> cpu_relax();
> + inc.head = ACCESS_ONCE(lock->tickets.head);
> } while (--count);
> __ticket_lock_spinning(lock, inc.tail);
> }
> +spin:
> + for (;;) {
> + inc.head = ACCESS...
2014 May 28
0
[RFC] Implement Batched (group) ticket lock
...; #endif
>
> -#define TICKET_LOCK_INC ((__ticket_t)__TICKET_LOCK_INC)
> +#define TICKET_LOCK_TAIL_INC ((__ticket_t)__TICKET_LOCK_TAIL_INC)
> +
> +#define TICKET_LOCK_HEAD_INC ((__ticket_t)1)
> +#define TICKET_BATCH 0x4 /* 4 waiters can contend simultaneously */
> +#define TICKET_LOCK_BATCH_MASK (~(TICKET_BATCH<<TICKET_LOCK_INC_SHIFT) + \
> + TICKET_LOCK_TAIL_INC - 1)
I do not see the value in having TICKET_BATCH declared with a
hexadecimal number, and it may be worth making sure the code
does not compile if someone tried a TICKET_BATCH value that
is not a power of 2.
--
A...
2014 Jun 28
2
[RFC PATCH v2] Implement Batched (group) ticket lock
...ow
since batch size is set to 1).
- Change TICKET_LOCK_INC_SHIFT back to 0 in !CONFIG_PARAVIRT case (Rik).
- Add build check to make sure TICKET_BATCH is power of 2 (Rik).
- Replace extra cmpxchg with add_smp for CONFIG_PARAVIRT enabled case in host (Waiman, Linus.. had concernes).
- Correct TICKET_LOCK_BATCH_MASK to suit all TAIL_INC (expression given by Waiman).
- Add comment on LOCK bit (Waiman).
- Add Xen support (Completely untested).
TODO: (But none of the below imply shortcoming of current patch)
- we can further add dynamically changing batch_size (to 1 and MAX size)
implementation (inspiration...
2014 Jun 28
2
[RFC PATCH v2] Implement Batched (group) ticket lock
...ow
since batch size is set to 1).
- Change TICKET_LOCK_INC_SHIFT back to 0 in !CONFIG_PARAVIRT case (Rik).
- Add build check to make sure TICKET_BATCH is power of 2 (Rik).
- Replace extra cmpxchg with add_smp for CONFIG_PARAVIRT enabled case in host (Waiman, Linus.. had concernes).
- Correct TICKET_LOCK_BATCH_MASK to suit all TAIL_INC (expression given by Waiman).
- Add comment on LOCK bit (Waiman).
- Add Xen support (Completely untested).
TODO: (But none of the below imply shortcoming of current patch)
- we can further add dynamically changing batch_size (to 1 and MAX size)
implementation (inspiration...