Re: [PATCH] sched/fair: Fix race in update_cfs_rq_h_load()
From: Peter Zijlstra
Date: Thu Oct 16 2014 - 16:31:32 EST
On Thu, Oct 16, 2014 at 05:49:19PM +0400, Kirill Tkhai wrote:
>
> The original idea of cfs_rq::last_h_load_update was to do not
> update cfs_rq::h_load more than once a jiffies.
>
> Since task_numa_compare()->task_h_load()->update_cfs_rq_h_load()
> makes unlocked update, this may be a reason of race between two
> parallel updates, or with remote rq->curr changing.
>
> The patch does not change idea, but it excludes the race. Now we
> update cfs_rq::h_load holding rq's lock. This happens in two
> places: every jiffie in task_tick_fair(), and in set_curr_task_fair()
> when task becomes fair.
But why is this a problem? Most of the load balance code is racy like
hell -- purposely so, added serialization is typically worse.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/