From patchwork Wed Oct 28 15:01:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shradha Shah X-Patchwork-Id: 537397 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A7CF21402B9 for ; Thu, 29 Oct 2015 02:02:00 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752902AbbJ1PB4 (ORCPT ); Wed, 28 Oct 2015 11:01:56 -0400 Received: from nbfkord-smmo03.seg.att.com ([209.65.160.84]:58839 "EHLO nbfkord-smmo03.seg.att.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751280AbbJ1PBz (ORCPT ); Wed, 28 Oct 2015 11:01:55 -0400 Received: from unknown [12.187.104.26] (EHLO webmail.solarflare.com) by nbfkord-smmo03.seg.att.com(mxl_mta-7.2.4-5) with ESMTP id 363e0365.2acf79a28940.1350782.00-2446.3028696.nbfkord-smmo03.seg.att.com (envelope-from ); Wed, 28 Oct 2015 15:01:55 +0000 (UTC) X-MXL-Hash: 5630e36317b7a666-24de0bcc266bd6d730859950682872761ef1a88e Received: from unknown [12.187.104.26] (EHLO webmail.solarflare.com) by nbfkord-smmo03.seg.att.com(mxl_mta-7.2.4-5) over TLS secured channel with ESMTP id f53e0365.0.1350765.00-2368.3028642.nbfkord-smmo03.seg.att.com (envelope-from ); Wed, 28 Oct 2015 15:01:52 +0000 (UTC) X-MXL-Hash: 5630e3601f143a54-dfa232013571df72c0c03f257bf44196bdcc8d63 Received: from sshah-desktop.uk.level5networks.com (10.17.20.135) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Wed, 28 Oct 2015 08:01:44 -0700 From: Shradha Shah Subject: [PATCH net-next 2/4] sfc: allocate rx pages on the same node as the interrupt To: David Miller References: <5630E2FD.3070609@solarflare.com> CC: , Message-ID: <5630E356.60109@solarflare.com> Date: Wed, 28 Oct 2015 15:01:42 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <5630E2FD.3070609@solarflare.com> X-Originating-IP: [10.17.20.135] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ocex03.SolarFlarecom.com (10.20.40.36) X-AnalysisOut: [v=2.0 cv=HIR04PRv c=1 sm=1 a=8BlWFWvVlq5taO8ncb8nKg==:17 a] X-AnalysisOut: [=zRKbQ67AAAAA:8 a=3VnyBeAh6Z0A:10 a=5lJygRwiOn0A:10 a=8pDO] X-AnalysisOut: [QgrLn04HWaHHTsIA:9 a=pILNOxqGKmIA:10] X-Spam: [F=0.3860281871; CM=0.500; S=0.386(2015072901)] X-MAIL-FROM: X-SOURCE-IP: [12.187.104.26] Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Daniel Pieczko When the interrupt servicing a channel is on a NUMA node that is not local to the device, performance is improved by allocating rx pages on the node local to the interrupt (remote to the device) The performance-optimal case, where interrupts and applications are pinned to CPUs on the same node as the device, is not altered by this change. This change gave a 1% improvement in transaction rate using Nginx with all interrupts and Nginx threads on the node remote to the device. It also gave a small reduction in round-trip latency, again with the interrupt and application on a different node to the device. Allocating rx pages based on the channel->irq_node value is only valid for the initial driver-load interrupt affinities; if an interrupt is moved later, the wrong node may be used for the allocation. Signed-off-by: Shradha Shah --- drivers/net/ethernet/sfc/efx.c | 1 + drivers/net/ethernet/sfc/net_driver.h | 3 +++ drivers/net/ethernet/sfc/rx.c | 14 +++++++++----- 3 files changed, 13 insertions(+), 5 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index 974637d..89fbd03 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c @@ -445,6 +445,7 @@ efx_alloc_channel(struct efx_nic *efx, int i, struct efx_channel *old_channel) channel->efx = efx; channel->channel = i; channel->type = &efx_default_channel_type; + channel->irq_node = NUMA_NO_NODE; for (j = 0; j < EFX_TXQ_TYPES; j++) { tx_queue = &channel->tx_queue[j]; diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index ad56231..0ab9080a 100644 --- a/drivers/net/ethernet/sfc/net_driver.h +++ b/drivers/net/ethernet/sfc/net_driver.h @@ -419,6 +419,7 @@ enum efx_sync_events_state { * @sync_events_state: Current state of sync events on this channel * @sync_timestamp_major: Major part of the last ptp sync event * @sync_timestamp_minor: Minor part of the last ptp sync event + * @irq_node: NUMA node of interrupt */ struct efx_channel { struct efx_nic *efx; @@ -477,6 +478,8 @@ struct efx_channel { enum efx_sync_events_state sync_events_state; u32 sync_timestamp_major; u32 sync_timestamp_minor; + + int irq_node; }; #ifdef CONFIG_NET_RX_BUSY_POLL diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c index 3f0e129..c5ef1e8 100644 --- a/drivers/net/ethernet/sfc/rx.c +++ b/drivers/net/ethernet/sfc/rx.c @@ -168,11 +168,15 @@ static int efx_init_rx_buffers(struct efx_rx_queue *rx_queue, bool atomic) * context in such a case. So, use __GFP_NO_WARN * in case of atomic. */ - page = alloc_pages(__GFP_COLD | __GFP_COMP | - (atomic ? - (GFP_ATOMIC | __GFP_NOWARN) - : GFP_KERNEL), - efx->rx_buffer_order); + struct efx_channel *channel; + + channel = efx_rx_queue_channel(rx_queue); + page = alloc_pages_node(channel->irq_node, __GFP_COMP | + (atomic ? + (GFP_ATOMIC | __GFP_NOWARN) + : GFP_KERNEL), + efx->rx_buffer_order); + if (unlikely(page == NULL)) return -ENOMEM; dma_addr =