Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp1059332pxa; Fri, 28 Aug 2020 02:27:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiOkrBw1rvjWFGcNjwGhr1Tm+vm4dL2xdEebjlNu7lYJNAc3/YsFti6TOB9De5kFiVujfd X-Received: by 2002:a50:a0c7:: with SMTP id 65mr853609edo.375.1598606831646; Fri, 28 Aug 2020 02:27:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598606831; cv=none; d=google.com; s=arc-20160816; b=gKI1oS3jR0i1yKBXVcRIVOwVFrS5iPGxx0YkpXvDsRPZMZaz2bSvMuBEMdzDhptuUv vPmMBHSA5LhDaAOsk+aSZNWz3YSiludsb8kxujnCjQClSjOAZJ5Ok97L4dBAhluwXm+l gwmSAAM7O6C6YNvqeX325pOLT/Xv+dCt1bb967YV5/zycjIgHYD72vn7qYlNfwBIOb4/ 0AgT3i52dEiN1E/KZKfgzF2qL0/mxZIsi8VJO9lySnfqUpV91RKNfhwYNsIvbKD23/6I DPiczwkA/jt54aWw537isCoKrGlWh0sZveARjhmqQOOXKBu3VI89G4AAScDIEYmjJ617 IhfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=TL9ztUtmJI71DFFDgrMVOQiCWNuVc3Dz+0Nm6+/sElA=; b=dBT0CRpDmiGx6+JXsv7KG1l/gfePC30F9stCkzycyCfA5C11fiUd2mWHSpHFTTMOkh 7P+2+4QVpW/bdjdlBNqxFJzVHSfp5YIv5wURBm5yiBZMfMlbeBIw94s/SkcVMz+yrC2D uTiu4eLcdbi5QkPVzv4BkU+/IluJ7xMrDLHRCCqRB3kRhCv64tzYDDDE2qxFCrzqjAQz 69VlLZiZ5E4px12ahiASqhLNCzTVd7Xe2pWu12cdLpMwireWqTM2EuMER/NTzPEiyiDD XmglcW6btwOjjkTwoO9iGm2YVKK4kYw3+6gO4GSdhO7Dl+ahRKuV3KKi/V1YYpo7F2F5 Y/AQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d10si202777edh.341.2020.08.28.02.26.48; Fri, 28 Aug 2020 02:27:11 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728929AbgH1JXe (ORCPT + 99 others); Fri, 28 Aug 2020 05:23:34 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:3076 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728016AbgH1JX1 (ORCPT ); Fri, 28 Aug 2020 05:23:27 -0400 Received: from dggeml405-hub.china.huawei.com (unknown [172.30.72.55]) by Forcepoint Email with ESMTP id 62269E9A9CA422CC6D28; Fri, 28 Aug 2020 17:23:24 +0800 (CST) Received: from DGGEML524-MBX.china.huawei.com ([169.254.1.71]) by dggeml405-hub.china.huawei.com ([10.3.17.49]) with mapi id 14.03.0487.000; Fri, 28 Aug 2020 17:23:17 +0800 From: "Maoming (maoming, Cloud Infrastructure Service Product Dept.)" To: Alex Williamson CC: "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "cohuck@redhat.com" , "Zhoujian (jay)" , "Huangweidong (C)" , "peterx@redhat.com" , "aarcange@redhat.com" , wangyunjian Subject: =?gb2312?B?tPC4tDogW1BBVENIIFYyXSB2ZmlvIGRtYV9tYXAvdW5tYXA6IG9wdGltaXpl?= =?gb2312?Q?d_for_hugetlbfs_pages?= Thread-Topic: [PATCH V2] vfio dma_map/unmap: optimized for hugetlbfs pages Thread-Index: AQHWcePn246e6Z2xQkKwoyKqsTP1MqlA2C0AgAxwBSA= Date: Fri, 28 Aug 2020 09:23:16 +0000 Message-ID: <8B561EC9A4D13649A62CF60D3A8E8CB28C2DBE88@dggeml524-mbx.china.huawei.com> References: <20200814023729.2270-1-maoming.maoming@huawei.com> <20200820123802.724afd4a@x1.home> In-Reply-To: <20200820123802.724afd4a@x1.home> Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.174.151.129] Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SGksIA0KVGhhbmtzIGZvciB0YWtpbmcgYSBsb29rLg0KU29tZSByZXBsaWVzIGJlbG93Og0KDQoN Ck9uIEZyaSwgMTQgQXVnIDIwMjAgMTA6Mzc6MjkgKzA4MDANCk1pbmcgTWFvIDxtYW9taW5nLm1h b21pbmdAaHVhd2VpLmNvbT4gd3JvdGU6DQoNCj4gSW4gdGhlIG9yaWdpbmFsIHByb2Nlc3Mgb2Yg cGlubmluZy91bnBpbm5pbmcgcGFnZXMgZm9yIFZGSU8tZGV2aWNlcywgDQo+IHRvIG1ha2Ugc3Vy ZSB0aGUgcGFnZXMgYXJlIGNvbnRpZ3VvdXMsIHdlIGhhdmUgdG8gY2hlY2sgdGhlbSBvbmUgYnkg b25lLg0KPiBBcyBhIHJlc3VsdCwgZG1hX21hcC91bm1hcCBjb3VsZCBzcGVuZCBhIGxvbmcgdGlt ZS4NCj4gVXNpbmcgdGhlIGh1Z2V0bGIgcGFnZXMsIHdlIGNhbiBhdm9pZCB0aGlzIHByb2JsZW0u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