lkml.org 
[lkml]   [2007]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 6/6] cpuset dirty limits
Christoph Lameter wrote:
> On Fri, 14 Sep 2007, Andrew Morton wrote:
>
>>> + mutex_lock(&callback_mutex);
>>> + *cs_int = val;
>>> + mutex_unlock(&callback_mutex);
>> I don't think this locking does anything?
>
> Locking is wrong here. The lock needs to be taken before the cs pointer
> is dereferenced from the caller.

I think we can just remove the callback_mutex lock. Since the change is
coming from an update to a cpuset filesystem file, the cpuset is not
going anywhere since the inode is open. And I don't see that any code
really cares whether the dirty ratios change out from under them.

>
>>> + return 0;
>>> +}
>>> +
>>> /*
>>> * Frequency meter - How fast is some event occurring?
>>> *
>>> ...
>>> +void cpuset_get_current_ratios(int *background_ratio, int *throttle_ratio)
>>> +{
>>> + int background = -1;
>>> + int throttle = -1;
>>> + struct task_struct *tsk = current;
>>> +
>>> + task_lock(tsk);
>>> + background = task_cs(tsk)->background_dirty_ratio;
>>> + throttle = task_cs(tsk)->throttle_dirty_ratio;
>>> + task_unlock(tsk);
>> ditto?
>
> It is required to take the task lock while dereferencing the tasks cpuset
> pointer.

Agreed.
-- Ethan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-09-19 02:27    [W:0.067 / U:37.052 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site