Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5737722ybp; Tue, 8 Oct 2019 07:35:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfodC3XhsaJGaNfIyJR/q772X8pNC/rl0IHk7pxRNHUEQbGDfO4dLy8yV7/NKvU6+E5AX0 X-Received: by 2002:a17:906:a40d:: with SMTP id l13mr28407097ejz.237.1570545318401; Tue, 08 Oct 2019 07:35:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570545318; cv=none; d=google.com; s=arc-20160816; b=TgNYMmo8Z3BM0Ig1lxIsUgSmF7qbT6N7Xd2RCnfjkOfP5oj+Kutm/OjSMGYFsheZXm 7gEV+87nYLQxdLIbZDZ5CZLNHkoubPcWaoVkc08gbi0/qebKBGJmorc6R7gJVNyJ29C+ h8/KHCoNLz7fqjd4+ii4o72nNyFbv9vgRQldF7YYMCNRHCxpJduhwEZlDDk+bX/jWIGU ipyFexN2WYR1j0hQ/7EcIGAn1iHJbt6qb0G9eLbChrXlPP1iZJ+TT6+Gj8mmw67x8OgY v7N3xxYAP3D7ZxC1cXuR6a1C+N4xyZxelKe1n9nTKvrRF1S/7WaH6ZCy8wpv1qdAOAvg Ya8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=D1Bk8oMWpuCCCXlsnhfAjrbYecawFgvxAjj1hTfF7sA=; b=nuZ/TBekTKIguI8gsA1vx9QbKwb4c/FnN/+EEMe7XS0bu2nqom/HvHdGn9ayFnlksH TvsZlDPfNwPt5zRMkh7WRMqd2UBQhWAEbInQgonRq5CbF0VbJunSJbcChvYuaHJ8GZ02 9vXDGcnKAyC2SD8Ez/wMQA8X0Os7WyGUefEiyb+PmI+RX82IuI8wguODmFBKPThX4ylz N3pN01abd8vnJfjnsovFs2N8NVcU0gVG/LXjV7QtXXbEguDIKY3qMEhhYROleNj/ppBI czAnL00X8l0TcCtLYLZOOPJWTu1rP1t9ABnPXcdnJ3bZKtMz2Ebw/QEZuRMthEp9QRyU bMnQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y11si8859412eje.365.2019.10.08.07.34.54; Tue, 08 Oct 2019 07:35:18 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726822AbfJHOeH (ORCPT + 99 others); Tue, 8 Oct 2019 10:34:07 -0400 Received: from foss.arm.com ([217.140.110.172]:38216 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725839AbfJHOeH (ORCPT ); Tue, 8 Oct 2019 10:34:07 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8B5AE1570; Tue, 8 Oct 2019 07:34:06 -0700 (PDT) Received: from [10.1.194.37] (e113632-lin.cambridge.arm.com [10.1.194.37]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 50A223F703; Tue, 8 Oct 2019 07:34:05 -0700 (PDT) Subject: Re: [PATCH v3 04/10] sched/fair: rework load_balance To: Peter Zijlstra Cc: Vincent Guittot , linux-kernel , Ingo Molnar , Phil Auld , Srikar Dronamraju , Quentin Perret , Dietmar Eggemann , Morten Rasmussen , Hillf Danton 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> From: Valentin Schneider Message-ID: Date: Tue, 8 Oct 2019 15:34:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191008141642.GQ2294@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.