Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp546964imm; Fri, 31 Aug 2018 07:11:37 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb3P2f5C5wun5mllMaQlBw3qre4s3ws9lXOg1IfTX0HZHm/u1NUTrY8W38S6zUZkbsHGKx4 X-Received: by 2002:a63:1760:: with SMTP id 32-v6mr12808720pgx.31.1535724697363; Fri, 31 Aug 2018 07:11:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535724697; cv=none; d=google.com; s=arc-20160816; b=c5JWxfCTa35DaUskHzZXY059TW4EyVpvV0YSq8pPC1Ufa7cMAH5lutnRK/rhGkZPO3 dI1MV4yGp8jUaKUyn+qmov3qIFRMuT76FXX5tsBlm5q4VThXEB8RnJXXmBjO7/7GoWn6 2Gv7FVRJLyP8o7VA4RPhyGaGLu7V2qOkK0hjdso7Aen8VWTN206AKUy9l5LNJc7cR9TB WNkMx/K9svjh5tkx6cJfAhO9XFOj8dL8jfeHoXKmjtdXZXG6l1+t2DmO2dbZip7SW6tL nyVOq1Sy00IFZqLxnpKnKcogpJOwT6TmIKlayCxcUZ93egvbitxv5P6y8KreA9UCbzJB h0ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:arc-authentication-results; bh=QlqunTzw1AZE+0hYlMbmWmLxRG8G3jzolZ90fjqhEuw=; b=zljwEK3JQMTO2Vx55285AxdnvztX6RIlGuW1vpEQzC4EhYK/3wIOstjBLoa/vresI7 fqOpQGgXTeW3ChV92qKP1ZjAOGqJ3ExCZS6mpws1iKwDTXMXaqRvr9SPNNk8A7VEe0Un 4I/U1yVkUev7RTul8AmWhngnQyFa7Xv/b46ZtO9GM8pC6vUkBwiNlpa62avjArh9xSCg tAhFR4njGA7kw18pKeXp6Oz5Bk+m1yDRHO2VW7ZlvBZmzPrpG+nk1QEbVpxOl2bD0R0s 22oCNcqdkCkZQg2DUPglW5BnZxKIBoAPKoaDfm4la6e5eHsPwHcSHfadSKOMegipW58z t0Yw== 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 o23-v6si10022633pgm.170.2018.08.31.07.11.22; Fri, 31 Aug 2018 07:11:37 -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 S1727795AbeHaSRc (ORCPT + 99 others); Fri, 31 Aug 2018 14:17:32 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:43531 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727404AbeHaSRc (ORCPT ); Fri, 31 Aug 2018 14:17:32 -0400 Received: by mail-qk1-f194.google.com with SMTP id 130-v6so1455992qkd.10 for ; Fri, 31 Aug 2018 07:09:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QlqunTzw1AZE+0hYlMbmWmLxRG8G3jzolZ90fjqhEuw=; b=ZotjzPo5lTsdy1KBtJxkhgHytFQOSvQivJB6TMh6K1mWzAhShuLZqKgEwurJ0BakUE rUCLwq3jNC8H5PvT2vh5lwvKKzVu9vnZY8LuGbufRgo8Vj2jSy/2FfVTcTmz7czdJ0cu sL8Gki+mReaFLolHeeSzx2QVTeVlNXjGYfqd7NLPuiU3zJKOvipm5GjLy2KWTFT3WcG0 DXC0VoDxecRqUdyKtNuMyGAPPK2BfgebRb5+trWFIgLjDLX95CWS/zDUT/eR/uEc+OIL ZbkOrMAQFw3RvVB56S7CljLF6t2QW8mjY30SEN1lF+Xa89mVQ2JXdCvhGOy6SzMeLEV8 8C3A== X-Gm-Message-State: APzg51D+FaFYJ3X9hfRpR58eJq3QLKozerJPwoF8kmc21Ro9PxaJ7ifF 4Ic466BcJCHQYwvbqgD/c4Ce9oSmWyTa31svh3U= X-Received: by 2002:a37:1b91:: with SMTP id m17-v6mr15698910qkh.173.1535724590633; Fri, 31 Aug 2018 07:09:50 -0700 (PDT) MIME-Version: 1.0 References: <20180830223429.30051-1-igor.stoppa@huawei.com> In-Reply-To: <20180830223429.30051-1-igor.stoppa@huawei.com> From: Arnd Bergmann Date: Fri, 31 Aug 2018 16:09:34 +0200 Message-ID: Subject: Re: [PATCH 00/23] Make use of unlikely() more consistently. To: igor.stoppa@gmail.com Cc: Linux Kernel Mailing List , igor.stoppa@huawei.com, Aaro Koskinen , Alasdair Kergon , Al Viro , Andrew Jeffery , Archit Taneja , asolokha@kb.kras.ru, bvanassche@acm.org, Benjamin Herrenschmidt , chien.tin.tung@intel.com, chunkeey@googlemail.com, Christoph Lameter , David Airlie , David Daney , Dennis Zhou , dima@arista.com, Doug Ledford , "Latif, Faisal" , gregkh , Daode Huang , Inaky Perez-Gonzalez , "James E.J. Bottomley" , James Hogan , Jason Gunthorpe , ejt@redhat.com, Kalle Valo , Kees Cook , Larry Finger , Linus Walleij , Madalin-Cristian Bucur , "Martin K. Petersen" , Michael Ellerman , "Michael S. Tsirkin" , michal.kazior@tieto.com, Mike Snitzer , Paul Burton , Paul Mackerras , "Rafael J. Wysocki" , Ralf Baechle , Rob Clark , rolandd@cisco.com, Salil Mehta , Shuah Khan , srivatsa.bhat@linux.vnet.ibm.com, sviau@codeaurora.org, Tejun Heo , yisen.zhuang@huawei.com, zijun_hu@htc.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 31, 2018 at 12:35 AM Igor Stoppa wrote: > > In some cases, checks that are expected to not fail, do not take advantage > of specifying that the condition being tested is unlikely(). > > Ex: > > #define assert(condition) > ... > if (!(condition)) > error_action() > ... > > should be > > #define assert(condition) > ... > if (unlikely(!(condition))) > error_action() > ... There is a potential that this introduces false-postive -Wmaybe-uninitialized warnings when CONFIG_PROFILE_ANNOTATED_BRANCHES is set, since that turns unlikely() into a complex operation that in turn confuses the compiler so it no longer keeps track of which variables are initialized or not. It's possible that none of your patches do that, but one needs to be aware of the problem, and possibly revert some of your patches if it does cause warning regressions in drivers that don't actually benefit from the micro-optimization. > In other cases, the hint is given twice: once explicitly and once inside > whatever test is being performed: assert(), BUG_ON(), WARN_ON(), etc. > > Ex: > > if (unlikely(WARN_ON(condition, message))) > ... Removing those is definitely fine. Arnd