Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1244337pxb; Fri, 21 Jan 2022 13:12:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJyETRieD2F+9vz4HAq+oo4uC9NwKLz2OHvGmy4MT5FUmrre/JGcqWassW1flaj30F19h8RS X-Received: by 2002:a17:902:c411:b0:14a:8f71:1f34 with SMTP id k17-20020a170902c41100b0014a8f711f34mr5813087plk.120.1642799577131; Fri, 21 Jan 2022 13:12:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642799577; cv=none; d=google.com; s=arc-20160816; b=CFo9QTeHNSwlGG1Dz+gNclOxQTe0K9xKCCcNNL7ppI/2wqaP7s3aNsv2vNVFYuFInt Jt2FrzcuAhXgy2B81p82OEF8BU7T1Mw2Jh8PP41gYvPVsbn9DZA4sHXPmxNr1lnKLgb6 iKCmx9DYoltopUjWlkGQE2fM7WteFp5FkJdz6xPpaGQmJymLEctQKZ0kM1IdpbFcSTbA KSPhdSDkEl70NbuWxKR8LIEJVK0/L+QjHyFtje9C1/FHcKPpNMWBqiCO/K2RAHBkJjRD A4moBpJ8VMrDw0FKISoN7eNOYQwfPfLPp/Ut7POHtmqKJSdqvArsEULRJjKJuuUj8o2S wF2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=aGBOcxrtOHUjdbEWaKnE/U/jWvdMedWdxCccyD+8qGs=; b=hXyVT3FQ61pn5DeeGY9xLYhLRLjm7Twfk29BecWUZ0GdU3MQnbNES9kfVz13QghJnj FknnIbPa1UULeTvpNqc3se99iWTSQY92UTFWze/gCNwG1yG8rrjxGYp066zkjed+NW7X ccZvAz24mcXmxK9HL+pSBGYZM4Zak6uDlAAiCmI/pfdqkDyDdp9KlRX9vYg1OFqsLTVC 8Aq9N+CK9wmcyHhcHNWvt4UkGk/BWchsU10wmpeCOkfgZDOifaFs/886Nv8rmejbNG3i 3Rit8CA7QlBwDREWc2u/e+Rq8DkVd2ROqcwXu+nP7lZv0OB9rrJiVd4zQGZzF+DH/vLp C2ZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u8si8445778ple.560.2022.01.21.13.12.44; Fri, 21 Jan 2022 13:12:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241621AbiATJUH (ORCPT + 99 others); Thu, 20 Jan 2022 04:20:07 -0500 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:48449 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239702AbiATJUF (ORCPT ); Thu, 20 Jan 2022 04:20:05 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01424;MF=guangguan.wang@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0V2Lw44Q_1642670401; Received: from 30.43.104.217(mailfrom:guangguan.wang@linux.alibaba.com fp:SMTPD_---0V2Lw44Q_1642670401) by smtp.aliyun-inc.com(127.0.0.1); Thu, 20 Jan 2022 17:20:02 +0800 Message-ID: <220be582-a2c2-bc3c-ce6b-0eda2a297ba1@linux.alibaba.com> Date: Thu, 20 Jan 2022 17:20:01 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [RFC PATCH net-next] net/smc: Introduce receive queue flow control support Content-Language: en-US To: Leon Romanovsky Cc: kgraul@linux.ibm.com, davem@davemloft.net, kuba@kernel.org, linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220120065140.5385-1-guangguan.wang@linux.alibaba.com> From: Guangguan Wang In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/1/20 16:24, Leon Romanovsky wrote: > On Thu, Jan 20, 2022 at 02:51:40PM +0800, Guangguan Wang wrote: >> This implement rq flow control in smc-r link layer. QPs >> communicating without rq flow control, in the previous >> version, may result in RNR (reveive not ready) error, which >> means when sq sends a message to the remote qp, but the >> remote qp's rq has no valid rq entities to receive the message. >> In RNR condition, the rdma transport layer may retransmit >> the messages again and again until the rq has any entities, >> which may lower the performance, especially in heavy traffic. >> Using credits to do rq flow control can avoid the occurrence >> of RNR. >> >> Test environment: >> - CPU Intel Xeon Platinum 8 core, mem 32 GiB, nic Mellanox CX4. >> - redis benchmark 6.2.3 and redis server 6.2.3. >> - redis server: redis-server --save "" --appendonly no >> --protected-mode no --io-threads 7 --io-threads-do-reads yes >> - redis client: redis-benchmark -h 192.168.26.36 -q -t set,get >> -P 1 --threads 7 -n 2000000 -c 200 -d 10 >> >> Before: >> SET: 205229.23 requests per second, p50=0.799 msec >> GET: 212278.16 requests per second, p50=0.751 msec >> >> After: >> SET: 623674.69 requests per second, p50=0.303 msec >> GET: 688326.00 requests per second, p50=0.271 msec >> >> The test of redis-benchmark shows that more than 3X rps >> improvement after the implementation of rq flow control. >> >> Signed-off-by: Guangguan Wang >> --- >> net/smc/af_smc.c | 12 ++++++ >> net/smc/smc_cdc.c | 10 ++++- >> net/smc/smc_cdc.h | 3 +- >> net/smc/smc_clc.c | 3 ++ >> net/smc/smc_clc.h | 3 +- >> net/smc/smc_core.h | 17 ++++++++- >> net/smc/smc_ib.c | 6 ++- >> net/smc/smc_llc.c | 92 +++++++++++++++++++++++++++++++++++++++++++++- >> net/smc/smc_llc.h | 5 +++ >> net/smc/smc_wr.c | 30 ++++++++++++--- >> net/smc/smc_wr.h | 54 ++++++++++++++++++++++++++- >> 11 files changed, 222 insertions(+), 13 deletions(-) > > <...> > >> + // set peer rq credits watermark, if less than init_credits * 2/3, >> + // then credit announcement is needed. > > <...> > >> + // set peer rq credits watermark, if less than init_credits * 2/3, >> + // then credit announcement is needed. > > <...> > >> + // credits have already been announced to peer > > <...> > >> + // set local rq credits high watermark to lnk->wr_rx_cnt / 3, >> + // if local rq credits more than high watermark, announcement is needed. > > <...> > >> +// get one tx credit, and peer rq credits dec > > <...> > >> +// put tx credits, when some failures occurred after tx credits got >> +// or receive announce credits msgs >> +static inline void smc_wr_tx_put_credits(struct smc_link *link, int credits, bool wakeup) > > <...> > >> +// to check whether peer rq credits is lower than watermark. >> +static inline int smc_wr_tx_credits_need_announce(struct smc_link *link) > > <...> > >> +// get local rq credits and set credits to zero. >> +// may called when announcing credits >> +static inline int smc_wr_rx_get_credits(struct smc_link *link) > > Please try to use C-style comments. > > Thanks Thanks for your advice, I will modify it in the next version of patch.