Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-30 Thread Jason Gunthorpe
On Mon, Aug 28, 2023 at 04:38:01AM +, Kasireddy, Vivek wrote: > Turns out, calling hmm_range_fault() from the invalidate callback was indeed > a problem and the reason why new pages were not faulted-in. In other words, > it looks like the invalidate callback is not the right place to invoke

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-27 Thread Kasireddy, Vivek
Hi Alistair, > > > > > > >> >> > > > No, adding HMM_PFN_REQ_WRITE still doesn't help in fixing the > > >> issue. > > >> >> > > > Although, I do not have THP enabled (or built-in), shmem does > > not > > >> evict > > >> >> > > > the pages after hole punch as noted in the comment in > > >> >>

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-24 Thread Kasireddy, Vivek
Hi Alistair, > > > >> >> > > > No, adding HMM_PFN_REQ_WRITE still doesn't help in fixing the > >> issue. > >> >> > > > Although, I do not have THP enabled (or built-in), shmem does > not > >> evict > >> >> > > > the pages after hole punch as noted in the comment in > >> >> shmem_fallocate(): > >>

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-22 Thread Alistair Popple
"Kasireddy, Vivek" writes: > Hi Alistair, > >> >> > > > No, adding HMM_PFN_REQ_WRITE still doesn't help in fixing the >> issue. >> >> > > > Although, I do not have THP enabled (or built-in), shmem does not >> evict >> >> > > > the pages after hole punch as noted in the comment in >> >>

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-22 Thread Kasireddy, Vivek
Hi Alistair, > >> > > > No, adding HMM_PFN_REQ_WRITE still doesn't help in fixing the > issue. > >> > > > Although, I do not have THP enabled (or built-in), shmem does not > evict > >> > > > the pages after hole punch as noted in the comment in > >> shmem_fallocate(): > >> > > > >> > > This is

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-21 Thread Alistair Popple
"Kasireddy, Vivek" writes: > Hi Jason, > >> > > >> > > > No, adding HMM_PFN_REQ_WRITE still doesn't help in fixing the issue. >> > > > Although, I do not have THP enabled (or built-in), shmem does not evict >> > > > the pages after hole punch as noted in the comment in >> shmem_fallocate(): >>

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-16 Thread Kasireddy, Vivek
Hi Jason, > > > > > > > No, adding HMM_PFN_REQ_WRITE still doesn't help in fixing the issue. > > > > Although, I do not have THP enabled (or built-in), shmem does not evict > > > > the pages after hole punch as noted in the comment in > shmem_fallocate(): > > > > > > This is the source of all

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-08 Thread Jason Gunthorpe
On Tue, Aug 08, 2023 at 07:37:19AM +, Kasireddy, Vivek wrote: > Hi Jason, > > > > > > No, adding HMM_PFN_REQ_WRITE still doesn't help in fixing the issue. > > > Although, I do not have THP enabled (or built-in), shmem does not evict > > > the pages after hole punch as noted in the comment in

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-08 Thread Kasireddy, Vivek
Hi Jason, > > > No, adding HMM_PFN_REQ_WRITE still doesn't help in fixing the issue. > > Although, I do not have THP enabled (or built-in), shmem does not evict > > the pages after hole punch as noted in the comment in shmem_fallocate(): > > This is the source of all your problems. > > Things

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-04 Thread Kasireddy, Vivek
Hi David, > > > Right, the "the zero pages are changed into writable pages" in your > above comment just might not apply, because there won't be any > >> page > replacement (hopefully :) ). > >> > >>> If the page replacement does not happen when there are new >

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-04 Thread Jason Gunthorpe
On Fri, Aug 04, 2023 at 06:39:22AM +, Kasireddy, Vivek wrote: > No, adding HMM_PFN_REQ_WRITE still doesn't help in fixing the issue. > Although, I do not have THP enabled (or built-in), shmem does not evict > the pages after hole punch as noted in the comment in shmem_fallocate(): This is

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-04 Thread David Hildenbrand
On 04.08.23 08:39, Kasireddy, Vivek wrote: Hi Alistair, David, Jason, Right, the "the zero pages are changed into writable pages" in your above comment just might not apply, because there won't be any page replacement (hopefully :) ). If the page replacement does not happen when there are

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-04 Thread Kasireddy, Vivek
Hi Alistair, David, Jason, > >> Right, the "the zero pages are changed into writable pages" in your > >> above comment just might not apply, because there won't be any > page > >> replacement (hopefully :) ). > > > If the page replacement does not happen when there are new

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-03 Thread Alistair Popple
David Hildenbrand writes: > On 03.08.23 14:14, Jason Gunthorpe wrote: >> On Thu, Aug 03, 2023 at 07:35:51AM +, Kasireddy, Vivek wrote: >>> Hi Jason, >>> >> Right, the "the zero pages are changed into writable pages" in your >> above comment just might not apply, because there won't

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-03 Thread Peter Xu
Hi, Vivek, On Thu, Aug 03, 2023 at 08:08:41AM +, Kasireddy, Vivek wrote: > > Isn't it already too late though to wait that notification until page is > > installed? Because here you pinned the page for DMA, I think it means > > before a new page installed (but after the page is invalidated)

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-03 Thread David Hildenbrand
On 03.08.23 14:14, Jason Gunthorpe wrote: On Thu, Aug 03, 2023 at 07:35:51AM +, Kasireddy, Vivek wrote: Hi Jason, Right, the "the zero pages are changed into writable pages" in your above comment just might not apply, because there won't be any page replacement (hopefully :) ). If the

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-03 Thread Jason Gunthorpe
On Thu, Aug 03, 2023 at 07:35:51AM +, Kasireddy, Vivek wrote: > Hi Jason, > > > > > Right, the "the zero pages are changed into writable pages" in your > > > > above comment just might not apply, because there won't be any page > > > > replacement (hopefully :) ). > > > > > If the page

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-03 Thread Kasireddy, Vivek
Hi Peter, > > Ok, I'll keep your use-case in mind but AFAICS, the process that creates > > the udmabuf can be considered the owner. So, I think it makes sense that > > the owner's VMA range can be registered (via mmu_notifiers) for updates. > > No need to have your special attention on this; my

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-03 Thread Kasireddy, Vivek
Hi Jason, > > > Right, the "the zero pages are changed into writable pages" in your > > > above comment just might not apply, because there won't be any page > > > replacement (hopefully :) ). > > > If the page replacement does not happen when there are new writes to the > > area where the hole

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-01 Thread Peter Xu
On Tue, Aug 01, 2023 at 07:11:09AM +, Kasireddy, Vivek wrote: > Ok, I'll keep your use-case in mind but AFAICS, the process that creates > the udmabuf can be considered the owner. So, I think it makes sense that > the owner's VMA range can be registered (via mmu_notifiers) for updates. No

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-01 Thread Jason Gunthorpe
On Tue, Aug 01, 2023 at 05:53:32PM +, Kasireddy, Vivek wrote: > > Right, the "the zero pages are changed into writable pages" in your > > above comment just might not apply, because there won't be any page > > replacement (hopefully :) ). > If the page replacement does not happen when there

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-01 Thread Kasireddy, Vivek
Hi David, > > On 01.08.23 14:26, Jason Gunthorpe wrote: > > On Tue, Aug 01, 2023 at 02:26:03PM +0200, David Hildenbrand wrote: > >> On 01.08.23 14:23, Jason Gunthorpe wrote: > >>> On Tue, Aug 01, 2023 at 02:22:12PM +0200, David Hildenbrand wrote: > On 01.08.23 14:19, Jason Gunthorpe wrote:

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-01 Thread David Hildenbrand
On 01.08.23 14:26, Jason Gunthorpe wrote: On Tue, Aug 01, 2023 at 02:26:03PM +0200, David Hildenbrand wrote: On 01.08.23 14:23, Jason Gunthorpe wrote: On Tue, Aug 01, 2023 at 02:22:12PM +0200, David Hildenbrand wrote: On 01.08.23 14:19, Jason Gunthorpe wrote: On Tue, Aug 01, 2023 at

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-01 Thread Jason Gunthorpe
On Tue, Aug 01, 2023 at 02:26:03PM +0200, David Hildenbrand wrote: > On 01.08.23 14:23, Jason Gunthorpe wrote: > > On Tue, Aug 01, 2023 at 02:22:12PM +0200, David Hildenbrand wrote: > > > On 01.08.23 14:19, Jason Gunthorpe wrote: > > > > On Tue, Aug 01, 2023 at 05:32:38AM +, Kasireddy, Vivek

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-01 Thread David Hildenbrand
On 01.08.23 14:23, Jason Gunthorpe wrote: On Tue, Aug 01, 2023 at 02:22:12PM +0200, David Hildenbrand wrote: On 01.08.23 14:19, Jason Gunthorpe wrote: On Tue, Aug 01, 2023 at 05:32:38AM +, Kasireddy, Vivek wrote: You get another invalidate because the memfd removes the zero pages that

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-01 Thread Jason Gunthorpe
On Tue, Aug 01, 2023 at 02:22:12PM +0200, David Hildenbrand wrote: > On 01.08.23 14:19, Jason Gunthorpe wrote: > > On Tue, Aug 01, 2023 at 05:32:38AM +, Kasireddy, Vivek wrote: > > > > > > You get another invalidate because the memfd removes the zero pages > > > > that hmm_range_fault

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-01 Thread David Hildenbrand
On 01.08.23 14:19, Jason Gunthorpe wrote: On Tue, Aug 01, 2023 at 05:32:38AM +, Kasireddy, Vivek wrote: You get another invalidate because the memfd removes the zero pages that hmm_range_fault installed in the PTEs before replacing them with actual writable pages. Then you do the move, and

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-01 Thread Jason Gunthorpe
On Tue, Aug 01, 2023 at 05:32:38AM +, Kasireddy, Vivek wrote: > > You get another invalidate because the memfd removes the zero pages > > that hmm_range_fault installed in the PTEs before replacing them with > > actual writable pages. Then you do the move, and another > > hmm_range_fault, and

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-08-01 Thread Kasireddy, Vivek
Hi Peter, > > > > > > > > > > > I'm not at all familiar with the udmabuf use case but that > sounds > > > > > > > > > brittle and effectively makes this notifier udmabuf specific > right? > > > > > > > > Oh, Qemu uses the udmabuf driver to provide Host Graphics > > > > > components > > > > > > >

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-31 Thread Kasireddy, Vivek
Hi Jason, > > > > Later the importer decides it needs the memory again so it again asks > > > for the dmabuf to be present, which does hmm_range_fault and gets > > > whatever is appropriate at the time. > > Unless I am missing something, I think just doing the above still won't > > solve > >

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-31 Thread Peter Xu
On Sat, Jul 29, 2023 at 12:08:25AM +, Kasireddy, Vivek wrote: > Hi Peter, > > > > > > > > > I'm not at all familiar with the udmabuf use case but that > > > > > > > > sounds > > > > > > > > brittle and effectively makes this notifier udmabuf specific > > > > > > > > right? > > > > > > > Oh,

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-30 Thread Jason Gunthorpe
On Sat, Jul 29, 2023 at 12:46:59AM +, Kasireddy, Vivek wrote: > > Later the importer decides it needs the memory again so it again asks > > for the dmabuf to be present, which does hmm_range_fault and gets > > whatever is appropriate at the time. > Unless I am missing something, I think just

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-28 Thread Kasireddy, Vivek
Hi Jason, > > > > > If you still need the memory mapped then you re-call > hmm_range_fault > > > > > and re-obtain it. hmm_range_fault will resolve all the races and you > > > > > get new pages. > > > > > > > IIUC, for my udmabuf use-case, it looks like calling hmm_range_fault > > > > immediately

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-28 Thread Kasireddy, Vivek
Hi Peter, > > > > > > > I'm not at all familiar with the udmabuf use case but that sounds > > > > > > > brittle and effectively makes this notifier udmabuf specific > > > > > > > right? > > > > > > Oh, Qemu uses the udmabuf driver to provide Host Graphics > > > components > > > > > > (such as

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-27 Thread Peter Xu
Hi, Vivek, On Tue, Jul 25, 2023 at 10:24:21PM +, Kasireddy, Vivek wrote: > Hi Hugh, > > > > > On Mon, 24 Jul 2023, Kasireddy, Vivek wrote: > > > Hi Jason, > > > > On Mon, Jul 24, 2023 at 07:54:38AM +, Kasireddy, Vivek wrote: > > > > > > > > > > I'm not at all familiar with the udmabuf

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-27 Thread Jason Gunthorpe
On Thu, Jul 27, 2023 at 07:34:30AM +, Kasireddy, Vivek wrote: > Hi Jason, > > > > > On Tue, Jul 25, 2023 at 10:44:09PM +, Kasireddy, Vivek wrote: > > > > If you still need the memory mapped then you re-call hmm_range_fault > > > > and re-obtain it. hmm_range_fault will resolve all the

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-27 Thread Kasireddy, Vivek
Hi Jason, > > On Tue, Jul 25, 2023 at 10:44:09PM +, Kasireddy, Vivek wrote: > > > If you still need the memory mapped then you re-call hmm_range_fault > > > and re-obtain it. hmm_range_fault will resolve all the races and you > > > get new pages. > > > IIUC, for my udmabuf use-case, it

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-25 Thread Jason Gunthorpe
On Tue, Jul 25, 2023 at 10:44:09PM +, Kasireddy, Vivek wrote: > > If you still need the memory mapped then you re-call hmm_range_fault > > and re-obtain it. hmm_range_fault will resolve all the races and you > > get new pages. > IIUC, for my udmabuf use-case, it looks like calling

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-25 Thread Kasireddy, Vivek
Hi Jason, > > > > > > > > I'm not at all familiar with the udmabuf use case but that sounds > > > > > brittle and effectively makes this notifier udmabuf specific right? > > > > Oh, Qemu uses the udmabuf driver to provide Host Graphics > components > > > > (such as Spice, Gstreamer, UI, etc)

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-25 Thread Kasireddy, Vivek
Hi Hugh, > > On Mon, 24 Jul 2023, Kasireddy, Vivek wrote: > > Hi Jason, > > > On Mon, Jul 24, 2023 at 07:54:38AM +, Kasireddy, Vivek wrote: > > > > > > > > I'm not at all familiar with the udmabuf use case but that sounds > > > > > brittle and effectively makes this notifier udmabuf specific

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-25 Thread Jason Gunthorpe
On Mon, Jul 24, 2023 at 08:32:45PM +, Kasireddy, Vivek wrote: > Hi Jason, > > > > > On Mon, Jul 24, 2023 at 07:54:38AM +, Kasireddy, Vivek wrote: > > > > > > I'm not at all familiar with the udmabuf use case but that sounds > > > > brittle and effectively makes this notifier udmabuf

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-24 Thread Hugh Dickins
On Mon, 24 Jul 2023, Kasireddy, Vivek wrote: > Hi Jason, > > On Mon, Jul 24, 2023 at 07:54:38AM +, Kasireddy, Vivek wrote: > > > > > > I'm not at all familiar with the udmabuf use case but that sounds > > > > brittle and effectively makes this notifier udmabuf specific right? > > > Oh, Qemu

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-24 Thread Alistair Popple
"Kasireddy, Vivek" writes: > Hi Alistair, Hi Vivek, >> I wonder if we actually need the flag? IIUC it is already used for more >> than just KSM. For example it can be called as part of fault handling by >> set_pte_at_notify() in in wp_page_copy(). > Yes, I noticed that but what I really

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-24 Thread Alistair Popple
Jason Gunthorpe writes: > On Mon, Jul 24, 2023 at 07:54:38AM +, Kasireddy, Vivek wrote: >> And replace mmu_notifier_update_mapping(vma->vm_mm, address, pte_pfn(*ptep)) >> in the current patch with >> mmu_notifier_change_pte(vma->vm_mm, address, ptep, false)); > > It isn't very useful

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-24 Thread Kasireddy, Vivek
Hi Alistair, > >> > >> Yes, although obviously as I think you point out below you wouldn't be > >> able to take any sleeping locks in mmu_notifier_update_mapping(). > > Yes, I understand that, but I am not sure how we can prevent any potential > > notifier callback from taking sleeping locks

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-24 Thread Kasireddy, Vivek
Hi Jason, > > On Mon, Jul 24, 2023 at 07:54:38AM +, Kasireddy, Vivek wrote: > > > > I'm not at all familiar with the udmabuf use case but that sounds > > > brittle and effectively makes this notifier udmabuf specific right? > > Oh, Qemu uses the udmabuf driver to provide Host Graphics

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-24 Thread Jason Gunthorpe
On Mon, Jul 24, 2023 at 11:36:47PM +1000, Alistair Popple wrote: > My primary issue with this patch is the notifier is called without the > PTL while providing a PTE value. Right, this is no-go. The PTE value must be protected by the PTLs at all times. We've made enough bugs already by being

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-24 Thread Jason Gunthorpe
On Mon, Jul 24, 2023 at 07:54:38AM +, Kasireddy, Vivek wrote: > > I'm not at all familiar with the udmabuf use case but that sounds > > brittle and effectively makes this notifier udmabuf specific right? > Oh, Qemu uses the udmabuf driver to provide Host Graphics components > (such as Spice,

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-24 Thread Alistair Popple
"Kasireddy, Vivek" writes: > Hi Alistair, > >> >> >> "Kasireddy, Vivek" writes: >> >> Yes, although obviously as I think you point out below you wouldn't be >> able to take any sleeping locks in mmu_notifier_update_mapping(). > Yes, I understand that, but I am not sure how we can prevent

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-24 Thread Kasireddy, Vivek
Hi Alistair, > > > "Kasireddy, Vivek" writes: > > > Hi Alistair, > > > >> > >> > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > >> > index 64a3239b6407..1f2f0209101a 100644 > >> > --- a/mm/hugetlb.c > >> > +++ b/mm/hugetlb.c > >> > @@ -6096,8 +6096,12 @@ vm_fault_t hugetlb_fault(struct mm_struct

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-20 Thread Alistair Popple
"Kasireddy, Vivek" writes: > Hi Alistair, > >> >> > diff --git a/mm/hugetlb.c b/mm/hugetlb.c >> > index 64a3239b6407..1f2f0209101a 100644 >> > --- a/mm/hugetlb.c >> > +++ b/mm/hugetlb.c >> > @@ -6096,8 +6096,12 @@ vm_fault_t hugetlb_fault(struct mm_struct >> *mm, struct vm_area_struct *vma,

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-20 Thread Kasireddy, Vivek
Hi Alistair, > > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > > index 64a3239b6407..1f2f0209101a 100644 > > --- a/mm/hugetlb.c > > +++ b/mm/hugetlb.c > > @@ -6096,8 +6096,12 @@ vm_fault_t hugetlb_fault(struct mm_struct > *mm, struct vm_area_struct *vma, > > * hugetlb_no_page will

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-19 Thread Kasireddy, Vivek
Hi Jason, > > On Wed, Jul 19, 2023 at 12:05:29AM +, Kasireddy, Vivek wrote: > > > > If there is no change to the PTEs then it is hard to see why this > > > would be part of a mmu_notifier. > > IIUC, the PTEs do get changed but only when a new page is faulted in. > > For shmem, it looks like

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-18 Thread Alistair Popple
Vivek Kasireddy writes: > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 64a3239b6407..1f2f0209101a 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -6096,8 +6096,12 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct > vm_area_struct *vma, >* hugetlb_no_page will

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-18 Thread Jason Gunthorpe
On Wed, Jul 19, 2023 at 12:05:29AM +, Kasireddy, Vivek wrote: > > If there is no change to the PTEs then it is hard to see why this > > would be part of a mmu_notifier. > IIUC, the PTEs do get changed but only when a new page is faulted in. > For shmem, it looks like the PTEs are updated in

RE: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-18 Thread Kasireddy, Vivek
Hi Jason, > > On Tue, Jul 18, 2023 at 01:28:56AM -0700, Vivek Kasireddy wrote: > > Currently, there does not appear to be any mechanism for letting > > drivers or other kernel entities know about updates made in a > > mapping particularly when a new page is faulted in. Providing > >

Re: [RFC v1 1/3] mm/mmu_notifier: Add a new notifier for mapping updates (new pages)

2023-07-18 Thread Jason Gunthorpe
On Tue, Jul 18, 2023 at 01:28:56AM -0700, Vivek Kasireddy wrote: > Currently, there does not appear to be any mechanism for letting > drivers or other kernel entities know about updates made in a > mapping particularly when a new page is faulted in. Providing > notifications for such situations is