Skip to contentSkip to conversation

wfcqueue (in Userspace RCU) for Linux kernel (for epoll)

DISCUSSION Eric Wong 2 participants 2 messages Mar 11, 2013

lore
Share & tools
lore

Eric Wong

author
#0 lore raw

Hi, I'm looking to reduce contention for the ep->lock spin lock in epoll.

I came across wfcqueue in Userspace RCU and am wondering if there's any reason (other that lack of developer time/users) it hasn't been adapted for the Linux kernel.

I'd be happy to do the work if it's suitable (and omit parts which may not be, such as busy wait).

Using a mutex lock (while in process context) for dequeue works for epoll. I mainly want a lock-free enqueue for ep_poll_callback since that may be called in IRQ context.

I suppose I can also use the llist LIFO in ep_poll_callback and reverse that while in process context, too...

ref: http://git.lttng.org/userspace-rcu.git

#1 lore raw
Quoted 8 lines · * Eric Wong ([email protected]) wrote:

Hi, I'm looking to reduce contention for the ep->lock spin lock in epoll.

I came across wfcqueue in Userspace RCU and am wondering if there's any reason (other that lack of developer time/users) it hasn't been adapted for the Linux kernel.

I'd be happy to do the work if it's suitable (and omit parts which may not be, such as busy wait).

Hi Eric,

I'm glad you're interested in our data structure!

I actually have a port ready, I just lacked the time for thorough testing and also lacked users of the API at kernel-level. It looks like now would be a good time to send the patch your way as a RFC!

Quoted 3 lines

Using a mutex lock (while in process context) for dequeue works for epoll. I mainly want a lock-free enqueue for ep_poll_callback since that may be called in IRQ context.

You'd get even better than this: wait-free enqueue, with a simple xchg and store.

Quoted 3 lines

I suppose I can also use the llist LIFO in ep_poll_callback and reverse that while in process context, too...

Yeah, but that seems more expensive than just having the list in the right order already. ;)

Patch incoming in a separate post,

Thanks,

Mathieu

Quoted 3 lines

ref: http://git.lttng.org/userspace-rcu.git

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com