netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yuval Mintz <Yuval.Mintz@qlogic.com>
To: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>,
	Lino Sanfilippo <LinoSanfilippo@gmx.de>
Cc: Ariel Elior <Ariel.Elior@qlogic.com>,
	netdev <netdev@vger.kernel.org>,
	"cascardo@linux.vnet.ibm.com" <cascardo@linux.vnet.ibm.com>,
	"cascardo@cascardo.eti.br" <cascardo@cascardo.eti.br>,
	"brking@linux.vnet.ibm.com" <brking@linux.vnet.ibm.com>
Subject: RE: [PATCH v2] bnx2x: Alloc 4k fragment for each rx ring buffer element
Date: Thu, 30 Apr 2015 11:25:31 +0000	[thread overview]
Message-ID: <B5657A6538887040AD3A81F1008BEC63D383CB@avmb3.qlogic.org> (raw)
In-Reply-To: <87383jhxj9.fsf@dhcp-9-18-235-171.br.ibm.com>

 The driver allocates one page for each buffer on the rx ring, which is too much
> on architectures like ppc64 and can cause unexpected allocation failures when
> the system is under stress.  Now, we keep a memory pool per queue, and if the
> architecture's PAGE_SIZE is greater than 4k, we fragment pages and assign each
> 4k segment to a ring element, which reduces the overall memory consumption
> on such architectures.  This helps avoiding errors like the example below:
> 
> [bnx2x_alloc_rx_sge:435(eth1)]Can't alloc sge [c00000037ffeb900]
> [d000000075eddeb4] .bnx2x_alloc_rx_sge+0x44/0x200 [bnx2x]
> [c00000037ffeb9b0] [d000000075ee0b34] .bnx2x_fill_frag_skb+0x1ac/0x460
> [bnx2x] [c00000037ffebac0] [d000000075ee11f0]
> .bnx2x_tpa_stop+0x160/0x2e8 [bnx2x] [c00000037ffebb90]
> [d000000075ee1560] .bnx2x_rx_int+0x1e8/0xc30 [bnx2x] [c00000037ffebcd0]
> [d000000075ee2084] .bnx2x_poll+0xdc/0x3d8 [bnx2x] (unreliable)
> 
> Signed-off-by: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
> ---
>  drivers/net/ethernet/broadcom/bnx2x/bnx2x.h     | 19 ++++++--
>  drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 61 +++++++++++++++++-
> -------  drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 33 +++++++++++--
>  3 files changed, 89 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
> b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
> index 4085c4b..d0c8ed0 100644
> --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
> +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
> @@ -356,6 +356,8 @@ struct sw_tx_bd {
> 
 ...
> +struct bnx2x_alloc_pool {
> +	struct page	*page;
> +	dma_addr_t	dma;
> +	int		len;

Isn't len always set to PAGE_SIZE? If so it can be dropped

> +	int		offset;
> +	int		last_offset;

Looks like you last_offset is used only for comparisons with offset;
Can we make it into a counter of possible allocations instead?

I.e., set it to (PAGE_SIZE / SGE_PAGE_SIZE - 1) during allocation
And decrement it each time an SGE_PAGE_SIZE chunk is taken.
That would turn (pool-> offset > pool->last_offset) into (!remain).
	

  reply	other threads:[~2015-04-30 11:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-24 20:45 [PATCH v2] bnx2x: Alloc 4k fragment for each rx ring buffer element Gabriel Krisman Bertazi
2015-04-24 23:24 ` Lino Sanfilippo
2015-04-29 13:30   ` Gabriel Krisman Bertazi
2015-04-30 11:25     ` Yuval Mintz [this message]
2015-04-30 20:05       ` David Miller
2015-05-04 19:32         ` [PATCH v3] " Gabriel Krisman Bertazi
2015-05-04 19:58           ` Yuval Mintz
2015-05-15 20:43             ` Gabriel Krisman Bertazi
2015-05-17  7:14               ` Yuval Mintz
2015-05-21 13:20             ` [PATCH v4] " Gabriel Krisman Bertazi
2015-05-23 10:04               ` Yuval Mintz
2015-05-23 11:14               ` Lino Sanfilippo
2015-05-27  8:59               ` Michal Schmidt
2015-05-27 16:51                 ` [PATCH] " Gabriel Krisman Bertazi
2015-06-01 22:57                   ` David Miller
2015-05-28  7:24                 ` [PATCH v4] " Yuval Mintz
2015-05-28 13:26                   ` Gabriel Krisman Bertazi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B5657A6538887040AD3A81F1008BEC63D383CB@avmb3.qlogic.org \
    --to=yuval.mintz@qlogic.com \
    --cc=Ariel.Elior@qlogic.com \
    --cc=LinoSanfilippo@gmx.de \
    --cc=brking@linux.vnet.ibm.com \
    --cc=cascardo@cascardo.eti.br \
    --cc=cascardo@linux.vnet.ibm.com \
    --cc=krisman@linux.vnet.ibm.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).