Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751832AbdH2JCA convert rfc822-to-8bit (ORCPT ); Tue, 29 Aug 2017 05:02:00 -0400 Received: from mga11.intel.com ([192.55.52.93]:62709 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751708AbdH2JB5 (ORCPT ); Tue, 29 Aug 2017 05:01:57 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,444,1498546800"; d="scan'208";a="1167165120" From: "Reshetova, Elena" To: Julia Lawall CC: "linux-kernel@vger.kernel.org" , "cocci@systeme.lip6.fr" , Gilles Muller , "nicolas.palix@imag.fr" , "mmarek@suse.com" , "keescook@chromium.org" , "ishkamiel@gmail.com" Subject: RE: [PATCH] Coccinelle: add atomic_as_refcounter script Thread-Topic: [PATCH] Coccinelle: add atomic_as_refcounter script Thread-Index: AQHTFoYqGU9IJrpWIkePVaGJwjOIsaKIYCIAgBK7rPA= Date: Tue, 29 Aug 2017 09:01:52 +0000 Message-ID: <2236FBA76BA1254E88B949DDB74E612B6FF5F9CA@IRSMSX102.ger.corp.intel.com> References: <1502884342-10702-1-git-send-email-elena.reshetova@intel.com> <1502884342-10702-2-git-send-email-elena.reshetova@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1889 Lines: 44 > > +identifier fname =~ ".*free.*"; > > +identifier fname2 =~ ".*destroy.*"; > > +identifier fname3 =~ ".*del.*"; > > +identifier fname4 =~ ".*queue_work.*"; > > +identifier fname5 =~ ".*schedule_work.*"; > > +identifier fname6 =~ ".*call_rcu.*"; > > Personally, I find the above regular expressions much easier to understand > than the merged version that Markus proposed. I really don't have a strong opinion on the presentation side. One is more compact, the above one perhaps a bit clearer for unexperienced reader (like myself). Sometimes when I try to read patterns from cocci folder, it takes me really a while to understand what is happening, which is not the case with simple expression above. I have just considered myself to be too new into this and therefore sticked to simple expressions to make sure I am minimizing functional mistakes. But the performance issue is > only on whether to use regular expressions or not. If you use regular > expressions, Coccinelle will not do some optimizations. But once you > decide to use regular expressions, the performance hit is already taken - > for a good cause here, to my understanding. Ok, so then performance is not even a factor. Thank you for the explanation! So just put whatever you find > convenient, in terms of readability, precision, etc. It seems that del is > not very precise, because it is a substring of multiple words with > different meanings. Maybe it should be improved, or maybe one can just > live with the false positives (eg delay), if they actually are false > positives. This is the problem that some of them might be and some not. I can call the queuing works explicitly: identifier fname4 =~ ".*queue_work.*"; identifier fname5 =~ ".*queue_delayed_work.*"; Then there is no need to match "delay", but I still like to match both "delete" and "del". Best Regards, Elena. > > julia