Messages in this thread | | | Date | Thu, 14 Feb 2019 13:12:31 -0700 | From | Jason Gunthorpe <> | Subject | Re: [PATCH 0/5] use pinned_vm instead of locked_vm to account pinned pages |
| |
On Thu, Feb 14, 2019 at 11:33:53AM -0800, Ira Weiny wrote:
> > I think it had to do with double accounting pinned and mlocked pages > > and thus delivering a lower than expected limit to userspace. > > > > vfio has this bug, RDMA does not. RDMA has a bug where it can > > overallocate locked memory, vfio doesn't. > > Wouldn't vfio also be able to overallocate if the user had RDMA pinned pages?
Yes
> I think the problem is that if the user calls mlock on a large range then both > vfio and RDMA could potentially overallocate even with this fix. This was your > initial email to Daniel, I think... And Alex's concern.
Here are the possibilities - mlock and pin on the same pages - RDMA respects the limit, VFIO halfs it. - mlock and pin on different pages - RDMA doubles the limit, VFIO respects it - VFIO and RDMA in the same process, the limit is halfed or doubled, depending.
IHMO we should make VFIO & RDMA the same, and then decide what to do about case #2.
> > Really unclear how to fix this. The pinned/locked split with two > > buckets may be the right way. > > Are you suggesting that we have 2 user limits?
This is what RDMA has done since CL's patch.
It is very hard to fix as you need to track how many pages are mlocked *AND* pinned.
Jason
| |