Re: [PATCH rdma-next V1 08/10] IB/umem: Add support to huge ODP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 05, 2017 at 09:23:57AM +0300, Leon Romanovsky wrote:
> From: Artemy Kovalyov <artemyko@xxxxxxxxxxxx>
> 
> Add IB_ACCESS_HUGETLB ib_reg_mr flag.
> Hugetlb region registered with this flag
> will use single translation entry per huge page.
> 
> Signed-off-by: Artemy Kovalyov <artemyko@xxxxxxxxxxxx>
> Signed-off-by: Leon Romanovsky <leon@xxxxxxxxxx>
> ---
>  drivers/infiniband/core/umem.c     |  2 +-
>  drivers/infiniband/core/umem_odp.c | 19 +++++++++++++++++--
>  include/rdma/ib_umem_odp.h         |  6 ++++--
>  include/rdma/ib_verbs.h            |  1 +
>  4 files changed, 23 insertions(+), 5 deletions(-)
> 
> @@ -315,6 +317,20 @@ int ib_umem_odp_get(struct ib_ucontext *context, struct ib_umem *umem)
>  	if (!mm)
>  		return -EINVAL;
>  
> +	if (access & IB_ACCESS_HUGETLB) {
> +		struct vm_area_struct *vma;
> +		struct hstate *h;
> +
> +		vma = find_vma(mm, ib_umem_start(umem));
> +		if (!vma || !is_vm_hugetlb_page(vma))
> +			return -EINVAL;
> +		h = hstate_vma(vma);
> +		umem->page_shift = huge_page_shift(h);
> +		umem->hugetlb = 1;

User memory buffer could span multiple VMAs right? So shouldn’t we check all VMAs of the umem 
before setting the hugetlb flag?

> +	} else {
> +		umem->hugetlb = 0;
> +	}
> +
>  	/* Prevent creating ODP MRs in child processes */
>  	rcu_read_lock();
>  	our_pid = get_task_pid(current->group_leader, PIDTYPE_PID);
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux