Prev: [PATCH -v2 0/2] ACPI, APEI EINJ injection parameters support
Next: [PATCH 2/2] pci: allow sysfs file owner to read device dependent config space
From: Michel Lespinasse on 12 May 2010 22:40 On Wed, May 12, 2010 at 5:22 AM, David Howells <dhowells(a)redhat.com> wrote: > Michel Lespinasse <walken(a)google.com> wrote: > >> In this situation, it would be perfectly fine to let threads B and C work >> in parallel as they each only want a read acquire on the rwsem. We can >> recognize this situation and let A wake B as long as there are no active >> writers on the rwsem. > > There can't be any active writers on the rwsem. �An active writer must have > just been upped and is in the process of waking the first sleeper up. Yes. My point is that by the point thread A (the writer that just got upped) gets around to waking B (a blocked reader), another reader C might have gotten active already. We don't want the nonzero active count (due to C) to prevent B from getting woken. -- Michel "Walken" Lespinasse A program is never fully debugged until the last user dies. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Michel Lespinasse on 13 May 2010 01:50
On Wed, May 12, 2010 at 7:39 PM, Michel Lespinasse <walken(a)google.com> wrote: > On Wed, May 12, 2010 at 5:22 AM, David Howells <dhowells(a)redhat.com> wrote: >> Michel Lespinasse <walken(a)google.com> wrote: >> >>> In this situation, it would be perfectly fine to let threads B and C work >>> in parallel as they each only want a read acquire on the rwsem. We can >>> recognize this situation and let A wake B as long as there are no active >>> writers on the rwsem. >> >> There can't be any active writers on the rwsem. �An active writer must have >> just been upped and is in the process of waking the first sleeper up. > > Yes. My point is that by the point thread A (the writer that just got > upped) gets around to waking B (a blocked reader), another reader C > might have gotten active already. We don't want the nonzero active > count (due to C) to prevent B from getting woken. My bad - this is actually fine. C will notice there are still waiting threads, so it will run rwsem_down_read_failed and queue itself. At this point the active count will go back down to 0 and B and C will both get woken. I'll merge this back into change 7 since change 7 does require this in order to work. -- Michel "Walken" Lespinasse A program is never fully debugged until the last user dies. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |