On Tue, 20 Feb 2001, Keith Owens wrote:
> On Mon, 19 Feb 2001 06:15:22 -0600 (CST), 
> Philipp Rumpf <[EMAIL PROTECTED]> wrote:
> No need for a callin routine, you can get this for free as part of
> normal scheduling.  The sequence goes :-
> 
> if (use_count == 0) {
>   module_unregister();
>   wait_for_at_least_one_schedule_on_every_cpu();
>   if (use_count != 0) {
>     module_register();        /* lost the unregister race */
>   }
>   else {
>     /* nobody can enter the module now */
>     module_release_resources();
>     unlink_module_from_list();
>     wait_for_at_least_one_schedule_on_every_cpu();
>     free_module_storage();
>   }
> }
> 
> wait_for_at_least_one_schedule_on_every_cpu() prevents the next

wait_for_at_least_one_schedule_on_every_cpu() *is* callin_other_cpus().
I agree the name isn't optimal.  (and yes, you could implement it by
hacking sched.c directly, but I don't think that's necessary).

> The beauty of this approach is that the rest of the cpus can do normal
> work.  No need to bring everything to a dead stop.

Which nicely avoids potential deadlocks in modules that need to initialize
on all CPUs.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to