From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753513AbdDEGMw (ORCPT ); Wed, 5 Apr 2017 02:12:52 -0400 Received: from mout.gmx.net ([212.227.15.15]:63532 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752282AbdDEGMu (ORCPT ); Wed, 5 Apr 2017 02:12:50 -0400 Message-ID: <1491372741.4536.165.camel@gmx.de> Subject: Re: net/sched: latent livelock in dev_deactivate_many() due to yield() usage From: Mike Galbraith To: Cong Wang Cc: netdev , LKML , Peter Zijlstra Date: Wed, 05 Apr 2017 08:12:21 +0200 In-Reply-To: References: <1491107321.13631.33.camel@gmx.de> <1491362429.4536.77.camel@gmx.de> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.5 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:NaOtu3f4U8SXswFACqngNhK8d4Ek1AAZQ8DK4dyeFrAdcwxngNB iWt8YBHIlMGXCxZm5LJmkfV5BIIc3pUPB5vFIGng1Qy2jS0flPtFkjXmJ0F/Y07tWOEZ+Av FDZ7Imb8103BIBCNtYTsEmFADl4z/Kgqb42tvD+Bz/8Una78JkvFPavHkLuwZqt7j9taNZs Maf5KIELSC98grNHRlGiQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:e6qyF96ToxE=:++rAaXSUHmRN7jaBcXmjuy 2uer4URQv1HyjszozZk9R4rV/mtyLGLyWIdycg8+AdF59KwP6AKmYq/OrNfvloIZ6vZnUW6Ry b4IR1xm1CtJjACtwQHyR2hVN7i81yJMDHpaURmKgyBn08lDTwi7thUAxa/sidESGV/BvWvDd7 S+YxAqt1Ux2UIQNPR6XZXf6k+N8yVwoKmojoHE2Avv6lF+QgdDgi9upRc/xOYs/lf+175Wvr0 nJSHdyS8UEpvTgJysItM0gKmXZqJbPXTK30GyVPR5MtfqWwhUjY7tmpuyrIOsftHwp9RpmfSr ipLyBfBGhtXrz5oUW8La0maXsGOEyWa+cExDQI38rxnDCgKyLO7HStBkDgaaxxy0GtO0w3pRc P8gnSEp8E59a46Yohx8hAG2HYXEsFUtPnAA8YWff6dRI/9WdtjgSZh3+f7eWrjhRjfT4+Y52X BCw30mlbdfy/gogjs22XGgPxXopyvRaAZVt6o5UorAULGfi1Sgn7NqvfgfiI1knn/ubEgKWzA S5y50OSdErAWUpphKNW1/VSRjpcOTVpUK6w5jaIMxBbHPOaRXiJfnJJ6TrvcdcLVFiHJqAGZa HRTH5lheWv9YD3D+RHzLJNBtjnNAkGxFqpjWxHuOynwkjBlgZSeFUjoZRFioKZh7pIBBbQvgF k5Yx3REnmbYEWEuzUPHOYNGilR4vTJAYRs3Az7kuza+TwPjb5zbnHK4cBUYxsvuhyafe3xNpm MPPhMjYtSfGfYpIah60XsaqaCvT5w4oEvCDL9H88iVZVVwFP7+u4mhxdfkFfFp0XkhT7JrJYc KqVTMQt Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2017-04-04 at 22:25 -0700, Cong Wang wrote: > On Tue, Apr 4, 2017 at 8:20 PM, Mike Galbraith wrote: > > - while (some_qdisc_is_busy(dev)) > > - yield(); > > + swait_event_timeout(swait, > > !some_qdisc_is_busy(dev), 1); > > } > > I don't see why this is an improvement even if I don't care about the > hardcoded timeout for now... Why the scheduler can make a better > decision with swait_event_timeout() than with cond_resched()? Because sleeping gets you out of the way? There is no other decision the scheduler can make while a SCHED_FIFO task is trying to yield when it is the one and only task at it's priority. The scheduler is doing exactly what it is supposed to do, problem is people calling yield() tend to think it does something it does not do, which is why it is decorated with "if you think you want yield(), think again" Yes, yield semantics suck rocks, basically don't exist. Hop in your time machine and slap whoever you find claiming responsibility :) -Mike