[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4F5724BC.10207@cn.fujitsu.com>
Date: Wed, 07 Mar 2012 17:05:00 +0800
From: Miao Xie <miaox@...fujitsu.com>
To: Andrew Morton <akpm@...ux-foundation.org>
CC: Mel Gorman <mgorman@...e.de>, David Rientjes <rientjes@...gle.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Christoph Lameter <cl@...ux.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cpuset: mm: Reduce large amounts of memory barrier related
damage v2
On Tue, 6 Mar 2012 14:54:51 -0800, Andrew Morton wrote:
>>>> -static inline void put_mems_allowed(void)
>>>> +/*
>>>> + * If this returns false, the operation that took place after get_mems_allowed
>>>> + * may have failed. It is up to the caller to retry the operation if
>>>> + * appropriate
>>>> + */
>>>> +static inline bool put_mems_allowed(unsigned int seq)
>>>> {
>>>> - /*
>>>> - * ensure that reading mems_allowed and mempolicy before reducing
>>>> - * mems_allowed_change_disable.
>>>> - *
>>>> - * the write-side task will know that the read-side task is still
>>>> - * reading mems_allowed or mempolicy, don't clears old bits in the
>>>> - * nodemask.
>>>> - */
>>>> - smp_mb();
>>>> - --ACCESS_ONCE(current->mems_allowed_change_disable);
>>>> + return !read_seqcount_retry(¤t->mems_allowed_seq, seq);
>>>> }
>>>>
>>>> static inline void set_mems_allowed(nodemask_t nodemask)
>>>
>>> How come set_mems_allowed() still uses task_lock()?
>>>
>>
>> Consistency.
>>
>> The task_lock is taken by kernel/cpuset.c when updating
>> mems_allowed so it is taken here. That said, it is unnecessary to take
>> as the two places where set_mems_allowed is used are not going to be
>> racing. In the unlikely event that set_mems_allowed() gets another user,
>> there is no harm is leaving the task_lock as it is. It's not in a hot
>> path of any description.
>
> But shouldn't set_mems_allowed() bump mems_allowed_seq?
>
task_lock is also used to protect mempolicy, so ...
Thanks
Miao
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists