Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6657995rwr; Tue, 25 Apr 2023 01:33:07 -0700 (PDT) X-Google-Smtp-Source: AKy350asBDtXHjFycjMek4cMwbe/R7laFoihmzkjyrwHoc8RlFT+QBkrbOHiHw2hXAPb4KNaF8hD X-Received: by 2002:a17:903:11c7:b0:1a6:5332:25b with SMTP id q7-20020a17090311c700b001a65332025bmr20491402plh.42.1682411587053; Tue, 25 Apr 2023 01:33:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682411587; cv=none; d=google.com; s=arc-20160816; b=jQuCs/D3dv4rXniDg8ehx6A9R6XCtuYpZNf96PW+x7B6fSVKi7vRH5omvygpN4x30n qa0vceSJo+7mV28idjGFJpXuuVzHH0tifTpGMZ8fMfzOCLEId+XoU0zBOBVF+skLcwbB MeLjNhphNNNnWuSw9dZdykohO1UxPUbHYuw+aM8tbInEQuI5OI3HCF0OiU2KqsvgWwO1 gzvjoPXfTpqHauUWwxs4btKfiF4yyt6fIkIWbo8baA/9jGsFusMge7IdSGzL2Zseypyu nPwB9Ek/gj/XpzfjN/0dnDuu94eKssK7+6SF0R5PNJNynESfVNXiPDtKB1scgPGM7q+s 1PkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=88Xr0yx58XqZJmxu4bMMhXYH0sWThF6GMrgw+s7HUak=; b=K0ewUIYiegZibqWIXD+yxpWl6GhSnJEnT+6MVxTAYoHEEL8y+RlNxlwYZgv72aoTCp R2WWLqt37cPSnhkMJBSSqanrkRquN5WzNRud4nxe1HFUpDFisOCPn7eRDmabg42vGPgF PO7tZTL+eFujSVW+Yd8mrR8LRKA8VZ0d77cwYnIyQtTYIQwuxLdHGslD+0y4PZGiZU6a UKZcJylccXohQb9zf0/xnAKc5h5fNuPqTicXuyKwj3HO/h3jU8YM9mCAq9Cp41ERMXHb X7mOjYZbdAbm8LPEjtdPjtqaNSzuglQsPFSYXvKWAX2YfqyCyHa4CAdiCnU5ixlvXdfF crOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@smartx-com.20221208.gappssmtp.com header.s=20221208 header.b=F0IISRr4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j9-20020a170903024900b001a63ba2c894si13802753plh.548.2023.04.25.01.32.55; Tue, 25 Apr 2023 01:33:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@smartx-com.20221208.gappssmtp.com header.s=20221208 header.b=F0IISRr4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233781AbjDYIcJ (ORCPT + 99 others); Tue, 25 Apr 2023 04:32:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229705AbjDYIbQ (ORCPT ); Tue, 25 Apr 2023 04:31:16 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76059BB96 for ; Tue, 25 Apr 2023 01:30:29 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-94ef8b88a5bso804713966b.2 for ; Tue, 25 Apr 2023 01:30:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smartx-com.20221208.gappssmtp.com; s=20221208; t=1682411420; x=1685003420; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=88Xr0yx58XqZJmxu4bMMhXYH0sWThF6GMrgw+s7HUak=; b=F0IISRr4sT3y7mi4tVPSLZr3osIYsuNdqnruDnQVwYBhuw1h6u975I178mVxu7vdJJ CxYOrM7fpGC8yyNmXo+0chvXJKJ8VVR7YDV33KfBo6o9QhK352xX62uCfaEu76F8ndMO rki4xStOT/wZC3rLUxC4AAFw+iKDh4Crue/vCGfpASVf40SYA38T3jT7stkU+1cot3Pa 55QuHcALpf38tmbItkd/US1Y8TIERWm2X3n8oQN1EcWKPGMKtAOXNvRm0J6PYLcX04hE x1EP2Awqfq9FYlT2f3hj0GuHx39UEnTV8TwIQDnVLVew1Jvxw+UNGAiQI2BEBVrX8bg0 tPaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682411420; x=1685003420; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=88Xr0yx58XqZJmxu4bMMhXYH0sWThF6GMrgw+s7HUak=; b=lCB1EM5urT4LOxZDUS3y8V0jbK4As16L0sMACMDNoBq75qy8qk0qutNOkRwuhfV30g yR+nq7AWVkwDQkUFLKKzXPyoCjfabAfVBZU+PTbqayYwoO2CkHItKDGgMCLvrP1ona5F YufIpEumQtd/XRk7R2Z6to4Q85TlPOjZD6/RKZWrcujHQIgolv4UqADK4wq9GDPyHDkK KnhRLfv1zhVuOnzb/VlnH8Zs8WA+vDlmwtJXwYuxu87QPxbGgG+bd8WzaYewVSQvCE4I dmEiX5ZUtQr06EXvLQWnPRbLVkvpwwtcJNF3h4mZWdj4AhXoevp34+uyEzXN9kYvofj7 zypw== X-Gm-Message-State: AAQBX9ez4U/ZjzgF7TOmWNIU4iaC80Kz+O/zZc/wybMfLBUG0TcB55Nu J6weoQvWCibrJUGjcMepzOwKyOg++/Vcq6mSzkcF6i7CNV3utJKY0abOzw== X-Received: by 2002:a17:907:a042:b0:94e:cbfb:5fab with SMTP id gz2-20020a170907a04200b0094ecbfb5fabmr12155022ejc.75.1682411419899; Tue, 25 Apr 2023 01:30:19 -0700 (PDT) MIME-Version: 1.0 References: <20230413062339.2454616-1-fengli@smartx.com> <20230413063317.2455680-1-fengli@smartx.com> <7f553d34-9ada-426c-4847-c7cd1aba64a8@grimberg.me> <03a47920-9165-1d49-1380-fb4c5061df67@grimberg.me> In-Reply-To: <03a47920-9165-1d49-1380-fb4c5061df67@grimberg.me> From: Li Feng Date: Tue, 25 Apr 2023 16:32:27 +0800 Message-ID: Subject: Re: [PATCH] nvme/tcp: Add support to set the tcp worker cpu affinity To: Sagi Grimberg Cc: Keith Busch , Jens Axboe , Christoph Hellwig , "open list:NVM EXPRESS DRIVER" , linux-kernel Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sagi, On Wed, Apr 19, 2023 at 5:32=E2=80=AFPM Sagi Grimberg wr= ote: > > > >> Hey Li, > >> > >>> The default worker affinity policy is using all online cpus, e.g. fro= m 0 > >>> to N-1. However, some cpus are busy for other jobs, then the nvme-tcp= will > >>> have a bad performance. > >>> This patch adds a module parameter to set the cpu affinity for the nv= me-tcp > >>> socket worker threads. The parameter is a comma separated list of CP= U > >>> numbers. The list is parsed and the resulting cpumask is used to set= the > >>> affinity of the socket worker threads. If the list is empty or the > >>> parsing fails, the default affinity is used. > >> > >> I can see how this may benefit a specific set of workloads, but I have= a > >> few issues with this. > >> > >> - This is exposing a user interface for something that is really > >> internal to the driver. > >> > >> - This is something that can be misleading and could be tricky to get > >> right, my concern is that this would only benefit a very niche case. > > Our storage products needs this feature~ > > If the user doesn=E2=80=99t know what this is, they can keep it default= , so I thinks this is > > not unacceptable. > > It doesn't work like that. A user interface is not something exposed to > a specific consumer. > > >> - If the setting should exist, it should not be global. > > V2 has fixed it. > >> > >> - I prefer not to introduce new modparams. > >> > >> - I'd prefer to find a way to support your use-case without introducin= g > >> a config knob for it. > >> > > I=E2=80=99m looking forward to it. > > If you change queue_work_on to queue_work, ignoring the io_cpu, does it > address your problem? Sorry for the late response, I just got my machine back. Replace the queue_work_on to queue_work, looks like it has a little good performance. The busy worker is `kworker/56:1H+nvme_tcp_wq`, and fio binds to 90('cpus_allowed=3D90'), I don't know why the worker 56 is selected. The performance of 256k read up from 1.15GB/s to 1.35GB/s. > > Not saying that this should be a solution though. > > How many queues does your controller support that you happen to use > queue 0 ? Our controller only support one io queue currently. > > Also, what happens if you don't pin your process to a specific cpu, does > that change anything? If I don't pin the cpu, the performance has no effect. Thanks, Li