netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dimitris Michailidis <dm@chelsio.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 12/12] cxgb4: NUMA-aware Tx queue allocations
Date: Tue, 14 Dec 2010 14:51:00 -0800	[thread overview]
Message-ID: <4D07F4D4.5060809@chelsio.com> (raw)
In-Reply-To: <1292361479.2478.2.camel@edumazet-laptop>

Eric Dumazet wrote:
> Le mardi 14 décembre 2010 à 12:18 -0800, Dimitris Michailidis a écrit :
>> Allocate Tx queue memory on the node indicated by the new
>> netdev_queue_numa_node_read.  If that fails we allocate on any node.
>>
>> Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
>> ---
>>  drivers/net/cxgb4/sge.c |   20 +++++++++++++-------
>>  1 files changed, 13 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/net/cxgb4/sge.c b/drivers/net/cxgb4/sge.c
>> index cc0b997..ed98b8a 100644
>> --- a/drivers/net/cxgb4/sge.c
>> +++ b/drivers/net/cxgb4/sge.c
>> @@ -579,6 +579,7 @@ static inline void __refill_fl(struct adapter *adap, struct sge_fl *fl)
>>   *	@phys: the physical address of the allocated ring
>>   *	@metadata: address of the array holding the SW state for the ring
>>   *	@stat_size: extra space in HW ring for status information
>> + *	@node: preferred node for memory allocations
>>   *
>>   *	Allocates resources for an SGE descriptor ring, such as Tx queues,
>>   *	free buffer lists, or response queues.  Each SGE ring requires
>> @@ -590,7 +591,7 @@ static inline void __refill_fl(struct adapter *adap, struct sge_fl *fl)
>>   */
>>  static void *alloc_ring(struct device *dev, size_t nelem, size_t elem_size,
>>  			size_t sw_size, dma_addr_t *phys, void *metadata,
>> -			size_t stat_size)
>> +			size_t stat_size, int node)
>>  {
>>  	size_t len = nelem * elem_size + stat_size;
>>  	void *s = NULL;
>> @@ -599,7 +600,10 @@ static void *alloc_ring(struct device *dev, size_t nelem, size_t elem_size,
>>  	if (!p)
>>  		return NULL;
>>  	if (sw_size) {
>> -		s = kcalloc(nelem, sw_size, GFP_KERNEL);
>> +		if (node >= 0)
>> +			s = kzalloc_node(nelem * sw_size, GFP_KERNEL, node);
> 
> kzalloc_node() has a fallback, you dont need to retry with kcalloc()

I took this retry part from ixgbe but I can remove it if it's not needed. 
Luckily it's the last patch in the series.

> 
>> +		if (!s)
>> +			s = kcalloc(nelem, sw_size, GFP_KERNEL);
>>  
>>  		if (!s) {
>>  			dma_free_coherent(dev, len, p, *phys);
> 
> Also, I am not sure it is going to work, since we can setup XPS only
> after device being setup ?
> 
> By the time your driver allocates rings, we probably read
> -1/NUMA_NO_NODE

XPS is available after registration.  The queues are allocated at open time, 
if one configures XPS prior to that the allocations happen on the right 
nodes.  I've tried this and this is the behavior I see.  It is true that 
setting XPS after open doesn't affect the queue allocations.

  reply	other threads:[~2010-12-14 22:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-14 20:18 [PATCH 00/12 net-next] cxgb4 update Dimitris Michailidis
2010-12-14 20:18 ` [PATCH 01/12] cxgb4: enable PCIe relaxed ordering Dimitris Michailidis
2010-12-14 20:18   ` [PATCH 02/12] cxgb4: do not read the clock frequency from VPD Dimitris Michailidis
2010-12-14 20:18     ` [PATCH 03/12] cxgb4: set the number of queues before device registration Dimitris Michailidis
2010-12-14 20:18       ` [PATCH 04/12] cxgb4: distinguish between 1-lane KR/KX and 4-lane KR/KX/KX4 ports Dimitris Michailidis
2010-12-14 20:18         ` [PATCH 05/12] cxgb4: print port information after registering each netdev Dimitris Michailidis
2010-12-14 20:18           ` [PATCH 06/12] cxgb4: allocate more space for MSI-X interrupt names Dimitris Michailidis
2010-12-14 20:18             ` [PATCH 07/12] cxgb4: correct formatting of " Dimitris Michailidis
2010-12-14 20:18               ` [PATCH 08/12] cxgb4: remove the name field from the adapter structure Dimitris Michailidis
2010-12-14 20:18                 ` [PATCH 09/12] cxgb4: remove a bitmap Dimitris Michailidis
2010-12-14 20:18                   ` [PATCH 10/12] cxgb4: add const to static arrays Dimitris Michailidis
2010-12-14 20:18                     ` [PATCH 11/12] cxgb4: extend VPD parsing Dimitris Michailidis
2010-12-14 20:18                       ` [PATCH 12/12] cxgb4: NUMA-aware Tx queue allocations Dimitris Michailidis
2010-12-14 21:17                         ` Eric Dumazet
2010-12-14 22:51                           ` Dimitris Michailidis [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-12-15  7:36 [PATCH 00/12 net-next] cxgb4 update v2 Dimitris Michailidis
2010-12-15  7:36 ` [PATCH 01/12] cxgb4: enable PCIe relaxed ordering Dimitris Michailidis
2010-12-15  7:36   ` [PATCH 02/12] cxgb4: do not read the clock frequency from VPD Dimitris Michailidis
2010-12-15  7:36     ` [PATCH 03/12] cxgb4: set the number of queues before device registration Dimitris Michailidis
2010-12-15  7:36       ` [PATCH 04/12] cxgb4: distinguish between 1-lane KR/KX and 4-lane KR/KX/KX4 ports Dimitris Michailidis
2010-12-15  7:36         ` [PATCH 05/12] cxgb4: print port information after registering each netdev Dimitris Michailidis
2010-12-15  7:36           ` [PATCH 06/12] cxgb4: allocate more space for MSI-X interrupt names Dimitris Michailidis
2010-12-15  7:36             ` [PATCH 07/12] cxgb4: correct formatting of " Dimitris Michailidis
2010-12-15  7:36               ` [PATCH 08/12] cxgb4: remove the name field from the adapter structure Dimitris Michailidis
2010-12-15  7:36                 ` [PATCH 09/12] cxgb4: remove a bitmap Dimitris Michailidis
2010-12-15  7:36                   ` [PATCH 10/12] cxgb4: add const to static arrays Dimitris Michailidis
2010-12-15  7:36                     ` [PATCH 11/12] cxgb4: extend VPD parsing Dimitris Michailidis
2010-12-15  7:36                       ` [PATCH 12/12] cxgb4: NUMA-aware Tx queue allocations Dimitris Michailidis

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=4D07F4D4.5060809@chelsio.com \
    --to=dm@chelsio.com \
    --cc=eric.dumazet@gmail.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).