Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Thu, 16 Jan 2003 13:33:17 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Thu, 16 Jan 2003 13:33:17 -0500 Received: from smtpzilla1.xs4all.nl ([194.109.127.137]:33552 "EHLO smtpzilla1.xs4all.nl") by vger.kernel.org with ESMTP id ; Thu, 16 Jan 2003 13:33:16 -0500 Message-ID: <3E26F6DC.D9150735@linux-m68k.org> Date: Thu, 16 Jan 2003 19:15:56 +0100 From: Roman Zippel X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.20 i686) X-Accept-Language: en MIME-Version: 1.0 To: Werner Almesberger CC: Rusty Russell , kuznet@ms2.inr.ac.ru, kronos@kronoz.cjb.net, linux-kernel@vger.kernel.org Subject: Re: [RFC] Migrating net/sched to new module interface References: <20030115063349.A1521@almesberger.net> <20030116013125.ACE0F2C0A3@lists.samba.org> <20030115234258.E1521@almesberger.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Hi, Werner Almesberger wrote: > If there's a really nasty case, where you absolutely can't > afford to sleep, you need to change the service to split > "deregister" into: > > - prepare_deregister (like "deregister", but reversible) > - commit_deregister > - undo_deregister You can simplify this. All you need are the following simple functions: - void register(); - void unregister(); - int is_registered(); - void inc_usecount(); - void dec_usecount(); - int get_usecount(); It's important to understand that the registered state and the usecount are completely independent. As soon as the object is unregistered and the usecount is zero, the object can be freed, but it doesn't matter in which order it happens. The problem is now that we are very limited how we can use these functions. We can only unregister an object after the usecount became zero, although it's also possible to first unregister the object and then wait for the usecount. Only when we can do the latter is it possible to safely force the removal of the object. bye, Roman - 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/