On Wed, Dec 18, 2019 at 4:14 PM Josh Triplett <josh@xxxxxxxxxxxxxxxx> wrote: > > Er, wrong file. That's the original patch; the attached patch is the > right one. This looks correct to me. If I were to actually commit it, the "split into two waitqueues" would be a separate patch from the "use wait_event_interruptible_exclusive() and add "wake_next_reader/writer logic", but for testing purposes the unified patch was simpler, and your forward port looks good to me. I ran the original patch for a couple of days, and didn't see any other issues than the 'make' thing in F30. It was all good with my self-build make. But that "ran for a couple of days" wasn't all that stress-full. I did do the "verify that the thundering herd is gone" test - including that silly test-case here again: #include <unistd.h> int main(int argc, char **argv) { int fd[2], counters[2]; pipe(fd); counters[0] = 0; counters[1] = -1; write(fd[1], counters, sizeof(counters)); /* 64 processes */ fork(); fork(); fork(); fork(); fork(); fork(); do { int i; read(fd[0], &i, sizeof(i)); if (i < 0) continue; counters[0] = i+1; write(fd[1], counters, (1+(i & 1)) *sizeof(int)); } while (counters[0] < 1000000); return 0; } where you can tweak the numbers - add another fork() or two to create even more pipe waiters, and maybe change the final count exit value to match whatever hw performance you have. Linus