0005-sync-WRITE_BUFFER_SIZE-with-glibc-test.patch 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. From 642cf06b4c07658b78fb6029648edc14fcd0075a Mon Sep 17 00:00:00 2001
  2. From: Waldemar Brodkorb <wbx@openadk.org>
  3. Date: Wed, 20 Aug 2014 20:29:08 +0200
  4. Subject: [PATCH 05/11] sync WRITE_BUFFER_SIZE with glibc test
  5. Test on Linux 3.16.1 in Qemu ARM fails with:
  6. TEST_EXEC nptl/ tst-cancel4
  7. ret == 1 ; expected_ret == 0
  8. make[1]: *** [tst-cancel4.exe] Error 1
  9. The output of failed test is:
  10. minimum write buffer size too large
  11. ../Test.mak:89: recipe for target 'tst-cancel4.exe' failed
  12. Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
  13. ---
  14. test/nptl/tst-cancel4.c | 26 ++++++++++++++++++++++++--
  15. 1 file changed, 24 insertions(+), 2 deletions(-)
  16. diff --git a/test/nptl/tst-cancel4.c b/test/nptl/tst-cancel4.c
  17. index e711958..53abf83 100644
  18. --- a/test/nptl/tst-cancel4.c
  19. +++ b/test/nptl/tst-cancel4.c
  20. @@ -83,7 +83,30 @@ static pthread_barrier_t b2;
  21. # define IPC_ADDVAL 0
  22. #endif
  23. -#define WRITE_BUFFER_SIZE 4096
  24. +/* The WRITE_BUFFER_SIZE value needs to be chosen such that if we set
  25. + the socket send buffer size to '1', a write of this size on that
  26. + socket will block.
  27. +
  28. + The Linux kernel imposes a minimum send socket buffer size which
  29. + has changed over the years. As of Linux 3.10 the value is:
  30. +
  31. + 2 * (2048 + SKB_DATA_ALIGN(sizeof(struct sk_buff)))
  32. +
  33. + which is attempting to make sure that with standard MTUs,
  34. + TCP can always queue up at least 2 full sized packets.
  35. +
  36. + Furthermore, there is logic in the socket send paths that
  37. + will allow one more packet (of any size) to be queued up as
  38. + long as some socket buffer space remains. Blocking only
  39. + occurs when we try to queue up a new packet and the send
  40. + buffer space has already been fully consumed.
  41. +
  42. + Therefore we must set this value to the largest possible value of
  43. + the formula above (and since it depends upon the size of "struct
  44. + sk_buff", it is dependent upon machine word size etc.) plus some
  45. + slack space. */
  46. +
  47. +#define WRITE_BUFFER_SIZE 16384
  48. /* Cleanup handling test. */
  49. static int cl_called;
  50. @@ -758,7 +781,6 @@ tf_sigpause (void *arg)
  51. pthread_cleanup_push (cl, NULL);
  52. - /* Just for fun block the cancellation signal. */
  53. sigpause (SIGCANCEL);
  54. pthread_cleanup_pop (0);
  55. --
  56. 1.8.5.2 (Apple Git-48)