Re: [PATCH] pipe_read: don't wake up the writer if the pipe is still full

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

 



On 03/07, Hillf Danton wrote:
>
> On Thu, 6 Mar 2025 10:30:21 +0100 Oleg Nesterov <oleg@xxxxxxxxxx>
> > > >
> > > > Yes, but in this case pipe_full() == true is correct, this writer can
> > > > safely sleep.
> > > >
> > > No, because no reader is woken up before sleep to make pipe not full.
> >
> > Why the reader should be woken before this writer sleeps? Why the reader
> > should be woken at all in this case (when pipe is full again) ?
> >
> "to make pipe not full" failed to prevent you asking questions like this one.

Hmm. I don't understand your "prevent you asking questions" reply.

If the pipe was full we do not need to wake the reader(s), the reader
can only sleep if pipe_empty() == true.

> > We certainly can't understand each other.

Yes.

> step-00
> 	pipe->head = 36
> 	pipe->tail = 36
> 	after 3d252160b818
>
> step-01
> 	task-118762 writer
> 	pipe->head++;
> 	wakes up task-118740 and task-118768
>
> step-02
> 	task-118768 writer
> 	makes pipe full;
> 	sleeps without waking up any reader as
> 	pipe was not empty after step-01
>
> step-03
> 	task-118766 new reader
> 	makes pipe empty
> 	sleeps

but since the pipe was full, this reader should wake up the
writer task-118768 once it updates the tail the 1st time during
the read.

> step-04
> 	task-118740 reader
> 	sleeps as pipe is empty

this is fine.

> [ Tasks 118740 and 118768 can then indefinitely wait on each other. ]

118768 should be woken at step 3 ?

Oleg.





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux