Prev: arch/x86/kernel: Drop memory allocation cast
Next: [CPUFREQ] fix race condition in store_scaling_governor
From: Andrew Morton on 12 May 2010 03:40 On Wed, 12 May 2010 15:20:51 +0800 Miao Xie <miaox(a)cn.fujitsu.com> wrote: > @@ -985,6 +984,7 @@ repeat: > * for the read-side. > */ > while (ACCESS_ONCE(tsk->mems_allowed_change_disable)) { > + task_unlock(tsk); > if (!task_curr(tsk)) > yield(); > goto repeat; Oh, I meant to mention that. No yield()s, please. Their duration is highly unpredictable. Can we do something more deterministic here? Did you consider doing all this with locking? get_mems_allowed() does mutex_lock(current->lock)? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Andrew Morton on 12 May 2010 13:50 On Wed, 12 May 2010 17:00:45 +0800 Miao Xie <miaox(a)cn.fujitsu.com> wrote: > on 2010-5-12 12:32, Andrew Morton wrote: > > On Wed, 12 May 2010 15:20:51 +0800 Miao Xie <miaox(a)cn.fujitsu.com> wrote: > > > >> @@ -985,6 +984,7 @@ repeat: > >> * for the read-side. > >> */ > >> while (ACCESS_ONCE(tsk->mems_allowed_change_disable)) { > >> + task_unlock(tsk); > >> if (!task_curr(tsk)) > >> yield(); > >> goto repeat; > > > > Oh, I meant to mention that. No yield()s, please. Their duration is > > highly unpredictable. Can we do something more deterministic here? > > Maybe we can use wait_for_completion(). That would work. > > > > Did you consider doing all this with locking? get_mems_allowed() does > > mutex_lock(current->lock)? > > do you means using a real lock(such as: mutex) to protect mempolicy and mem_allowed? yes. > It may cause the performance regression, so I do my best to abstain from using a real > lock. Well, the code as-is is pretty exotic with lots of open-coded tricky barriers - it's best to avoid inventing new primitives if possible. For example, there's no lockdep support for this new "lock". mutex_lock() is pretty quick - basically a simgle atomic op. How frequently do these operations occur? The code you have at present is fairly similar to sequence locks. I wonder if there's some way of (ab)using sequence locks for this. seqlocks don't have lockdep support either... -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Andrew Morton on 13 May 2010 15:20
On Thu, 13 May 2010 14:16:33 +0800 Miao Xie <miaox(a)cn.fujitsu.com> wrote: > > > > The code you have at present is fairly similar to sequence locks. I > > wonder if there's some way of (ab)using sequence locks for this. > > seqlocks don't have lockdep support either... > > > > We can't use sequence locks here, because the read-side may read the data > in changing, but it can't put off cleaning the old bits. I don't understand that sentence. Can you expand on it please? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |