Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5803229ybp; Tue, 8 Oct 2019 08:31:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwgQmWc76In1wM6JfmRJPK435O6Sh4GJyCikam1yvRkuAgwqd5PUrSe3oMd4jQIaMD01vPR X-Received: by 2002:a50:d949:: with SMTP id u9mr34453254edj.142.1570548718506; Tue, 08 Oct 2019 08:31:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570548718; cv=none; d=google.com; s=arc-20160816; b=cxBOlGz9WYQwRA3oINFfjtajXixQtpQPXrehcYd3SNWKQZtl8p2WZxmrntp9dvxP50 N/sPMukHyErept/0yOdm9PEjK6epO1ax7SgJ2xPsDVGWI1i+w08X7iPN0o631bsu80kH P74r+OJHp3r1PpfzP9tfyMu0EJOHzy4vOMS8PGPaihOpfZEqYH9NvYZQ6hVcoszBi7Rc N8fUL05SqNaBJH+Tjk1MpgPLazW/2VW5iVb1DqtJaMiPtbxQfTOcIsapH6hHJGsGFR56 6YW146+rJjeARo7dBeX5plY2tMuDWgi3pBfH+L29q8oK+LQJ/bpULDJ5n7M2MckreToL 7jkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=457l+Cgh0YGrUvlYdgFiGAo7ttUX93RzVW+DU37+Q0c=; b=G93oeLqj5rQucsRIIYNl3Fi3m0uyaRrFkQzdE9HH0NMOoNoHxHKPntJf/gkA34LjwO t2jlz/jBBAvcsG+dbkWqme6zbtZldf9sMfSbizJCg6UjpAYnaRE7omD+4E51DqrZny4r bzTyZzF/OgRFgprJotBVHsa75WIl84ICdoqsnJHCilgIusMtyQjIbEjgYY67ziKkBq/L GVbxOnBVSGENjK+VZOPyLyXip7TSN2xtS0P3tz3HtujvFa4NVqteSCaWVvKSveeyNQNb SHqMpwLRva3UqLZfeUzv8QPiM/xQAe2qy6huIB6Xx9IbBt2wJ5QU3SghZIUrS/U4csbg 5AtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d0orDhsu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z6si10867783edm.316.2019.10.08.08.31.34; Tue, 08 Oct 2019 08:31:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d0orDhsu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728271AbfJHPaH (ORCPT + 99 others); Tue, 8 Oct 2019 11:30:07 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:41430 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726057AbfJHPaH (ORCPT ); Tue, 8 Oct 2019 11:30:07 -0400 Received: by mail-wr1-f65.google.com with SMTP id q9so19932404wrm.8 for ; Tue, 08 Oct 2019 08:30:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=457l+Cgh0YGrUvlYdgFiGAo7ttUX93RzVW+DU37+Q0c=; b=d0orDhsuPkSm8v6nGrYvlUpBDez/Oy1vw0MygH1fKuj9rsAAIFNwMtcecjGYJ4PU21 8QM6v+horvUr21q+BbqU6QE8CkSMB/InvrE1mJy6EhwzEqq1ybcKBh4ovhwypdrkjXFN K5KvVtbf4FSmKJzxL1burEnR6QYq1hwJ9qnq/jrfSHOq6OWecUnrXwlDbrTpEKh59izp 6a6LyZr8Ec3lJY2KFbabCegx4cKEClq6b5I5K52bTiobKIk+j11g9NUWTDnG28/1HjNw tZSqMLFjIRJKRr4JL0eF6V26hhsD709ju3UeqGq6mLXBQ+xfr/8rm/3Rvq90v3ffPdzN pwbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=457l+Cgh0YGrUvlYdgFiGAo7ttUX93RzVW+DU37+Q0c=; b=b3j8//RXxshTe9dDxZYQU0OIh/LKhAmT7B4wa1/HJGq8d//XaPHuUJ2iPsyBCTxXe3 WzOpg/XXjsc28L0UZjIyncB89nXEfoF20noRA7kOIqQL/1J8imIMqdPJBp64HHfRR+Z0 PWJYtusLs/NAysT8fmjFp17RkPBBN/N5mXbpCfUYqUwbj/G+mBHj6vZs5/XpPoFkTmpr KERpGgO/rvt2orDF1wwyDWMy9W65PJDq2JFwAtcDNhzQgE01BACs98rUDBzXdpZvtGRj 6pLnCS0yFZf9wFQrEYcew6qs10GStBdvdfdMGxG7aaBKZJwQWxpx66ECJ7qv5qUWrw3t cqTw== X-Gm-Message-State: APjAAAUWOvr3yAsreb4o+oRKuQqZLVFDMfj9JTuB4x8UL3IIgPaczLJR BBjYWDC1pmrRBjJYhogbAJbuLA== X-Received: by 2002:adf:f507:: with SMTP id q7mr5227287wro.127.1570548605132; Tue, 08 Oct 2019 08:30:05 -0700 (PDT) Received: from linaro.org (91-160-61-128.subs.proxad.net. [91.160.61.128]) by smtp.gmail.com with ESMTPSA id t83sm5825428wmt.18.2019.10.08.08.30.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Oct 2019 08:30:03 -0700 (PDT) Date: Tue, 8 Oct 2019 17:30:02 +0200 From: Vincent Guittot To: Valentin Schneider Cc: Peter Zijlstra , linux-kernel , Ingo Molnar , Phil Auld , Srikar Dronamraju , Quentin Perret , Dietmar Eggemann , Morten Rasmussen , Hillf Danton Subject: Re: [PATCH v3 04/10] sched/fair: rework load_balance Message-ID: <20191008153002.GA21999@linaro.org> References: <1568878421-12301-1-git-send-email-vincent.guittot@linaro.org> <1568878421-12301-5-git-send-email-vincent.guittot@linaro.org> <31cac0c1-98e4-c70e-e156-51a70813beff@arm.com> <20191008141642.GQ2294@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le Tuesday 08 Oct 2019 ? 15:34:04 (+0100), Valentin Schneider a ?crit : > On 08/10/2019 15:16, Peter Zijlstra wrote: > > On Wed, Oct 02, 2019 at 11:47:59AM +0100, Valentin Schneider wrote: > > > >> Yeah, right shift on signed negative values are implementation defined. > > > > Seriously? Even under -fno-strict-overflow? There is a perfectly > > sensible operation for signed shift right, this stuff should not be > > undefined. > > > > Mmm good point. I didn't see anything relevant in the description of that > flag. All my copy of the C99 standard (draft) says at 6.5.7.5 is: > > """ > The result of E1 >> E2 [...] If E1 has a signed type and a negative value, > the resulting value is implementation-defined. > """ > > Arithmetic shift would make sense, but I think this stems from twos' > complement not being imposed: 6.2.6.2.2 says sign can be done with > sign + magnitude, twos complement or ones' complement... > > I suppose when you really just want a division you should ask for division > semantics - i.e. use '/'. I'd expect compilers to be smart enough to turn > that into a shift if a power of 2 is involved, and to do something else > if negative values can be involved. This is how I plan to get ride of the problem: + if (busiest->group_weight == 1 || sds->prefer_sibling) { + unsigned int nr_diff = busiest->sum_h_nr_running; + /* + * When prefer sibling, evenly spread running tasks on + * groups. + */ + env->migration_type = migrate_task; + lsub_positive(&nr_diff, local->sum_h_nr_running); + env->imbalance = nr_diff >> 1; + return; + }