Skip to contentSkip to conversation

Quick questions about liburcu and RCU in general

DISCUSSION Mathieu Desnoyers 3 participants 7 messages May 7, 2013 6 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi Richard,

Quoted 8 lines · * Richard Braun ([email protected]) wrote:

Hello,

I'm currently studying RCU/URCU, and I have a few questions that I wasn't sure where to ask.

1/ Why use poll instead of sched_yield in e.g. force_mb_all_readers ? (I guess it's about portability and the effect is expected to be the same, but is there another reason ?)

poll() allow us to do a millisecond-level wait (timer-based). sched_yield() is pretty much a scheduler hack that just says "be nice to other scheduled processes here". Quoting sched_yield(2):

If the calling thread is the only thread in the highest priority list at that time, it will continue to run after a call to sched_yield().

This is a kind of behavior we don't want.

Quoted 4 lines

2/ What was the conclusion of the discussion regarding sys_membarrier ? (I couldn't find it in the main mail thread, and it looks quite interesting, even though I expect most carefully written applications not to exceed one thread per processor too much)

The conclusion so far was that:

- the implementation was fine,
- we had to show there were enough users of this new ABI to justify its inclusion and maintenance cost. Currently, it's pretty much just liburcu that uses it. As the number of liburcu users grows, this helps, but what would help even more would be to have other libraries and applications using sys_membarrier() (other people interested and weighting in).

Quoted 5 lines

3/ Do you know if IBM allows the use of patented RCU techniques in GPLv3+ code as well ? ("GPL" is mentioned in the Linux documentation, and apparently liburcu is covered by LGPLv2+ so I expect that to be the case, just looking for a confirmation)

AFAIK, LGPLv2+ code can migrate into GPLv3+, it's the other way around that is not permitted. Therefore, I would expect it is allowed, but I will let Paul answer to this one on behalf of IBM.

Thanks,

Mathieu

Quoted 5 lines

Thanks for your answers.

Signature · 1 line
Richard Braun
Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

A message that is not in the archive (sent off-list or not yet received): 20130507115914.GB3875@Krystal

#3 lore raw
Quoted 37 lines · Mathieu Desnoyers

Hi Richard,

Quoted 8 lines · * Richard Braun ([email protected]) wrote:

Hello,

I'm currently studying RCU/URCU, and I have a few questions that I wasn't sure where to ask.

1/ Why use poll instead of sched_yield in e.g. force_mb_all_readers ? (I guess it's about portability and the effect is expected to be the same, but is there another reason ?)

poll() allow us to do a millisecond-level wait (timer-based). sched_yield() is pretty much a scheduler hack that just says "be nice to other scheduled processes here". Quoting sched_yield(2):

If the calling thread is the only thread in the highest priority list at that time, it will continue to run after a call to sched_yield().

This is a kind of behavior we don't want.

Quoted 4 lines

2/ What was the conclusion of the discussion regarding sys_membarrier ? (I couldn't find it in the main mail thread, and it looks quite interesting, even though I expect most carefully written applications not to exceed one thread per processor too much)

The conclusion so far was that:

- the implementation was fine,
- we had to show there were enough users of this new ABI to justify its inclusion and maintenance cost. Currently, it's pretty much just liburcu that uses it. As the number of liburcu users grows, this helps, but what would help even more would be to have other libraries and applications using sys_membarrier() (other people interested and weighting in).

Quoted 1 line
Quoted 8 lines
Quoted 4 lines

3/ Do you know if IBM allows the use of patented RCU techniques in GPLv3+ code as well ? ("GPL" is mentioned in the Linux documentation, and apparently liburcu is covered by LGPLv2+ so I expect that to be the case, just looking for a confirmation)

AFAIK, LGPLv2+ code can migrate into GPLv3+, it's the other way around that is not permitted. Therefore, I would expect it is allowed, but I will let Paul answer to this one on behalf of IBM.

Yes, LGPLv2+ allows you to migrate to LGPLv3+, which is compatible with GPLv3+. So as long as you derive the code from lttng's userspace-rcu library, you are set.

That said, you could also just link userspace-rcu into your GPLv3+ application.

Thanx, Paul

Quoted 16 lines

Thanks,

Mathieu

Quoted 5 lines

Thanks for your answers.

Signature · 1 line
Richard Braun
Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw
Quoted 6 lines · Paul E. McKenney

Yes, LGPLv2+ allows you to migrate to LGPLv3+, which is compatible with GPLv3+. So as long as you derive the code from lttng's userspace-rcu library, you are set.

That said, you could also just link userspace-rcu into your GPLv3+ application.

My question is rather about the techniques than the existing implementations. Is it safe to implement RCU in an unrelated project under GPLv3+, considering it's patented ?

Signature · 1 line
Richard Braun

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw
Quoted 11 lines · Richard Braun
Quoted 6 lines · Paul E. McKenney

Yes, LGPLv2+ allows you to migrate to LGPLv3+, which is compatible with GPLv3+. So as long as you derive the code from lttng's userspace-rcu library, you are set.

That said, you could also just link userspace-rcu into your GPLv3+ application.

My question is rather about the techniques than the existing implementations. Is it safe to implement RCU in an unrelated project under GPLv3+, considering it's patented ?

I am not a lawyer, but my understanding is that the GPL patent protection applies to derived works. So if you start with userspace-rcu, adapt it to your application, and relicense to GPLv3+, you should be OK. I do not believe this works if you do a cleanroom implementation, but again, I am not a lawyer.

Thanx, Paul

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw
Quoted 9 lines · Paul E. McKenney
Quoted 3 lines

My question is rather about the techniques than the existing implementations. Is it safe to implement RCU in an unrelated project under GPLv3+, considering it's patented ?

I am not a lawyer, but my understanding is that the GPL patent protection applies to derived works. So if you start with userspace-rcu, adapt it to your application, and relicense to GPLv3+, you should be OK. I do not believe this works if you do a cleanroom implementation, but again, I am not a lawyer.

Noted. Thank you both for your answers.

Signature · 1 line
Richard Braun
#10 lore raw
In reply to a message not in the archive
Quoted 4 lines · Mathieu Desnoyers
Quoted 3 lines

1/ Why use poll instead of sched_yield in e.g. force_mb_all_readers ? (I guess it's about portability and the effect is expected to be the same, but is there another reason ?)

Quoted 8 lines

poll() allow us to do a millisecond-level wait (timer-based). sched_yield() is pretty much a scheduler hack that just says "be nice to other scheduled processes here". Quoting sched_yield(2):

If the calling thread is the only thread in the highest priority list at that time, it will continue to run after a call to sched_yield().

This is a kind of behavior we don't want.

Right, I see. But then, poll enforces a minimum delay whatever happens (which may be increased up to the scheduler time slice depending on the kernel). I guess this isn't something we want either.

On the other hand, AIUI, poll is called only after all signals were already sent, and if a receiving thread didn't update its need_mb yet, so I expect it's a rare worst case that doesn't require more care.

Signature · 1 line
Richard Braun

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw
Quoted 14 lines · * Richard Braun ([email protected]) wrote:
Quoted 4 lines · Mathieu Desnoyers
Quoted 3 lines

1/ Why use poll instead of sched_yield in e.g. force_mb_all_readers ? (I guess it's about portability and the effect is expected to be the same, but is there another reason ?)

Quoted 8 lines

poll() allow us to do a millisecond-level wait (timer-based). sched_yield() is pretty much a scheduler hack that just says "be nice to other scheduled processes here". Quoting sched_yield(2):

If the calling thread is the only thread in the highest priority list at that time, it will continue to run after a call to sched_yield().

This is a kind of behavior we don't want.

Quoted 7 lines

Right, I see. But then, poll enforces a minimum delay whatever happens (which may be increased up to the scheduler time slice depending on the kernel). I guess this isn't something we want either.

On the other hand, AIUI, poll is called only after all signals were already sent, and if a receiving thread didn't update its need_mb yet, so I expect it's a rare worst case that doesn't require more care.

Indeed, that would be a rare worst case. Moreover, if we really care about this code path execution time, we might want to consider using the wait/wakeup scheme based on sys_futex used elsewhere in the urcu implementation.

Thanks,

Mathieu

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