Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp987962lqo; Fri, 17 May 2024 07:35:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVJNog805sfXSrk574rSQ8ELYZMLrZD8x5HUk2QsQAYySP2MRlzjGjjvVJLIavjKaRa+azXObdSpJCLYli+I52cPlwAXrEQ8hCs3smrQw== X-Google-Smtp-Source: AGHT+IE/B+Thp0VtRPMaK871YBy5eCnSsqNmegWSDR/iUJmeWqtVvACF3cFmfcGp9aPHqL0U3GXH X-Received: by 2002:a05:6a00:3d49:b0:6f3:e9bc:cc3d with SMTP id d2e1a72fcca58-6f4c90905a1mr37734621b3a.3.1715956545097; Fri, 17 May 2024 07:35:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715956545; cv=pass; d=google.com; s=arc-20160816; b=ObFGEgei6kAu3xGiTrRta+Gdhe+VXSsT9lUj7RBVtpLcAYiPpt8AT+es6K4aoWiiDL smWKYsejPToRRZExcxnpHYK+FtWEW/7a9ed5kcrjjTzAKD7nxnZLG47THmVaGBktGZiI IdQQsQkqr9mdtXB9I89LXodQEQYRJu38k4Nrf3aBXYJZZUNRWf8izHtDypZWZDExA/E8 9llUjbaj15912zhbkL4V49Luir0FF4Z9uughp3P3hMs61vpSuwqCA3Mx+BqqQgDbMB4G WHtM7io4xg6yQ4wS/j+V67kUx9B4vyhwxsAinubPWWApzL3drx9PthrguUL/qwHA7sRG szwg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=qXRpht3Oiyb6WnCO2PLJaNfFB/1BTZbbiqXWPvuMhk8=; fh=2IMu5/qcTf5L1nQANidESE3cswnoFZfi+sgRYJ/6YvA=; b=NhADihWZ1sueV9ZetKolTW63b7aAtCCY7EfS/Nxcumhf8sADiL/oPKnycYhQJlc7HQ Vn46YLzr5d0979tcy7T4ztdMLxq55L/9B6HKrBDon2+HMwtNWyFoJIOE9BWMnUcyz1aq lP7AfW8dkhoWIu7zIqT6f3gfxZ0K9NrXhchE7NVRPIHK4dP6C0Am74enKonneOriutn7 H8XMJP08lt41U/iFapYAHpJ/tzYDjxYFQUNDvUG6PghZ75KFAF2UeskKoRXLQPWWXLdC UZ4pwCbqiBUxAIzu1MUEfejZxiynAJOSQdEyx/M0yWD/EgtsokYQyTSsasoBPmPr+qkH KCZg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="XTo+g/9s"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-182209-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182209-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f4d2b2dad2si17786170b3a.295.2024.05.17.07.35.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:35:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182209-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="XTo+g/9s"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-182209-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182209-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9B3B2287107 for ; Fri, 17 May 2024 14:33:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AE8EF848E; Fri, 17 May 2024 14:33:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XTo+g/9s" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B72D79F0 for ; Fri, 17 May 2024 14:33:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715956397; cv=none; b=PbclgKtbwcpLYO5z4TKoP4nPjE17NHRSZLzsDB8OV+qElui7x2WcQjPyKANy5r6I1SXpBmsbQFp6i7Zk7zOwILN1wtitpKHH36jLEwOO+rb8d3P4C9BBhleorQfpNQ6CqY7re3X8QR8uPnVO/Ox2f9Eph5FF1tJus40IF+RfLDs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715956397; c=relaxed/simple; bh=V93XLAiIxz56pOFhKRk2dq+FLKZDcnpird74nR4nZdo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=X5WgJZ1TB/213kthj8ZU0NuL+VFU4l4dJT8lx4mcpmDraG4KvhnJ06Flskh34tWrTojEvZF20pi8tDMKPJ2xq7VgtAq7z6XMmghhwPe9tEAbsPgXgvaUSQ78H+Yysl/8u4v5H57lLS2Ig5DfE7Ag4AdL37M5nzMxWSXJ+Q/U37o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=XTo+g/9s; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715956394; 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: in-reply-to:in-reply-to:references:references; bh=qXRpht3Oiyb6WnCO2PLJaNfFB/1BTZbbiqXWPvuMhk8=; b=XTo+g/9soUDDzOiG63F1mMEa2yfrX532Iz2cW8AkVHiO2nLXRjVLRwDtkjZt/N6ZCrRsh6 VMy3sRaP5Pd+jVGiWZft4SO9sRtGwNZoSsG1by6lGztBBDJdlZA781uCHjbnnPh7L9FWbU aYNmk8yWhH2dgJs+gPNAi0HG1BMR98Q= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-7-f_iC8IrFOze2TXNajTJl6Q-1; Fri, 17 May 2024 10:33:11 -0400 X-MC-Unique: f_iC8IrFOze2TXNajTJl6Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 004D23802130; Fri, 17 May 2024 14:33:11 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (bmarzins-01.fast.eng.rdu2.dc.redhat.com [10.6.23.12]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E9F5F2026D68; Fri, 17 May 2024 14:33:10 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (localhost [127.0.0.1]) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.1) with ESMTPS id 44HEXAqY146578 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 17 May 2024 10:33:10 -0400 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 44HEXA7Y146577; Fri, 17 May 2024 10:33:10 -0400 Date: Fri, 17 May 2024 10:33:10 -0400 From: Benjamin Marzinski To: YangYang Cc: Alasdair Kergon , Mike Snitzer , Mikulas Patocka , dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/5] dm: support retrieving struct dm_target from struct dm_dev Message-ID: References: <20240514090445.2847-1-yang.yang@vivo.com> <20240514090445.2847-4-yang.yang@vivo.com> <80ddcd90-2e1c-4fbf-a45a-b1b5ff4d60fb@vivo.com> <8f49b95e-88df-48b8-9311-8a15414d8107@vivo.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8f49b95e-88df-48b8-9311-8a15414d8107@vivo.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 On Fri, May 17, 2024 at 03:48:49PM +0800, YangYang wrote: > On 2024/5/16 23:29, Benjamin Marzinski wrote: > > On Thu, May 16, 2024 at 09:55:53AM +0800, YangYang wrote: > > > On 2024/5/15 23:42, Benjamin Marzinski wrote: > > > > On Tue, May 14, 2024 at 05:04:42PM +0800, Yang Yang wrote: > > > > > > If I understand correctly, you are suggesting to iterate through all the > > > targets, handling those with sends_pass_around_flush set, and skipping > > > those where sends_pass_around_flush is not set. I believe this approach > > > may result in some CPU wastage. > > > > > > for i in {0..1023}; do > > > echo $((8000*$i)) 8000 linear /dev/sda2 $((16384*$i)) > > > done | sudo dmsetup create example > > > > > > In this specific scenario, a single iteration of the loop is all that > > > is needed. > > > > It's just one iteration of the loop either way. You either loop through > > the targets or the devices. It's true that if you have lots of targets > > all mapped to the same device, you would waste time looping through all > > the targets instead of looping through the devices. But if you only had > > one striped target mapped to lots of devices, you would waste time > > looping through all of the devices instead of looping through the > > targets. > > Yes, I get your point. This patchset may make things even worse for > the striped target. > I am just curious, in what scenario is the "dm-strip" target mapped to > a large number of underlying devices from the same block device. > I don't think anyone in the real world does create dm-stripe devices with a huge number of stripe table devices. My point was that it didn't seem obvious me that looping through the targets was a significant problem compared to looping through the devices. At any rate, Mikulas's patch already does this optimally, even for targets like dm-stripe, so it doesn't really matter now. -Ben