Re: [PATCH percpu/for-3.11 1/2] percpu-refcount: add __must_check to percpu_ref_init() and don't use ACCESS_ONCE() in percpu_ref_kill_rcu()

2013-06-19 Thread Tejun Heo
Hello, On Thu, Jun 20, 2013 at 10:29:51AM +0930, Rusty Russell wrote: > Now seems to get abused by lazy coders who blame users for their own > broken APIs. And Ubuntu, who turn it on by default in their gcc when > optimizing. Yeah, it's a sore point :) How is the API broken? It is a function

Re: [PATCH percpu/for-3.11 1/2] percpu-refcount: add __must_check to percpu_ref_init() and don't use ACCESS_ONCE() in percpu_ref_kill_rcu()

2013-06-19 Thread Rusty Russell
Tejun Heo writes: > On Wed, Jun 19, 2013 at 12:25:14PM +0930, Rusty Russell wrote: >> But it's quite OK to ignore OOM errors in builtin init functions. > > I think it'd be cleaner to let those use cases use BUG_ON() around it. > We really want most users to be checking its return value. Yeah,

Re: [PATCH percpu/for-3.11 1/2] percpu-refcount: add __must_check to percpu_ref_init() and don't use ACCESS_ONCE() in percpu_ref_kill_rcu()

2013-06-19 Thread Tejun Heo
On Wed, Jun 19, 2013 at 12:25:14PM +0930, Rusty Russell wrote: > But it's quite OK to ignore OOM errors in builtin init functions. I think it'd be cleaner to let those use cases use BUG_ON() around it. We really want most users to be checking its return value. > It would be neatest to have it

Re: [PATCH percpu/for-3.11 1/2] percpu-refcount: add __must_check to percpu_ref_init() and don't use ACCESS_ONCE() in percpu_ref_kill_rcu()

2013-06-19 Thread Tejun Heo
On Wed, Jun 19, 2013 at 12:25:14PM +0930, Rusty Russell wrote: But it's quite OK to ignore OOM errors in builtin init functions. I think it'd be cleaner to let those use cases use BUG_ON() around it. We really want most users to be checking its return value. It would be neatest to have it fail

Re: [PATCH percpu/for-3.11 1/2] percpu-refcount: add __must_check to percpu_ref_init() and don't use ACCESS_ONCE() in percpu_ref_kill_rcu()

2013-06-19 Thread Rusty Russell
Tejun Heo t...@kernel.org writes: On Wed, Jun 19, 2013 at 12:25:14PM +0930, Rusty Russell wrote: But it's quite OK to ignore OOM errors in builtin init functions. I think it'd be cleaner to let those use cases use BUG_ON() around it. We really want most users to be checking its return value.

Re: [PATCH percpu/for-3.11 1/2] percpu-refcount: add __must_check to percpu_ref_init() and don't use ACCESS_ONCE() in percpu_ref_kill_rcu()

2013-06-19 Thread Tejun Heo
Hello, On Thu, Jun 20, 2013 at 10:29:51AM +0930, Rusty Russell wrote: Now seems to get abused by lazy coders who blame users for their own broken APIs. And Ubuntu, who turn it on by default in their gcc when optimizing. Yeah, it's a sore point :) How is the API broken? It is a function

Re: [PATCH percpu/for-3.11 1/2] percpu-refcount: add __must_check to percpu_ref_init() and don't use ACCESS_ONCE() in percpu_ref_kill_rcu()

2013-06-18 Thread Rusty Russell
Tejun Heo writes: > Two small changes. > > * Unlike most init functions, percpu_ref_init() allocates memory and > may fail. Let's mark it with __must_check in case the caller > forgets. But it's quite OK to ignore OOM errors in builtin init functions. It would be neatest to have it fail

Re: [PATCH percpu/for-3.11 1/2] percpu-refcount: add __must_check to percpu_ref_init() and don't use ACCESS_ONCE() in percpu_ref_kill_rcu()

2013-06-18 Thread Rusty Russell
Tejun Heo t...@kernel.org writes: Two small changes. * Unlike most init functions, percpu_ref_init() allocates memory and may fail. Let's mark it with __must_check in case the caller forgets. But it's quite OK to ignore OOM errors in builtin init functions. It would be neatest to have

[PATCH percpu/for-3.11 1/2] percpu-refcount: add __must_check to percpu_ref_init() and don't use ACCESS_ONCE() in percpu_ref_kill_rcu()

2013-06-12 Thread Tejun Heo
Two small changes. * Unlike most init functions, percpu_ref_init() allocates memory and may fail. Let's mark it with __must_check in case the caller forgets. * percpu_ref_kill_rcu() is unnecessarily using ACCESS_ONCE() to dereference @ref->pcpu_count, which can be misleading. The pointer

[PATCH percpu/for-3.11 1/2] percpu-refcount: add __must_check to percpu_ref_init() and don't use ACCESS_ONCE() in percpu_ref_kill_rcu()

2013-06-12 Thread Tejun Heo
Two small changes. * Unlike most init functions, percpu_ref_init() allocates memory and may fail. Let's mark it with __must_check in case the caller forgets. * percpu_ref_kill_rcu() is unnecessarily using ACCESS_ONCE() to dereference @ref-pcpu_count, which can be misleading. The pointer