lkml.org 
[lkml]   [2004]   [Nov]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: contention on profile_lock
Date
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/

\
 
 \ /
  Last update: 2005-03-22 14:07    [W:0.081 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site