kthread_create and rel_mplock

Michael Neumann mneumann at ntecs.de
Sun May 18 10:55:26 PDT 2008


Hi,

If I understand the kthread_create correctly, it will always acquire the
mplock (something like a global lock). That means, if I create two
threads, they will automatically be serialized (i.e. run sequentially),
unless I release the lock within a thread manually. Is that correct?
Does that mean that I can remove the mtx_lock in the FreeBSD example
below:
      void
      usb_task_thread(void *arg)
      {
             mtx_lock(&Giant);
             // ....
             kproc_exit(0);
      }
      kthread_create(..., usb_task_thread);

Is mtx_lock(&Giant) equivalent to the mplock on DragonFly?
My understanding is that it is equivalent, and that I don't need any
further critical sections.
Regards,

  Michael





More information about the Kernel mailing list