On Wed, 7 May 2008, Andrew Morton wrote:No, just use the normal static ordering for that case: one type of lock goes before the other kind. If those locks nest in regular code, you have to do that *anyway*. The code that can take many locks, will have to get the global lock *and* order the types, but that's still trivial. It's something like spin_lock(&global_lock); for (vma = mm->mmap; vma; vma = vma->vm_next) { if (vma->anon_vma) spin_lock(&vma->anon_vma->lock); } for (vma = mm->mmap; vma; vma = vma->vm_next) { if (!vma->anon_vma && vma->vm_file && vma->vm_file->f_mapping) spin_lock(&vma->vm_file->f_mapping->i_mmap_lock); } spin_unlock(&global_lock); and now everybody follows the rule that "anon_vma->lock" precedes "i_mmap_lock". So there can be no ABBA deadlock between the normal users and the many-locks version, and there can be no ABBA deadlock between many-locks-takers because they use the global_lock to serialize. This really isn't rocket science, guys. (I really hope and believe that they don't nest anyway, and that you can just use a single for-loop for the many-lock case) Linus --
| Alan Cox | [PATCH 01/76] drivers/serial/crisv10.c: add missing put_tty_driver |
| Greg Kroah-Hartman | [PATCH 004/196] Chinese: add translation of SubmittingPatches |
| James Bottomley | Re: Integration of SCST in the mainstream Linux kernel |
| Ingo Molnar | [bug] mm/slab.c boot crash in -git, "kernel BUG at mm/slab.c:2103!" |
git: | |
| Jon Smirl | Re: VCS comparison table |
| Junio C Hamano | [RFD] On deprecating "git-foo" for builtins |
| Jakub Narebski | Re: [RFC] Git User's Survey 2008 |
| Eric Wong | [PATCH] archimport improvements |
| Richard Stallman | Real men don't attack straw men |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| David H. Lynch Jr. | Re: That whole "Linux stealing our code" thing |
| Marcos Laufer | dmesg IBM x3650 OpenBSD 4.3 |
| Jeff Garzik | Re: [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin" |
| David Miller | [GIT]: Networking |
| Mark Lord | Re: 2.6.25-rc8: FTP transfer errors |
| David Miller | Re: [BUG] New Kernel Bugs |
