Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1795608pxb; Wed, 20 Oct 2021 11:55:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8liEYgPalyy8kIm/dyAaNBcRsKYF1RQ6JEhBZ01pPmcmJG2BMsf7W/5j2w5unFuaOwdTo X-Received: by 2002:aa7:cd88:: with SMTP id x8mr866654edv.203.1634756103142; Wed, 20 Oct 2021 11:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634756103; cv=none; d=google.com; s=arc-20160816; b=UygXemfWLH/RwbtTZHgPAPIg8Py/9ryJLV6EPDNi4038HAqVT8sX1dCjxCGs3uQtBA XTx6vT2zxvZ9S6mYYAu6JNgw9VDRiibTi1OxLNvYWkdkmSs3wIvPVJZAQy3NPDOHUZxM dFHvFQL3bMgyTxYCkcgPgqTxK3ZycX/fOJquKXhNn9DXac+fyhV6ZCSYjm2b74AwTnb0 vJG8TDH73Y264ey9G2D01RT4Hlydfh1Cu3PPQrF0pFgxbzsMvZXscI24ONmv6dIfuii4 ZO5RB6a6tE0zkyoqbrWUiivKxFsTuv4IR9zRfWZwVKupa7m3uvYADW6EEq2s4gVuIp9K NIhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LiE9WJoftzY3Rn6Hlp/Im0DVv0DI2FTmT5imqp7DQyQ=; b=HE++PWc+dn9813+ttKQaeb+rhQn7tlBrTTKQENrhtSNzRK8kzQDoILm3Xu7Ed+Kgh3 inUR5WF8cydySDuwFPIILfA/7YSmM4QzwUaS+IdXfmfrV3S6Asget30+g5hu9mnLbtPH i/ZQ/7YamnhuHf4MUe14YWbWS2H/y2V0Svb9LRBCt+MO+e1UvPengDd8cNQETcc5nUGX Z7SQY6cNNSvKjS7XVC5ISiS3REQSYQU+3CJlgg9JN5oK/E7VA3QzRGG4kFGzOqGtn9ZD lg0kXP5QZ33UpO4weBtS9pL0/IUKy9AdoSgtblaKAvw8n+e3XvEkmaGtAHV/JCEGWNV+ Hnnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2021-07-09 header.b=SCcnCfmH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga26si4185393ejb.86.2021.10.20.11.54.38; Wed, 20 Oct 2021 11:55:03 -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; dkim=pass header.i=@oracle.com header.s=corp-2021-07-09 header.b=SCcnCfmH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231342AbhJTSzG (ORCPT + 99 others); Wed, 20 Oct 2021 14:55:06 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:42550 "EHLO mx0b-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231278AbhJTSzG (ORCPT ); Wed, 20 Oct 2021 14:55:06 -0400 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19KIVkgC025798; Wed, 20 Oct 2021 18:52:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2021-07-09; bh=LiE9WJoftzY3Rn6Hlp/Im0DVv0DI2FTmT5imqp7DQyQ=; b=SCcnCfmHJIPEcuR8kAUBefoSAB5spoNBTMWzu1OBfn4QIV6CNTNzGQxLiiyf4ildo8Q8 nRE0R0maeF2egvXDZqO9Ngg+Jupvp+q10UyfSL/3DBSzBl8dwXORQi/v2L724CVR2WFx nFDlqRb3PX33B9Tm5gWWp5fLXq5yhEIK1SCCdH8PZyZjIqt3HGbKcgVNFfQ0E1I/p+c7 UzcH1Cpll/6TeOf3W6IhRfaR2aUiyvpXz6uw1+Jv1mnq0p+8JvVTnJ1ijuzaIormmgqp pm4o5CWZLc4iEaiy0XhUOTSoLPON1cEQgeIE2nQRhtOItfnlYM9tvRvgScpthX7uHJY6 SQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3btrfm0418-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Oct 2021 18:52:43 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 19KIpb3F052811; Wed, 20 Oct 2021 18:52:42 GMT Received: from pps.reinject (localhost [127.0.0.1]) by userp3030.oracle.com with ESMTP id 3bqkv0hh8c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Oct 2021 18:52:42 +0000 Received: from userp3030.oracle.com (userp3030.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 19KIqfwq059818; Wed, 20 Oct 2021 18:52:41 GMT Received: from monad.us.oracle.com (dhcp-10-159-132-124.vpn.oracle.com [10.159.132.124]) by userp3030.oracle.com with ESMTP id 3bqkv0hh7s-1; Wed, 20 Oct 2021 18:52:41 +0000 From: Ankur Arora To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org Cc: mingo@kernel.org, bp@alien8.de, luto@kernel.org, akpm@linux-foundation.org, mike.kravetz@oracle.com, jon.grimm@amd.com, kvm@vger.kernel.org, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com, Ankur Arora , alex.williamson@redhat.com Subject: [PATCH v2 13/14] vfio_iommu_type1: specify FOLL_HINT_BULK to pin_user_pages() Date: Wed, 20 Oct 2021 11:52:07 -0700 Message-Id: <20211020185207.18509-1-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211020170305.376118-1-ankur.a.arora@oracle.com> References: <20211020170305.376118-1-ankur.a.arora@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: kyJVys3aFUyKJefJejJSe5ZCKu_C4bvd X-Proofpoint-ORIG-GUID: kyJVys3aFUyKJefJejJSe5ZCKu_C4bvd Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Specify FOLL_HINT_BULK to pin_user_pages() so it is aware that this pin is part of a larger region being pinned, so it can optimize based on that expectation. Cc: alex.williamson@redhat.com Signed-off-by: Ankur Arora --- drivers/vfio/vfio_iommu_type1.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index 0e9217687f5c..0d45b0c6464d 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c @@ -557,6 +557,9 @@ static int vaddr_get_pfns(struct mm_struct *mm, unsigned long vaddr, if (prot & IOMMU_WRITE) flags |= FOLL_WRITE; + /* Tell gup that this iterations is part of larger set of pins. */ + flags |= FOLL_HINT_BULK; + mmap_read_lock(mm); ret = pin_user_pages_remote(mm, vaddr, npages, flags | FOLL_LONGTERM, pages, NULL, NULL); -- 2.29.2