RE: [RFC PATCH v3 1/2] mempinfd: Add new syscall to provide memory pin

From: Song Bao Hua (Barry Song)
Date: Tue Feb 09 2021 - 20:05:09 EST




> -----Original Message-----
> From: Jason Gunthorpe [mailto:jgg@xxxxxxxx]
> Sent: Wednesday, February 10, 2021 2:54 AM
> To: Song Bao Hua (Barry Song) <song.bao.hua@xxxxxxxxxxxxx>
> Cc: David Hildenbrand <david@xxxxxxxxxx>; Wangzhou (B)
> <wangzhou1@xxxxxxxxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx;
> iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx; linux-mm@xxxxxxxxx;
> linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; linux-api@xxxxxxxxxxxxxxx; Andrew
> Morton <akpm@xxxxxxxxxxxxxxxxxxxx>; Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>;
> gregkh@xxxxxxxxxxxxxxxxxxx; kevin.tian@xxxxxxxxx; jean-philippe@xxxxxxxxxx;
> eric.auger@xxxxxxxxxx; Liguozhu (Kenneth) <liguozhu@xxxxxxxxxxxxx>;
> zhangfei.gao@xxxxxxxxxx; chensihang (A) <chensihang1@xxxxxxxxxxxxx>
> Subject: Re: [RFC PATCH v3 1/2] mempinfd: Add new syscall to provide memory
> pin
>
> On Tue, Feb 09, 2021 at 03:01:42AM +0000, Song Bao Hua (Barry Song) wrote:
>
> > On the other hand, wouldn't it be the benefit of hardware accelerators
> > to have a lower and more stable latency zip/encryption than CPU?
>
> No, I don't think so.

Fortunately or unfortunately, I think my people have this target to have
a lower-latency and more stable zip/encryption by using accelerators,
otherwise, they are going to use CPU directly if there is no advantage
of accelerators.

>
> If this is an important problem then it should apply equally to CPU
> and IO jitter.
>
> Honestly I find the idea that occasional migration jitters CPU and DMA
> to not be very compelling. Such specialized applications should
> allocate special pages to avoid this, not adding an API to be able to
> lock down any page

That is exactly what we have done to provide a hugeTLB pool so that
applications can allocate memory from this pool.

+-------------------------------------------+
| |
|applications using accelerators |
+-------------------------------------------+


alloc from pool free to pool
+ ++
| |
| |
| |
| |
| |
| |
| |
+----------+-----------------------+---------+
| |
| |
| HugeTLB memory pool |
| |
| |
+--------------------------------------------+

The problem is that SVA declares we can use any memory of a process
to do I/O. And in real scenarios, we are unable to customize most
applications to make them use the pool. So we are looking for some
extension generically for applications such as Nginx, Ceph.

I am also thinking about leveraging vm.compact_unevictable_allowed
which David suggested and making an extension on it, for example,
permit users to disable compaction and numa balancing on unevictable
pages of SVA process, which might be a smaller deal.

>
> Jason

Thanks
Barry