Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932524AbbFFICx (ORCPT ); Sat, 6 Jun 2015 04:02:53 -0400 Received: from eddie.linux-mips.org ([148.251.95.138]:33018 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752488AbbFFICk (ORCPT ); Sat, 6 Jun 2015 04:02:40 -0400 Date: Sat, 6 Jun 2015 10:02:30 +0200 From: Ralf Baechle DL5RB To: Vaishali Thakkar Cc: "David S. Miller" , linux-hams@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Julia Lawall Subject: Re: [PATCH] net: rose: Use mod_timer Message-ID: <20150606080230.GB16240@linux-mips.org> References: <20150606042234.GA15542@vaishali-Ideapad-Z570> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150606042234.GA15542@vaishali-Ideapad-Z570> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1271 Lines: 37 Hi Vaishali, On Sat, Jun 06, 2015 at 09:52:34AM +0530, Vaishali Thakkar wrote: > Use mod_timer instead of del_timer followed by add_timer to update > the expire field of the active timer. > > The semantic patch that performs this transformation is as follows: > > @change@ > expression e1, e2, e3, e4; > @@ > > - del_timer(&e1); > ... when != e1 = e3 > - e1.expires = e2; > ... when != e1 = e4 > - add_timer (&e1); > + mod_timer (&e1, e2); This isn't quite right. All the instances of this pattern in the ROSE stack also modify the timer's data and function fields which if the timer is still running and expiring while being fiddled with, might result in a race condition, that is the old function but new data field being used in combination or something like that. For some of the timers (maybe all?) it should be possible to proof that always the same values for data and function are being used. These initializations could then be used elsewhere and the code could then indeed be switched to mod_timer. Ralf -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/