|
Sorry,
I missed the question onf the CONFIG_TRACE_IRQFLAGS - I think that
config option is meant for tracing the IRQ flow in the event of
debugging. Correct?
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ
Lukas Razik wrote: Hello!Thank you :-) . 2 diff things. semap are sync mechanism used - to sync among CPUs/processes/tasks etc. Just a counting mechanism. It DOES NOT lock the other CPU while another CPU is using the same resources. but this counting must be atomic....different arch has different instruction set to do it. sometime the kernel guarantee the atomicity by putting a spin lock around it. Take a look at the fs/super.c code - mutex is often used TOGETHER with the semaphore.I think a mutex_lock() is better. What others think? static int grab_super(struct super_block *s) __releases(sb_lock) { s->s_count++; spin_unlock(&sb_lock); down_write(&s->s_umount); if (s->s_root) { Or this: void unlock_super(struct super_block * sb) { put_fs_excl(); mutex_unlock(&sb->s_lock); } (in general all the get_xxx and put_xxx functions u see in the source code are semaphore - sorry if this generalization is wrong :-)). They goes in pair to ensure balance in counting. but u used semaphore ONLY WHEN u want to have multiple user sharing the same resources. eg, one data, many reader, but writer u can only have one - so semaphore cannot be used here - either spin lock or mutex solely. have u heard of lockfree/waitfree algorithm (check wiki)? or non-blocking synchronization? (linux call it RCU - check wiki, and under Documentation/RCU directory in source). It is a large topic itself....i cannot justify to describe it here.....type "lockfree" in google video and u can listen to a seminar on this algorithm.....wow...google video has lots of open source seminar btw. Many Thanks for your hints! |
- spin_lock_irqsave or spin_lock in work queue handlers? Lukas Razik
- Re: spin_lock_irqsave or spin_lock in work queue handl... Peter Teoh
- Re: spin_lock_irqsave or spin_lock in work queue h... Lukas Razik
- Re: spin_lock_irqsave or spin_lock in work que... Peter Teoh
- Re: spin_lock_irqsave or spin_lock in work que... Peter Teoh
- Re: spin_lock_irqsave or spin_lock in work... Lukas Razik
- Re: spin_lock_irqsave or spin_lock in... Peter Teoh
- Re: spin_lock_irqsave or spin_loc... Lukas Razik
- Re: spin_lock_irqsave or spin... Peter Teoh
- Re: spin_lock_irqsave or spin... Lukas Razik
- Re: spin_lock_irqsave or spin_lock in work queue handl... Michael Blizek
