From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752284AbdBINf3 (ORCPT ); Thu, 9 Feb 2017 08:35:29 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:57987 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751289AbdBINfZ (ORCPT ); Thu, 9 Feb 2017 08:35:25 -0500 Date: Thu, 9 Feb 2017 13:14:58 +0100 From: Peter Zijlstra To: Uladzislau Rezki Cc: Ingo Molnar , LKML , Uladzislau 2 Rezki Subject: Re: [RFC,v2 1/3] sched: set loop_max after rq lock is taken Message-ID: <20170209121458.GC6500@twins.programming.kicks-ass.net> References: <1486543409-11493-1-git-send-email-urezki@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1486543409-11493-1-git-send-email-urezki@gmail.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 08, 2017 at 09:43:27AM +0100, Uladzislau Rezki wrote: > From: Uladzislau 2 Rezki > > While doing a load balance there is a race in setting > loop_max variable since nr_running can be changed causing > incorect iteration loops. > > As a result we may skip some candidates or check the same > tasks again. When doing the actual migration we'll drop this lock again and nr_running can change again. This cannot be done perfectly, all of load-balancing is riddled with races like this, nobody cares.