Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp3651317rwe; Mon, 17 Apr 2023 01:06:43 -0700 (PDT) X-Google-Smtp-Source: AKy350acuT/SVWpUS2pvvQSE3nSNn6X1pyc9v0UKkVR4DfoM9CGu3xY8qXRn9wcGebuc9+n9OTgg X-Received: by 2002:a17:90a:d246:b0:246:bb61:4a6a with SMTP id o6-20020a17090ad24600b00246bb614a6amr13501713pjw.1.1681718803364; Mon, 17 Apr 2023 01:06:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681718803; cv=none; d=google.com; s=arc-20160816; b=SPdfLp0ZIq2FUaJBh8/RPToO2tu+GcW6Mvp6IBv6RDauqy3a9J2oZSZN6d1n7SPFiK vvp/CZya4aRoHiBLcZZqBeTJOY0o+WHrhclqeqWTRMSjc27AkOq1meDFw3i/PCA6P8wG FNct95TUkoCoFp3G0ZNG0gxSdTetZo4UQpdIrxzi5OalQaHVQrknZ/wghm7VqXV1OZ0B 6IJqyTUFG//YRVJVNlefwYWEUMoww7huHb/8n/EASdWuRkB2jkKh79k7vFPsRmbnCpvJ QowtQRrl/fkMy9jlcbDYYhZn5B/DP1Kz38WkFueRUEWus43uEui+WRQU31HblxFH9LEK 3Htg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=64LjpVCxLV+TLB4DlA7ht7RGBF6FWgyYq2+ZXjoxFPQ=; b=r1NQ5BTNSXqw9Sjchvd9cSKc7HggqlUiRXkscs8WaTuhNgGlCsRzstFhjfgJidhhkz 2xafh5HqRIsopfdRgXsBpkHHmO8DtpIqqZDhnozBp4dl1xtQy6Z18rzy6mU+yd9NhpBw dPPEe5McddxVekIuy6pZ5//PHYOReTlky5Hy3F2mPV3T3cG98iU8auWuLPm5nZ4PaNvF uu4tLNv7Mf8gpxs7cwC/orzNvRx0eB3mqUiEAy/z15DRsB3x6bu4nYUpsWb5zr18Walq w7Z64rFI59nxbnEDuGDOVWSQruuahO2kMhJX0cHVraKopqFQRK+L5fdVj5PQMMWMpeTz dAMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SmAHlQIZ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a62-20020a639041000000b0051b85ea8e17si6492867pge.3.2023.04.17.01.06.32; Mon, 17 Apr 2023 01:06:43 -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=@redhat.com header.s=mimecast20190719 header.b=SmAHlQIZ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231161AbjDQIG3 (ORCPT + 99 others); Mon, 17 Apr 2023 04:06:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231145AbjDQIGZ (ORCPT ); Mon, 17 Apr 2023 04:06:25 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63708196 for ; Mon, 17 Apr 2023 01:05:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681718734; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=64LjpVCxLV+TLB4DlA7ht7RGBF6FWgyYq2+ZXjoxFPQ=; b=SmAHlQIZa9+y8fXgpQOwzKZbwqU3VWaU760MPlhKOhwvLemAH8jV8H4BmbocJ594ub7hYX MU4Rh2Iy60qHUDIh5qWgVY5WMe7LwbawVuJkEj6hKHkBDw1cPZnBxPfa83CO4NMNTre6id h4WnEnHrwnzQEhEvtG8IfNX99JfAVJk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-436-iqveTSncMZGVonA7d7IEsw-1; Mon, 17 Apr 2023 04:05:30 -0400 X-MC-Unique: iqveTSncMZGVonA7d7IEsw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 40DF985A5B1; Mon, 17 Apr 2023 08:05:30 +0000 (UTC) Received: from ovpn-8-16.pek2.redhat.com (ovpn-8-16.pek2.redhat.com [10.72.8.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2CFBD14152F6; Mon, 17 Apr 2023 08:05:23 +0000 (UTC) Date: Mon, 17 Apr 2023 16:05:18 +0800 From: Ming Lei To: Li Feng Cc: Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , "open list:NVM EXPRESS DRIVER" , linux-kernel , ming.lei@redhat.com Subject: Re: [PATCH v2] nvme/tcp: Add support to set the tcp worker cpu affinity Message-ID: References: <20230413062339.2454616-1-fengli@smartx.com> <20230413132941.2489795-1-fengli@smartx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,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 On Mon, Apr 17, 2023 at 03:50:46PM +0800, Li Feng wrote: > > > > 2023年4月17日 下午3:37,Ming Lei 写道: > > > > On Thu, Apr 13, 2023 at 09:29:41PM +0800, Li Feng wrote: > >> The default worker affinity policy is using all online cpus, e.g. from 0 > >> to N-1. However, some cpus are busy for other jobs, then the nvme-tcp will > >> have a bad performance. > > > > Can you explain in detail how nvme-tcp performs worse in this situation? > > > > If some of CPUs are knows as busy, you can submit the nvme-tcp io jobs > > on other non-busy CPUs via taskset, or scheduler is supposed to choose > > proper CPUs for you. And usually nvme-tcp device should be saturated > > with limited io depth or jobs/cpus. > > > > > > Thanks, > > Ming > > > > Taskset can’t work on nvme-tcp io-queues, because the worker cpu has decided at the nvme-tcp ‘connect’ stage, > not the sending io stage. Assume there is only one io-queue, the binding cpu is CPU0, no matter io jobs > run other cpus. OK, looks the problem is on queue->io_cpu, see nvme_tcp_queue_request(). But I am wondering why nvme-tcp doesn't queue the io work on the current cpu? And why is queue->io_cpu introduced? Given blk-mq defines cpu affinities for each hw queue, driver is supposed to submit IO request to hardware on the local CPU. Sagi and Guys, any ideas about introducing queue->io_cpu? Thanks, Ming