Merge branch 'android12-5.10' into android12-5.10-lts
Sync up with android12-5.10 for the following commits:3de34cc5ea
UPSTREAM: pipe: make pipe writes always wake up readers6b7e007164
ANDROID: Revert "ANDROID: fs: pipe: wakeup readers on small writes even if pipe had data"dac8af7144
ANDROID: GKI: Enable CONFIG_USB_EHCI_ROOT_HUB_TT Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I220ff2999b3aa0b066e84de25da8e2307bb31685
This commit is contained in:
@@ -469,6 +469,7 @@ CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
|
|||||||
CONFIG_USB_OTG=y
|
CONFIG_USB_OTG=y
|
||||||
CONFIG_USB_XHCI_HCD=y
|
CONFIG_USB_XHCI_HCD=y
|
||||||
CONFIG_USB_EHCI_HCD=y
|
CONFIG_USB_EHCI_HCD=y
|
||||||
|
CONFIG_USB_EHCI_ROOT_HUB_TT=y
|
||||||
CONFIG_USB_EHCI_HCD_PLATFORM=y
|
CONFIG_USB_EHCI_HCD_PLATFORM=y
|
||||||
CONFIG_USB_ACM=y
|
CONFIG_USB_ACM=y
|
||||||
CONFIG_USB_STORAGE=y
|
CONFIG_USB_STORAGE=y
|
||||||
|
@@ -421,6 +421,7 @@ CONFIG_USB_HIDDEV=y
|
|||||||
CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
|
CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
|
||||||
CONFIG_USB_XHCI_HCD=y
|
CONFIG_USB_XHCI_HCD=y
|
||||||
CONFIG_USB_EHCI_HCD=y
|
CONFIG_USB_EHCI_HCD=y
|
||||||
|
CONFIG_USB_EHCI_ROOT_HUB_TT=y
|
||||||
CONFIG_USB_EHCI_HCD_PLATFORM=y
|
CONFIG_USB_EHCI_HCD_PLATFORM=y
|
||||||
CONFIG_USB_ACM=y
|
CONFIG_USB_ACM=y
|
||||||
CONFIG_USB_STORAGE=y
|
CONFIG_USB_STORAGE=y
|
||||||
|
19
fs/pipe.c
19
fs/pipe.c
@@ -406,7 +406,7 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)
|
|||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
size_t total_len = iov_iter_count(from);
|
size_t total_len = iov_iter_count(from);
|
||||||
ssize_t chars;
|
ssize_t chars;
|
||||||
bool do_wakeup = false;
|
bool was_empty = false;
|
||||||
bool wake_next_writer = false;
|
bool wake_next_writer = false;
|
||||||
|
|
||||||
/* Null write succeeds. */
|
/* Null write succeeds. */
|
||||||
@@ -429,18 +429,18 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Wake up readers if the pipe was written to. Regardless
|
* Epoll nonsensically wants a wakeup whether the pipe
|
||||||
* of whether it was empty or not. Otherwise, threads
|
* was already empty or not.
|
||||||
* waiting with EPOLLET will hang until the pipe is emptied.
|
|
||||||
*
|
*
|
||||||
* If pipe wasn't empty we try to merge new data into
|
* If it wasn't empty we try to merge new data into
|
||||||
* the last buffer.
|
* the last buffer.
|
||||||
*
|
*
|
||||||
* That naturally merges small writes, but it also
|
* That naturally merges small writes, but it also
|
||||||
* page-aligs the rest of the writes for large writes
|
* page-aligns the rest of the writes for large writes
|
||||||
* spanning multiple pages.
|
* spanning multiple pages.
|
||||||
*/
|
*/
|
||||||
head = pipe->head;
|
head = pipe->head;
|
||||||
|
was_empty = true;
|
||||||
chars = total_len & (PAGE_SIZE-1);
|
chars = total_len & (PAGE_SIZE-1);
|
||||||
if (chars && !pipe_empty(head, pipe->tail)) {
|
if (chars && !pipe_empty(head, pipe->tail)) {
|
||||||
unsigned int mask = pipe->ring_size - 1;
|
unsigned int mask = pipe->ring_size - 1;
|
||||||
@@ -460,7 +460,6 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)
|
|||||||
}
|
}
|
||||||
|
|
||||||
buf->len += ret;
|
buf->len += ret;
|
||||||
do_wakeup = true;
|
|
||||||
if (!iov_iter_count(from))
|
if (!iov_iter_count(from))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@@ -527,7 +526,6 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)
|
|||||||
ret += copied;
|
ret += copied;
|
||||||
buf->offset = 0;
|
buf->offset = 0;
|
||||||
buf->len = copied;
|
buf->len = copied;
|
||||||
do_wakeup = true;
|
|
||||||
|
|
||||||
if (!iov_iter_count(from))
|
if (!iov_iter_count(from))
|
||||||
break;
|
break;
|
||||||
@@ -555,12 +553,13 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)
|
|||||||
* become empty while we dropped the lock.
|
* become empty while we dropped the lock.
|
||||||
*/
|
*/
|
||||||
__pipe_unlock(pipe);
|
__pipe_unlock(pipe);
|
||||||
if (do_wakeup) {
|
if (was_empty) {
|
||||||
wake_up_interruptible_sync_poll(&pipe->rd_wait, EPOLLIN | EPOLLRDNORM);
|
wake_up_interruptible_sync_poll(&pipe->rd_wait, EPOLLIN | EPOLLRDNORM);
|
||||||
kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
|
kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
|
||||||
}
|
}
|
||||||
wait_event_interruptible_exclusive(pipe->wr_wait, pipe_writable(pipe));
|
wait_event_interruptible_exclusive(pipe->wr_wait, pipe_writable(pipe));
|
||||||
__pipe_lock(pipe);
|
__pipe_lock(pipe);
|
||||||
|
was_empty = pipe_empty(pipe->head, pipe->tail);
|
||||||
wake_next_writer = true;
|
wake_next_writer = true;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
@@ -577,7 +576,7 @@ out:
|
|||||||
* how (for example) the GNU make jobserver uses small writes to
|
* how (for example) the GNU make jobserver uses small writes to
|
||||||
* wake up pending jobs
|
* wake up pending jobs
|
||||||
*/
|
*/
|
||||||
if (do_wakeup) {
|
if (was_empty) {
|
||||||
wake_up_interruptible_sync_poll(&pipe->rd_wait, EPOLLIN | EPOLLRDNORM);
|
wake_up_interruptible_sync_poll(&pipe->rd_wait, EPOLLIN | EPOLLRDNORM);
|
||||||
kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
|
kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user