Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1278928 > unrolled thread
| Started by | Peter Hurley <peter@hurleysoftware.com> |
|---|---|
| First post | 2015-11-27 20:20 +0100 |
| Last post | 2015-11-27 20:20 +0100 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v2 0/3] n_tty_read() helper cleanups Peter Hurley <peter@hurleysoftware.com> - 2015-11-27 20:20 +0100
[PATCH v2 3/3] n_tty: Reduce branching in canon_copy_from_read_buf() Peter Hurley <peter@hurleysoftware.com> - 2015-11-27 20:20 +0100
| From | Peter Hurley <peter@hurleysoftware.com> |
|---|---|
| Date | 2015-11-27 20:20 +0100 |
| Subject | [PATCH v2 0/3] n_tty_read() helper cleanups |
| Message-ID | <qzwIN-6VB-3@gated-at.bofh.it> |
Hi Greg, This series rebases a couple of already-sent patches on top of the EOF push bug fix, "n_tty: Fix poll() after buffer-limited eof push read", and adds a third to reduce branching (which hopefully clarifies the copy algorithm some). I will also resend the "Rework tty audit" series, which requires this series. Regards, Peter Hurley (3): n_tty: Uninline tty_copy_to_user() n_tty: Clarify copy_from_read_buf() n_tty: Reduce branching in canon_copy_from_read_buf() drivers/tty/n_tty.c | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Peter Hurley <peter@hurleysoftware.com> |
|---|---|
| Date | 2015-11-27 20:20 +0100 |
| Subject | [PATCH v2 3/3] n_tty: Reduce branching in canon_copy_from_read_buf() |
| Message-ID | <qzwIN-6VB-13@gated-at.bofh.it> |
| In reply to | #1278928 |
Instead of compare-and-set, just compute 'found'.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
drivers/tty/n_tty.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index eab606a..9b0b610 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -2079,10 +2079,9 @@ static int canon_copy_from_read_buf(struct tty_struct *tty,
if (eol == N_TTY_BUF_SIZE && more) {
/* scan wrapped without finding set bit */
eol = find_next_bit(ldata->read_flags, more, 0);
- if (eol != more)
- found = 1;
- } else if (eol != size)
- found = 1;
+ found = eol != more;
+ } else
+ found = eol != size;
n = eol - tail;
if (n > N_TTY_BUF_SIZE)
--
2.6.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web