lkml.org 
[lkml]   [2013]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] generic dynamic per cpu refcounting
From
Hey, Kent.

On Mon, Jan 28, 2013 at 12:22 PM, Kent Overstreet
<koverstreet@google.com> wrote:
> Could do that too, but then teardown gets really messy for the user - we
> need two synchronize_rcu()s:
>
> state := dying
>
> synchronize_rcu()
>
> /* Now nothing's changing the per cpu counters */
>
> Add per cpu counters to atomic counter counter
>
> /* Atomic counter is now consistent */
>
> state := dead
>
> synchronize_rcu()

I don't understand why we need two stages. What prevents the killing
thread from fetching percpu counters after dying passes one
synchronize_sched()?

> /* Now percpu_ref_put will check for ref == 0 */
>
> /* Drop initial ref */
>
> percpu_ref_put()
>
> And note that the first synchronize_rcu() is only needed when we had
> allocated per cpu counters, my current code skips it otherwise.

And regardless, at the interface level, can't it just provide
percpu_ref_put_base_ref(release_fn)?

Thanks.

--
tejun


\
 
 \ /
  Last update: 2013-01-28 22:02    [W:0.105 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site