]> git.pld-linux.org Git - packages/kernel.git/blobdiff - kernel-small_fixes.patch
- 3.18.26
[packages/kernel.git] / kernel-small_fixes.patch
index 9e8d667af8fd1ac135a5de5e8b54c341aedc6212..fb7f26f7a5db5bc63bc04fdda217ed0377669ae8 100644 (file)
                                exit
                        fi
                done
-From 29183a70b0b828500816bd794b3fe192fce89f73 Mon Sep 17 00:00:00 2001
-From: John Stultz <john.stultz@linaro.org>
-Date: Mon, 9 Feb 2015 23:30:36 -0800
-Subject: ntp: Fixup adjtimex freq validation on 32-bit systems
+From 30927520dbae297182990bb21d08762bcc35ce1d Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet@google.com>
+Date: Wed, 9 Sep 2015 21:55:07 -0700
+Subject: [PATCH] tcp_cubic: better follow cubic curve after idle period
 
-Additional validation of adjtimex freq values to avoid
-potential multiplication overflows were added in commit
-5e5aeb4367b (time: adjtimex: Validate the ADJ_FREQUENCY values)
+Jana Iyengar found an interesting issue on CUBIC :
 
-Unfortunately the patch used LONG_MAX/MIN instead of
-LLONG_MAX/MIN, which was fine on 64-bit systems, but being
-much smaller on 32-bit systems caused false positives
-resulting in most direct frequency adjustments to fail w/
-EINVAL.
+The epoch is only updated/reset initially and when experiencing losses.
+The delta "t" of now - epoch_start can be arbitrary large after app idle
+as well as the bic_target. Consequentially the slope (inverse of
+ca->cnt) would be really large, and eventually ca->cnt would be
+lower-bounded in the end to 2 to have delayed-ACK slow-start behavior.
 
-ntpd only does direct frequency adjustments at startup, so
-the issue was not as easily observed there, but other time
-sync applications like ptpd and chrony were more effected by
-the bug.
+This particularly shows up when slow_start_after_idle is disabled
+as a dangerous cwnd inflation (1.5 x RTT) after few seconds of idle
+time.
 
-See bugs:
+Jana initial fix was to reset epoch_start if app limited,
+but Neal pointed out it would ask the CUBIC algorithm to recalculate the
+curve so that we again start growing steeply upward from where cwnd is
+now (as CUBIC does just after a loss). Ideally we'd want the cwnd growth
+curve to be the same shape, just shifted later in time by the amount of
+the idle period.
 
-  https://bugzilla.kernel.org/show_bug.cgi?id=92481
-  https://bugzilla.redhat.com/show_bug.cgi?id=1188074
+Reported-by: Jana Iyengar <jri@google.com>
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Signed-off-by: Yuchung Cheng <ycheng@google.com>
+Signed-off-by: Neal Cardwell <ncardwell@google.com>
+Cc: Stephen Hemminger <stephen@networkplumber.org>
+Cc: Sangtae Ha <sangtae.ha@gmail.com>
+Cc: Lawrence Brakmo <lawrence@brakmo.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ net/ipv4/tcp_cubic.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
 
-This patch changes the checks to use LLONG_MAX for
-clarity, and additionally the checks are disabled
-on 32-bit systems since LLONG_MAX/PPM_SCALE is always
-larger then the 32-bit long freq value, so multiplication
-overflows aren't possible there.
-
-Reported-by: Josh Boyer <jwboyer@fedoraproject.org>
-Reported-by: George Joseph <george.joseph@fairview5.com>
-Tested-by: George Joseph <george.joseph@fairview5.com>
-Signed-off-by: John Stultz <john.stultz@linaro.org>
-Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
-Cc: <stable@vger.kernel.org> # v3.19+
-Cc: Linus Torvalds <torvalds@linux-foundation.org>
-Cc: Sasha Levin <sasha.levin@oracle.com>
-Link: http://lkml.kernel.org/r/1423553436-29747-1-git-send-email-john.stultz@linaro.org
-[ Prettified the changelog and the comments a bit. ]
-Signed-off-by: Ingo Molnar <mingo@kernel.org>
-
-diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
-index 4b585e0..0f60b08 100644
---- a/kernel/time/ntp.c
-+++ b/kernel/time/ntp.c
-@@ -633,10 +633,14 @@ int ntp_validate_timex(struct timex *txc)
-       if ((txc->modes & ADJ_SETOFFSET) && (!capable(CAP_SYS_TIME)))
-               return -EPERM;
+diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c
+index 28011fb1..c6ded6b 100644
+--- a/net/ipv4/tcp_cubic.c
++++ b/net/ipv4/tcp_cubic.c
+@@ -151,6 +151,21 @@ static void bictcp_init(struct sock *sk)
+               tcp_sk(sk)->snd_ssthresh = initial_ssthresh;
+ }
  
--      if (txc->modes & ADJ_FREQUENCY) {
--              if (LONG_MIN / PPM_SCALE > txc->freq)
-+      /*
-+       * Check for potential multiplication overflows that can
-+       * only happen on 64-bit systems:
-+       */
-+      if ((txc->modes & ADJ_FREQUENCY) && (BITS_PER_LONG == 64)) {
-+              if (LLONG_MIN / PPM_SCALE > txc->freq)
-                       return -EINVAL;
--              if (LONG_MAX / PPM_SCALE < txc->freq)
-+              if (LLONG_MAX / PPM_SCALE < txc->freq)
-                       return -EINVAL;
-       }
--- 
-cgit v0.10.2
-
++static void bictcp_cwnd_event(struct sock *sk, enum tcp_ca_event event)
++{
++      if (event == CA_EVENT_TX_START) {
++              s32 delta = tcp_time_stamp - tcp_sk(sk)->lsndtime;
++              struct bictcp *ca = inet_csk_ca(sk);
++
++              /* We were application limited (idle) for a while.
++               * Shift epoch_start to keep cwnd growth to cubic curve.
++               */
++              if (ca->epoch_start && delta > 0)
++                      ca->epoch_start += delta;
++              return;
++      }
++}
++
+ /* calculate the cubic root of x using a table lookup followed by one
+  * Newton-Raphson iteration.
+  * Avg err ~= 0.195%
+@@ -450,6 +465,7 @@ static struct tcp_congestion_ops cubictcp __read_mostly = {
+       .cong_avoid     = bictcp_cong_avoid,
+       .set_state      = bictcp_state,
+       .undo_cwnd      = bictcp_undo_cwnd,
++      .cwnd_event     = bictcp_cwnd_event,
+       .pkts_acked     = bictcp_acked,
+       .owner          = THIS_MODULE,
+       .name           = "cubic",
This page took 0.049605 seconds and 4 git commands to generate.