All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] mlx4: reduce OOM risk on arches with large pages
@ 2017-02-18 18:34 Eric Dumazet
  2017-02-20  8:44 ` Tariq Toukan
  2017-02-20 15:32 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2017-02-18 18:34 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Tariq Toukan, Saeed Mahameed

From: Eric Dumazet <edumazet@google.com>

Since mlx4 NIC are used on PowerPC with 64K pages, we need to adapt
MLX4_EN_ALLOC_PREFER_ORDER definition.

Otherwise, a fragment sitting in an out of order TCP queue can hold
0.5 Mbytes and it is a serious OOM risk.

Fixes: 51151a16a60f ("mlx4: allow order-0 memory allocations in RX path")
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 drivers/net/ethernet/mellanox/mlx4/mlx4_en.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index cec59bc264c9ac197048fd7c98bcd5cf25de0efd..0f6d2f3b7d54f51de359d4ccde21f4585e6b7852 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -102,7 +102,8 @@
 /* Use the maximum between 16384 and a single page */
 #define MLX4_EN_ALLOC_SIZE	PAGE_ALIGN(16384)
 
-#define MLX4_EN_ALLOC_PREFER_ORDER	PAGE_ALLOC_COSTLY_ORDER
+#define MLX4_EN_ALLOC_PREFER_ORDER min_t(int, get_order(32768),		\
+					 PAGE_ALLOC_COSTLY_ORDER)
 
 /* Receive fragment sizes; we use at most 3 fragments (for 9600 byte MTU
  * and 4K allocations) */

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] mlx4: reduce OOM risk on arches with large pages
  2017-02-18 18:34 [PATCH net] mlx4: reduce OOM risk on arches with large pages Eric Dumazet
@ 2017-02-20  8:44 ` Tariq Toukan
  2017-02-20 15:32 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Tariq Toukan @ 2017-02-20  8:44 UTC (permalink / raw)
  To: Eric Dumazet, David Miller; +Cc: netdev, Tariq Toukan, Saeed Mahameed



On 18/02/2017 8:34 PM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> Since mlx4 NIC are used on PowerPC with 64K pages, we need to adapt
> MLX4_EN_ALLOC_PREFER_ORDER definition.
>
> Otherwise, a fragment sitting in an out of order TCP queue can hold
> 0.5 Mbytes and it is a serious OOM risk.
>
> Fixes: 51151a16a60f ("mlx4: allow order-0 memory allocations in RX path")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
>  drivers/net/ethernet/mellanox/mlx4/mlx4_en.h |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
> index cec59bc264c9ac197048fd7c98bcd5cf25de0efd..0f6d2f3b7d54f51de359d4ccde21f4585e6b7852 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
> +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
> @@ -102,7 +102,8 @@
>  /* Use the maximum between 16384 and a single page */
>  #define MLX4_EN_ALLOC_SIZE	PAGE_ALIGN(16384)
>
> -#define MLX4_EN_ALLOC_PREFER_ORDER	PAGE_ALLOC_COSTLY_ORDER
> +#define MLX4_EN_ALLOC_PREFER_ORDER min_t(int, get_order(32768),		\
> +					 PAGE_ALLOC_COSTLY_ORDER)
>
>  /* Receive fragment sizes; we use at most 3 fragments (for 9600 byte MTU
>   * and 4K allocations) */
>
>

Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Thanks Eric!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] mlx4: reduce OOM risk on arches with large pages
  2017-02-18 18:34 [PATCH net] mlx4: reduce OOM risk on arches with large pages Eric Dumazet
  2017-02-20  8:44 ` Tariq Toukan
@ 2017-02-20 15:32 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-02-20 15:32 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, tariqt, saeedm

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sat, 18 Feb 2017 10:34:18 -0800

> From: Eric Dumazet <edumazet@google.com>
> 
> Since mlx4 NIC are used on PowerPC with 64K pages, we need to adapt
> MLX4_EN_ALLOC_PREFER_ORDER definition.
> 
> Otherwise, a fragment sitting in an out of order TCP queue can hold
> 0.5 Mbytes and it is a serious OOM risk.
> 
> Fixes: 51151a16a60f ("mlx4: allow order-0 memory allocations in RX path")
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-20 15:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-18 18:34 [PATCH net] mlx4: reduce OOM risk on arches with large pages Eric Dumazet
2017-02-20  8:44 ` Tariq Toukan
2017-02-20 15:32 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.