Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2219432ybe; Sat, 7 Sep 2019 11:08:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqyzUUyyXf2OieTvln23Jl8/THPFpN6iHqZ4fa4gYKMPr/S5t7VuAKRTTyN29kN5icUTOQaq X-Received: by 2002:a17:90a:25a9:: with SMTP id k38mr17004171pje.12.1567879700052; Sat, 07 Sep 2019 11:08:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567879700; cv=none; d=google.com; s=arc-20160816; b=PKClCYU7ymXxkzBNAvKdlB2gHfdXL0hlLvRS+c6a60opaoB1lxq8wG+a81dN/owYab +7wdYdaQ7WSzHxEZQ8lWHOZ5AcnAZi1HMhGnx4pGg8eUFsLpz8d0oPXhhdz6UV9nzx+L qKwz8fdmtKNIDhLC7jrADKHNwXmOGELUTv5PrHkprata9Wf0Y+rdFwDrmIHLvWjcRcYr zxEsNkRtT9kp+GOJcqAMMlCcvln1pxBKoNTBhadLIZRH7IWng8npJR8wOOei2xVGRXY3 aOi8LZV6aJSGtaAxaZpEZC54Q/nSiWoByU3SxgeDuQCEnoqBRSJPF1q3zyK+6MhgtNPs XHsA== 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=Q50YWDbiSd1qIGUsdn2HhgRM3zE7h0WNAycJ80w5WqI=; b=JmFRZfac1sOXrKcQoLWRj53RhN0ojo3/2O2evsyE/guokEOrPeOD2LfiFLZ3Mopu5A gL/wOaeuzVuoYh5gPf/sEY6fzDQBejfN0WHxfo5niEY8YHWGwwLKYaOOB4/juRt2KKVd dKvLYdYJuiB7F8PaH0kPJVjadwH2oHpG9VCAKKA6Lq9s6/dAfhXEc7sGJQ1naXpcVkoS um8IG1Fo0PKHgj3fZx++kzophIgiaf+TffdJH18Omizkmczg14b8NgGIlLYDmmtIQkYA weR3fDmNSIRhNxNjVUHvN/TnDIeDfHYuDUCW4pkT5cfG5Yp/bJbvzMrThxc6vbpZMH5P cOIg== 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 l16si7512262pgt.568.2019.09.07.11.08.04; Sat, 07 Sep 2019 11:08:20 -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 S2391052AbfIFUzo (ORCPT + 99 others); Fri, 6 Sep 2019 16:55:44 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:39119 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387845AbfIFUzo (ORCPT ); Fri, 6 Sep 2019 16:55:44 -0400 Received: by mail-ed1-f66.google.com with SMTP id u6so7710949edq.6 for ; Fri, 06 Sep 2019 13:55:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Q50YWDbiSd1qIGUsdn2HhgRM3zE7h0WNAycJ80w5WqI=; b=b8ep5il1/UW5U/R/SLoUCMnCTGKP71xTJCDs8822eJIJovCH78iDyTO9FE792XLLYR cb4EJajZ3j+ke/5cvqGjPYhxHJWggZBgxeK0mgF6soUw2X3WsITX8WYC/WDTlB/itRHH /O2Dft/4YvDR/dEF1KHhWVpDhj04a0PKQSEEHX7R74F8SrsbkcfFl5Pf2l6rQQzIwJUr LwBCVZbvr5bySrCDv0PF2Tnq+X/xGb3NK76JRrxs3qv4GAhny/KtYKiXUnZzBUNRdX+o 05c2qZERp+5TIIO9lAQ2NrvhWmt0iQ7NGmLD58TL0S9PB1InoVHKzvck3twhCdLjlmV2 TXpA== X-Gm-Message-State: APjAAAXcDyxlWC963T2bkrQd9vBiXqgClYj9Ll1m9TIfDodtMYrPfFm0 ZU1lI6UXnpmpAQxXqP6fK1M= X-Received: by 2002:a17:906:7294:: with SMTP id b20mr9136472ejl.216.1567803342364; Fri, 06 Sep 2019 13:55:42 -0700 (PDT) Received: from [10.68.32.192] (broadband-188-32-48-208.ip.moscow.rt.ru. [188.32.48.208]) by smtp.gmail.com with ESMTPSA id a17sm1143026edv.66.2019.09.06.13.55.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Sep 2019 13:55:41 -0700 (PDT) Subject: Re: [PATCH v2] scripts: coccinelle: check for !(un)?likely usage To: Julia Lawall Cc: linux-kernel@vger.kernel.org, cocci@systeme.lip6.fr, Gilles Muller , Nicolas Palix , Michal Marek , Markus Elfring , Joe Perches , Rasmus Villemoes References: <20190825130536.14683-1-efremov@linux.com> <20190829171013.22956-1-efremov@linux.com> From: Denis Efremov Message-ID: <3981b788-cd0b-d2c4-4585-d209f6f6a522@linux.com> Date: Fri, 6 Sep 2019 23:55:39 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.0 MIME-Version: 1.0 In-Reply-To: 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 Hi, On 06.09.2019 23:19, Julia Lawall wrote: > > > On Thu, 29 Aug 2019, Denis Efremov wrote: > >> This patch adds coccinelle script for detecting !likely and >> !unlikely usage. These notations are confusing. It's better >> to replace !likely(x) with unlikely(!x) and !unlikely(x) with >> likely(!x) for readability. >> >> The rule transforms !likely(x) to unlikely(!x) based on this logic: >> !likely(x) iff >> !__builtin_expect(!!(x), 1) iff >> __builtin_expect(!!!(x), 0) iff >> unlikely(!x) >> >> For !unlikely(x) to likely(!x): >> !unlikely(x) iff >> !__builtin_expect(!!(x), 0) iff >> __builtin_expect(!!!(x), 1) iff >> likely(!x) >> >> Signed-off-by: Denis Efremov >> Cc: Julia Lawall >> Cc: Gilles Muller >> Cc: Nicolas Palix >> Cc: Michal Marek >> Cc: Markus Elfring >> Cc: Joe Perches >> Cc: Rasmus Villemoes > > Acked-by: Julia Lawall > > A small improvement though would be to improve the explicit dependency of > the last four python rules on r1 and r2. Those rules won't execute unless > the inherited metavariable has a value, which makes the same dependency. > > julia I think I will resend this patch as a part of patchset with all warnings fixed in a couple of days. Hope this will help to create a discussion point with other developers about readability of "!likely" and "!unlikely". Thanks, Denis