This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Increase nptl test case buffer size so we really block on current Linux kernels.
- From: Andreas Jaeger <aj at suse dot com>
- To: David Miller <davem at davemloft dot net>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 23 Jul 2013 11:13:34 +0200
- Subject: Re: [PATCH] Increase nptl test case buffer size so we really block on current Linux kernels.
- References: <20130722 dot 164636 dot 1013443019526329969 dot davem at davemloft dot net> <51EE0C7E dot 6080900 at suse dot com> <20130723 dot 014005 dot 1541876791321530107 dot davem at davemloft dot net>
On 07/23/2013 10:40 AM, David Miller wrote:
> From: Andreas Jaeger <aj@suse.com>
> Date: Tue, 23 Jul 2013 06:54:22 +0200
>
>> Since this hit us, could you document the reason for the buffer size?
>
> Sure, how does this look?
Fine to me, thanks,
Andreas
> --------------------
> Increase nptl test case buffer size so we really block on current Linux kernels.
>
> * tst-cancel4.c (WRITE_BUFFER_SIZE): Increase to 16384.
>
> diff --git a/nptl/ChangeLog b/nptl/ChangeLog
> index fc2ef41..0e4747e 100644
> --- a/nptl/ChangeLog
> +++ b/nptl/ChangeLog
> @@ -1,3 +1,7 @@
> +2013-07-22 David S. Miller <davem@davemloft.net>
> +
> + * tst-cancel4.c (WRITE_BUFFER_SIZE): Increase to 16384.
> +
> 2013-07-19 Dominik Vogt <vogt@de.ibm.com>
>
> * pthread_mutex_lock.c: Fix whitespace.
> diff --git a/nptl/tst-cancel4.c b/nptl/tst-cancel4.c
> index 9ffd5d1..10b7c6e 100644
> --- a/nptl/tst-cancel4.c
> +++ b/nptl/tst-cancel4.c
> @@ -83,7 +83,30 @@ static pthread_barrier_t b2;
> # define IPC_ADDVAL 0
> #endif
>
> -#define WRITE_BUFFER_SIZE 4096
> +/* The WRITE_BUFFER_SIZE value needs to be choosen such that if we set
> + the socket send buffer size to '1', a write of this size on that
> + socket will block.
> +
> + The Linux kernel imposes a minimum send socket buffer size
> + which has changed over the years. Currently the value is:
> +
> + 2 * (2048 + SKB_DATA_ALIGN(sizeof(struct sk_buff)))
> +
> + which is attempting to make sure that with standard MTUs,
> + TCP can always queue up at least 2 full sized packets.
> +
> + Furthermore, there is logic in the socket send paths that
> + will allow one more packet (of any size) to be queued up as
> + long as some socket buffer space remains. Blocking only
> + occurs when we try to queue up a new packet and the send
> + buffer space has already been fully consumed.
> +
> + Therefore we must set this value to the largest possible value of
> + the formula above (and since it depends upon the size of "struct
> + sk_buff", it is dependent upon machine word size etc.) plus some
> + slack space. */
> +
> +#define WRITE_BUFFER_SIZE 16384
>
> /* Cleanup handling test. */
> static int cl_called;
>
--
Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126