lkml.org 
[lkml]   [2008]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] cgroups: fix probable race with put_css_set[_taskexit] and find_css_set
On Wed, Sep 10, 2008 at 10:18:36AM +0800, Lai Jiangshan wrote:
> Paul Menage wrote:
> > On Mon, Aug 18, 2008 at 11:29 PM, Lai Jiangshan <laijs@cn.fujitsu.com> wrote:
> >
> > 2) Use atomic_inc_not_zero() in find_existing_css_set(), to ensure
> > that we only return a referenced css, and remove the get_css_set()
> > call from find_css_set(). (Possibly wrapping this in a new
> > kref_get_not_zero() function)
> >
>
> [CC: Greg Kroah-Hartman <greg@kroah.com>]
>
> There are indeed several ways fix this race by Using the
> atomic-functions directly. I prefer the second one, i makes all
> code clearly. And put_css_set[_taskexit] do not need to be changed.
>
> I don't think adding kref_get_not_zero() API is a good idea.
> It will bring kref APIs to a little chaos, kref_get_not_zero() is
> hard to be used, for this function needs a special lock held.
>
> But I tried:

What are you trying to solve here with this change? I agree, it does
seem a bit "chaotic" :)

I thought we used to have something like this for kref in the past, but
I must be mistaken as it's no longer there...

thanks,

greg k-h


\
 
 \ /
  Last update: 2008-09-10 07:05    [W:0.074 / U:0.824 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site