From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8A03C432BE for ; Thu, 5 Aug 2021 13:32:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9204A60F58 for ; Thu, 5 Aug 2021 13:32:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241698AbhHENcM (ORCPT ); Thu, 5 Aug 2021 09:32:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:28668 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238437AbhHENcJ (ORCPT ); Thu, 5 Aug 2021 09:32:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628170315; 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=KFeFt1ww8WzoDvTA8B4ID/THa1sBrEwi6JiSRoox5oM=; b=UYNe/jicwMop7jWFr8j3AEnGB1jlLJmLNLel8lHczjZGBudnlDBRcMMaLJ5BdrSYphVBad coEPIY1VjClyve620cm55Ufb5xdLNlqrK3uimJA1tPcXt9DoXYFPuvbWJXNB5SRnvj6W0H AWFnokaf0gfNVaPDr8W0y3cNWuIuvvA= Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-486-LwTtJm-PPpy7WCrRLDIQ1w-1; Thu, 05 Aug 2021 09:31:54 -0400 X-MC-Unique: LwTtJm-PPpy7WCrRLDIQ1w-1 Received: by mail-pj1-f69.google.com with SMTP id o13-20020a17090a9f8db0290177972c9adeso5692730pjp.5 for ; Thu, 05 Aug 2021 06:31:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=KFeFt1ww8WzoDvTA8B4ID/THa1sBrEwi6JiSRoox5oM=; b=gvYKsZi0G1X6dlTkoPRX2ngagQLsCc2kAqtJMiMYeMQE8pwz35ajM5rdEgZE6ptMuG FqykWKKjbfO51C1XHIGRS7KCH1kCRr5dSgtFVH9Qxb6vzc+M9fJTtSl5p8dkkxphawZ9 Fxvy0sSTXwQPasEUMpTZ/aXxD8cARiRSL7WEJaoMYnpkLFAHnHGtKMr3mViTQg0TkndR cqTt12jU+n70lm0nBDozv/cbFsm3NMhHlk4umDSd5x+L+ic1pkXPMOv2+O1fsZhZsop0 tU4fVZoCYP+bzO1gAZGmHUTq2e9mHF7Tj0KMLL8PLcStziPUFolm+Lf6JyTdjsveb7mj 7YqQ== X-Gm-Message-State: AOAM533qlJ3DHp0ucDorBsVL9VjLGVwTdr5QNZDyZ7cNiZfSr/lNqrxx j2N+dbov01o57kgdLkSsTRDwwxe2UeJMebQLCezgjKrR8FzC/odS+LF1CrPYiTt/aNxOMUQJthH lUR6cNyYTf2zBMdmYT5vnMeCK X-Received: by 2002:a65:610c:: with SMTP id z12mr612917pgu.453.1628170312974; Thu, 05 Aug 2021 06:31:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweBq6SSyDD2nP+XrrpaLsd2Knf9rcBqrsnAXcXPB8geZ/AllW4llVpLKWNfVfqwtMjCV4ZTA== X-Received: by 2002:a65:610c:: with SMTP id z12mr612875pgu.453.1628170312586; Thu, 05 Aug 2021 06:31:52 -0700 (PDT) Received: from wangxiaodeMacBook-Air.local ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id y67sm6867035pfg.218.2021.08.05.06.31.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 05 Aug 2021 06:31:52 -0700 (PDT) Subject: Re: [PATCH v10 01/17] iova: Export alloc_iova_fast() and free_iova_fast() To: Yongji Xie , Robin Murphy Cc: kvm , "Michael S. Tsirkin" , virtualization , Christian Brauner , Jonathan Corbet , Matthew Wilcox , Christoph Hellwig , Dan Carpenter , Stefano Garzarella , Liu Xiaodong , Joe Perches , Al Viro , Stefan Hajnoczi , songmuchun@bytedance.com, Jens Axboe , He Zhe , Greg KH , Randy Dunlap , linux-kernel , iommu@lists.linux-foundation.org, bcrl@kvack.org, netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?UTF-8?Q?Mika_Penttil=c3=a4?= References: <20210729073503.187-1-xieyongji@bytedance.com> <20210729073503.187-2-xieyongji@bytedance.com> <43d88942-1cd3-c840-6fec-4155fd544d80@redhat.com> <6e05e25e-e569-402e-d81b-8ac2cff1c0e8@arm.com> <417ce5af-4deb-5319-78ce-b74fb4dd0582@arm.com> From: Jason Wang Message-ID: <8c381d3d-9bbd-73d6-9733-0f0b15c40820@redhat.com> Date: Thu, 5 Aug 2021 21:31:43 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2021/8/5 下午8:34, Yongji Xie 写道: >> My main point, though, is that if you've already got something else >> keeping track of the actual addresses, then the way you're using an >> iova_domain appears to be something you could do with a trivial bitmap >> allocator. That's why I don't buy the efficiency argument. The main >> design points of the IOVA allocator are to manage large address spaces >> while trying to maximise spatial locality to minimise the underlying >> pagetable usage, and allocating with a flexible limit to support >> multiple devices with different addressing capabilities in the same >> address space. If none of those aspects are relevant to the use-case - >> which AFAICS appears to be true here - then as a general-purpose >> resource allocator it's rubbish and has an unreasonably massive memory >> overhead and there are many, many better choices. >> > OK, I get your point. Actually we used the genpool allocator in the > early version. Maybe we can fall back to using it. I think maybe you can share some perf numbers to see how much alloc_iova_fast() can help. Thanks >