On Mon, Oct 10, 2005 at 12:59:44 +0100, Manish Regmi wrote: > On 10/10/05, NAHieu <nahieu@xxxxxxxxx> wrote: > > > > > > I want to export this function (EXPORT_SYMBOL), so other modules or > > kernel code can use it. The problem is: I am afraid that if this > > function is called at the same time (one is running in module, and at > > the same time other module calls it), there can be conflict. Is that > > really possible? > > > > If the problem is possible, how can I solve it? Is mutex the answer to > > this problem? > > Yes there can be conflict When you are using Preemptible kernel or SMP. > Spinlock, disabling of preemption (automatically done by locks) or any > other lock available in Kernel can solve your problem. Have you noticed the OP said the function can sleep? For such functions there can be conflict even on non-preemptive UP kernel. Disabling preemption should never be done manually unless you have very deep understanding of what is going on and have a very clever trick to play. It is properly used within all the primitives that need it. > I Cannot tell for sure which one will be best for you unless i know what you > want to achieve. -- Jan 'Bulb' Hudec <bulb@xxxxxx>
Attachment:
signature.asc
Description: Digital signature