Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp52375pxb; Mon, 31 Jan 2022 15:01:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJzsI5sW4R5wWsNA+MeowGSXvvag6RdQrfI8FIkQnbPN3GkGGhJ8XXwRioDxokbW4QI8iiuD X-Received: by 2002:a17:902:7844:: with SMTP id e4mr23123348pln.154.1643670101231; Mon, 31 Jan 2022 15:01:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643670101; cv=none; d=google.com; s=arc-20160816; b=SxWOJASdMUr0/rCUcQ1ojWKjhFyue75eA638nSpkDSdn1Fz0YktgKH4b1vOBVIx3Ed A7C3lpv3r5Uks617nr54YOxo9E+TnNMjvajXngAEUANANp5J/nzoC2W/HfxW+tCG0bSo R2mGThaGwaVy+1d4sGhlAUoXW5+WHwCZSL3zx+PEvYXFq3Njp7tkaJzYvAoD/UxsPjfA 0Xz7gfZIST+NfZLKaP5TYX201emv4vK4L7cABwTvW6372tB1RbWeBErUfgFMNYm9YAWt jxZbEydxnxq5jgROQtD8YSo9IakxzGdAXcMOgyeu6Mn5i7HiXg6gGLzEaj1yvYZcu3Fz e9Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date; bh=7ccRXKRYZbfzj7qcX9s88k0MAYxflaHR0NRFUhE8mUw=; b=M5iBZiiUbqstHbOuuLv1ckjyMF0ol9vIq49Cyz2Yx9LDQisT3ev7StcaQWsSGyQjYA rpAJ9etd5YK6p5OeII/4RBfbvvzq1QiknB1879aZcqrgI9J+rWDsLj2v0UlZ039g+c/g EOKKaLbXm8FqLgc7CJEbghfc4zCcx+n3FqiLsykSttdAKnXi4x59a37I9C3XNvcADMyT cbysIdycV3jR0z59je/tSzTPtu6VYKbrVXjmN9S0YDetvDGkdjBiqoVAJ8OITKCaxGNn fWPiDcioeoCprYkIlWriNEqSX/XmjeeQkC0dKxlFbdIgssFc9BC5M+lL5/HpbKwD1Sg3 HraA== 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 x184si15004849pgb.676.2022.01.31.15.01.28; Mon, 31 Jan 2022 15:01:41 -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 S1352355AbiA2EYx (ORCPT + 99 others); Fri, 28 Jan 2022 23:24:53 -0500 Received: from out30-57.freemail.mail.aliyun.com ([115.124.30.57]:43941 "EHLO out30-57.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230242AbiA2EYv (ORCPT ); Fri, 28 Jan 2022 23:24:51 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=tonylu@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0V34nRnN_1643430287; Received: from localhost(mailfrom:tonylu@linux.alibaba.com fp:SMTPD_---0V34nRnN_1643430287) by smtp.aliyun-inc.com(127.0.0.1); Sat, 29 Jan 2022 12:24:48 +0800 Date: Sat, 29 Jan 2022 12:24:47 +0800 From: Tony Lu To: Guangguan Wang Cc: Stefan Raspl , kgraul@linux.ibm.com, linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kuba@kernel.org, davem@davemloft.net Subject: Re: [RFC PATCH net-next] net/smc: Introduce receive queue flow control support Message-ID: Reply-To: Tony Lu References: <20220120065140.5385-1-guangguan.wang@linux.alibaba.com> <1f13f001-e4d7-fdcd-6575-caa1be1526e1@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 29, 2022 at 11:43:22AM +0800, Guangguan Wang wrote: > > Yes, there are alternative ways, as RNR caused by the missmatch of send rate and receive rate, which means sending too fast > or receiving too slow. What I have done in this patch is to backpressure the sending side when sending too fast. > > Another solution is to process and refill the receive queue as quickly as posibble, which requires no protocol-level change. > The fllowing modifications are needed: > - Enqueue cdc msgs to backlog queues instead of processing in rx tasklet. llc msgs remain unchanged. It's a good idea to use backlog to free the work in softirq. Rx backlog can help move the heavy logic out of softirq, and let extra kthread or workqueue to handle it, then let kernel scheduler to deal with the balance between userspace process and kthread. There are two things to be careful, one for introducing more latency, this should trade off latency and throughput, the other for backlog full. > - A mempool is needed as cdc msgs are processed asynchronously. Allocate new receive buffers from mempool when refill receive queue. Yes, we need a elastically expanding RX buffer, also elastically shrinking. This looks like tcp_mem with tree elements to limit the memory usage. We also need to free memory automatically, based on memcg pressure is a good idea. > - Schedule backlog queues to other cpus, which are calculated by 4-tuple or 5-tuple hash of the connections, to process the cdc msgs, > in order to reduce the usage of the cpu where rx tasklet runs on. I am wondering if it is need for now. In general, it should spread the CPU usage to different cores. The memory usage or CPU usage which one will reach its limitation before trigger RNR. Maybe there should some data to support it? Thank you, Tony Lu