Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261770AbVCNTnu (ORCPT ); Mon, 14 Mar 2005 14:43:50 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261804AbVCNTns (ORCPT ); Mon, 14 Mar 2005 14:43:48 -0500 Received: from 209-204-138-32.dsl.static.sonic.net ([209.204.138.32]:62733 "EHLO graphe.net") by vger.kernel.org with ESMTP id S261770AbVCNTku (ORCPT ); Mon, 14 Mar 2005 14:40:50 -0500 Date: Mon, 14 Mar 2005 11:40:36 -0800 (PST) From: Christoph Lameter X-X-Sender: christoph@server.graphe.net To: Oleg Nesterov cc: linux-kernel@vger.kernel.org, Shai Fultheim , Andrew Morton , Ingo Molnar Subject: Re: [patch] del_timer_sync scalability patch In-Reply-To: <42343C61.6A1210C0@tv-sign.ru> Message-ID: References: <4231E959.141F7D85@tv-sign.ru> <42343C61.6A1210C0@tv-sign.ru> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Score: -5.8 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1169 Lines: 46 On Sun, 13 Mar 2005, Oleg Nesterov wrote: > I suspect that del_timer_sync() in its current form is racy. > > CPU 0 CPU 1 > > __run_timers() sets timer->base = NULL > > del_timer_sync() starts, calls del_timer(), it returns > because timer->base == NULL. > > waits until the run is complete: > while (base->running_timer == timer) > preempt_check_resched(); > > calls schedule(), or long interrupt happens. > > timer reschedules itself, __run_timers() > exits. > > base->running_timer == NULL, end of loop. > > next timer interrupt, __run_timers() picks > this timer again, sets timer->base = NULL > > if (timer_pending(timer)) // no, timer->base == NULL timer->base is != NULL because the timer has rescheduled itself. __mod_timer sets timer->bBase > goto del_again; // not taken Yes it is taken! > > del_timer_sync() returns > > timer runs. Nope. - 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/