Subject: Re: [PATCH net-next 01/11] net/mlx4_en: Suppress page allocation failure warnings

From: Amir Vadai <[email-masked]>
Date: Sun, 23 Jun 2013 11:46:58 +0300

On 21/06/2013 00:28, Eric Dumazet wrote:
> On Thu, 2013-06-20 at 22:40 +0300, Amir Vadai wrote:
>> From: Yevgeny Petrilin <[email-masked]>
>>
>> When system is low on resources, those warnings hang the host.
>>
>> Signed-off-by: Yevgeny Petrilin <[email-masked]>
>> Signed-off-by: Jack Morgenstein <[email-masked]>
>> Signed-off-by: Amir Vadai <[email-masked]>
>> ---
>>  drivers/net/ethernet/mellanox/mlx4/en_rx.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
>> index 9c57581..2b564ac 100644
>> --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
>> +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
>> @@ -57,8 +57,8 @@ static int mlx4_en_alloc_frags(struct mlx4_en_priv *priv,
>>  	for (i = 0; i < priv->num_frags; i++) {
>>  		frag_info = &priv->frag_info[i];
>>  		if (ring_alloc[i].offset == frag_info->last_offset) {
>> -			page = alloc_pages(GFP_ATOMIC | __GFP_COMP,
>> -					MLX4_EN_ALLOC_ORDER);
>> +			page = alloc_pages(GFP_ATOMIC | __GFP_COMP |
>> +					   __GFP_NOWARN, MLX4_EN_ALLOC_ORDER);
>>  			if (!page)
>>  				goto out;
>>  			dma = dma_map_page(priv->ddev, page, 0,
> 
> 
> Thats IMHO a lazy patch...
> 
> What about mlx4_en_init_allocator() ?
mlx4_en_init_allocator() is called only on driver initialization - I
don't care if it will warn when no memory.
But mlx4_en_alloc_frags() is on the data path, and many warnings there
when the system is already stressed and without memory is bad.
Besides the warnings, this error flow is handled, and
mlx4_en_en_fill_rx_buffers() will handle the ENOMEM.

> 
> I think I did a patch doing fallback to order-1 and order-0 allocations
Current code has, as I said above, a fallback to reduce the rx ring size
when memory is stressed. Do you suggest to use smaller fragments instead
(or in addition)?
Can you send me a link to the patch?

Thanks,
Amir