Re: spin_lock_irqsave or spin_lock in work queue handlers?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello again!


> mutex does not "lock" in the sense of blocking the CPU - but in the
> sense that if the lock is not free, the task will be switch out and
> another task switch in, done by scheduler.

O.K. I understand so I ask in another way:
For example my work handler is running on CPU0 and holds the mutex_lock.
Then (on CPU1) my work handler also calls mutex_lock.
Will it "see" that the lock is held by the work handler on CPU0 and will
it be switched out by the scheduler?



I think one answer can answer both question:   Generally, all locking
API always work on global variable.   Global variable means the entire
linux kernel only have one copy of the variable. For eg, for varA all
spinlock(varA) are basically holding on the same variable - the same
copy in memory.

There is no meaning of individual CPU have their own private variable
- individually whatever they do, is not visible to the other CPU, so
what is the purpose of locking?

Yes, all API means semaphore/mutex/spinlocks.


O.K. So I use mutex_locks now.
Many Thanks for the information and your patience!

Regards,
Lukas

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux