Messages in this thread | | | From | Jesse Barnes <> | Subject | Re: contention on profile_lock | Date | Thu, 4 Nov 2004 14:08:28 -0800 |
| |
On Thursday, November 4, 2004 1:51 pm, John Levon wrote: > On Thu, Nov 04, 2004 at 12:49:21PM -0800, Jesse Barnes wrote: > > John pointed out that this breaks modules. Would registering and > > unregistering a function pointer thus be module safe? Dipankar, > > hopefully you have something better? > > > > static int timer_start(void) > > { > > /* Setup the callback pointer */ > > oprofile_timer_notify = oprofile_timer; > > return 0; > > } > > Surely something like (profile.c): > > funcptr_t timer_hook; > > static int register_timer_hook(funcptr_t hook) > { > if (timer_hook) > return -EBUSY; > timer_hook = hook; > } > > static void unregister_timer_hook(funcptr_t hook) > { > WARN_ON(hook != timer_hook); > timer_hook = NULL; > /* make sure all CPUs see the NULL hook */ > synchronize_kernel(); > }
Yes, that's much better. Will post another one shortly. Thanks.
Jesse - 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/
| |