lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 20 Feb 2022 07:53:16 +0000
From:   Biju Das <biju.das.jz@...renesas.com>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        Sergey Shtylyov <s.shtylyov@....ru>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-renesas-soc@...r.kernel.org" 
        <linux-renesas-soc@...r.kernel.org>
Subject: RE: [PATCH] ravb: Use GFP_KERNEL instead of GFP_ATOMIC when possible

Hi Christophe,

Thanks for the patch.

Just a  question, As per [1], former can be allocated from interrupt context.
But nothing mentioned for the allocation using the patch you mentioned[2]. I agree GFP_KERNEL
gives more opportunities of successful allocation.

Q1) Here it allocates 8K instead of 1K on each loop, Is there any limitation for netdev_alloc_skb for allocating 8K size?
Q2) In terms of allocation performance which is better netdev_alloc_skb or __netdev_alloc_skb?

[1] https://www.kernel.org/doc/htmldocs/networking/API-netdev-alloc-skb.html
[2] https://www.kernel.org/doc/htmldocs/networking/API---netdev-alloc-skb.html

Regards,
Biju

> Subject: [PATCH] ravb: Use GFP_KERNEL instead of GFP_ATOMIC when possible
> 
> 'max_rx_len' can be up to GBETH_RX_BUFF_MAX (i.e. 8192) (see
> 'gbeth_hw_info').
> The default value of 'num_rx_ring' can be BE_RX_RING_SIZE (i.e. 1024).
> 
> So this loop can allocate 8 Mo of memory.
> 
> Previous memory allocations in this function already use GFP_KERNEL, so
> use __netdev_alloc_skb() and an explicit GFP_KERNEL instead of a implicit
> GFP_ATOMIC.
> 
> This gives more opportunities of successful allocation.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---
>  drivers/net/ethernet/renesas/ravb_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c
> b/drivers/net/ethernet/renesas/ravb_main.c
> index 24e2635c4c80..525d66f71f02 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -475,7 +475,7 @@ static int ravb_ring_init(struct net_device *ndev, int
> q)
>  		goto error;
> 
>  	for (i = 0; i < priv->num_rx_ring[q]; i++) {
> -		skb = netdev_alloc_skb(ndev, info->max_rx_len);
> +		skb = __netdev_alloc_skb(ndev, info->max_rx_len, GFP_KERNEL);
>  		if (!skb)
>  			goto error;
>  		ravb_set_buffer_align(skb);
> --
> 2.32.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ