* Re: [RFC v2 01/13] mm: export zap_page_range() for driver use
@ 2020-12-23 6:32 Yongji Xie
2020-12-23 8:13 ` Christoph Hellwig
0 siblings, 1 reply; 5+ messages in thread
From: Yongji Xie @ 2020-12-23 6:32 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Michael S. Tsirkin, Jason Wang, Stefan Hajnoczi, sgarzare,
Parav Pandit, akpm, Randy Dunlap, Matthew Wilcox, viro, axboe,
bcrl, corbet, virtualization, netdev, kvm, linux-aio,
linux-fsdevel, linux-mm
On Tue, Dec 22, 2020 at 11:44 PM Christoph Hellwig <hch@infradead.org> wrote:
>
> On Tue, Dec 22, 2020 at 10:52:09PM +0800, Xie Yongji wrote:
> > Export zap_page_range() for use in VDUSE.
>
> Err, no. This has absolutely no business being used by drivers.
Now I want to map/unmap some pages in an userland vma dynamically. The
vm_insert_page() is being used for mapping. In the unmapping case, it
looks like the zap_page_range() does what I want. So I export it.
Otherwise, we need some ways to notify userspace to trigger it with
madvise(MADV_DONTNEED), which might not be able to meet all our needs.
For example, unmapping some pages in a memory shrinker function.
So I'd like to know what's the limitation to use zap_page_range() in a
module. And if we can't use it in a module, is there any acceptable
way to achieve that?
Thanks.
Yongji
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC v2 01/13] mm: export zap_page_range() for driver use
2020-12-23 6:32 [RFC v2 01/13] mm: export zap_page_range() for driver use Yongji Xie
@ 2020-12-23 8:13 ` Christoph Hellwig
2020-12-23 14:21 ` [External] " Yongji Xie
0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2020-12-23 8:13 UTC (permalink / raw)
To: Yongji Xie
Cc: Christoph Hellwig, Michael S. Tsirkin, Jason Wang,
Stefan Hajnoczi, sgarzare, Parav Pandit, akpm, Randy Dunlap,
Matthew Wilcox, viro, axboe, bcrl, corbet, virtualization,
netdev, kvm, linux-aio, linux-fsdevel, linux-mm
On Wed, Dec 23, 2020 at 02:32:07PM +0800, Yongji Xie wrote:
> Now I want to map/unmap some pages in an userland vma dynamically. The
> vm_insert_page() is being used for mapping. In the unmapping case, it
> looks like the zap_page_range() does what I want. So I export it.
> Otherwise, we need some ways to notify userspace to trigger it with
> madvise(MADV_DONTNEED), which might not be able to meet all our needs.
> For example, unmapping some pages in a memory shrinker function.
>
> So I'd like to know what's the limitation to use zap_page_range() in a
> module. And if we can't use it in a module, is there any acceptable
> way to achieve that?
I think the anser is: don't play funny games with unmapped outside of
munmap. Especially as synchronization is very hard to get right.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [External] Re: [RFC v2 01/13] mm: export zap_page_range() for driver use
2020-12-23 8:13 ` Christoph Hellwig
@ 2020-12-23 14:21 ` Yongji Xie
0 siblings, 0 replies; 5+ messages in thread
From: Yongji Xie @ 2020-12-23 14:21 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Michael S. Tsirkin, Jason Wang, Stefan Hajnoczi, sgarzare,
Parav Pandit, akpm, Randy Dunlap, Matthew Wilcox, viro, axboe,
bcrl, corbet, virtualization, netdev, kvm, linux-aio,
linux-fsdevel, linux-mm
On Wed, Dec 23, 2020 at 4:13 PM Christoph Hellwig <hch@infradead.org> wrote:
>
> On Wed, Dec 23, 2020 at 02:32:07PM +0800, Yongji Xie wrote:
> > Now I want to map/unmap some pages in an userland vma dynamically. The
> > vm_insert_page() is being used for mapping. In the unmapping case, it
> > looks like the zap_page_range() does what I want. So I export it.
> > Otherwise, we need some ways to notify userspace to trigger it with
> > madvise(MADV_DONTNEED), which might not be able to meet all our needs.
> > For example, unmapping some pages in a memory shrinker function.
> >
> > So I'd like to know what's the limitation to use zap_page_range() in a
> > module. And if we can't use it in a module, is there any acceptable
> > way to achieve that?
>
> I think the anser is: don't play funny games with unmapped outside of
> munmap. Especially as synchronization is very hard to get right.
OK, I will try to let userspace do this.
Thanks,
Yongji
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC v2 01/13] mm: export zap_page_range() for driver use
2020-12-22 14:52 ` [RFC v2 01/13] mm: export zap_page_range() for driver use Xie Yongji
@ 2020-12-22 15:44 ` Christoph Hellwig
0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2020-12-22 15:44 UTC (permalink / raw)
To: Xie Yongji
Cc: mst, jasowang, stefanha, sgarzare, parav, akpm, rdunlap, willy,
viro, axboe, bcrl, corbet, virtualization, netdev, kvm,
linux-aio, linux-fsdevel, linux-mm
On Tue, Dec 22, 2020 at 10:52:09PM +0800, Xie Yongji wrote:
> Export zap_page_range() for use in VDUSE.
Err, no. This has absolutely no business being used by drivers.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [RFC v2 01/13] mm: export zap_page_range() for driver use
2020-12-22 14:52 [RFC v2 00/13] Introduce VDUSE - vDPA Device in Userspace Xie Yongji
@ 2020-12-22 14:52 ` Xie Yongji
2020-12-22 15:44 ` Christoph Hellwig
0 siblings, 1 reply; 5+ messages in thread
From: Xie Yongji @ 2020-12-22 14:52 UTC (permalink / raw)
To: mst, jasowang, stefanha, sgarzare, parav, akpm, rdunlap, willy,
viro, axboe, bcrl, corbet
Cc: virtualization, netdev, kvm, linux-aio, linux-fsdevel, linux-mm
Export zap_page_range() for use in VDUSE.
Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
---
mm/memory.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/mm/memory.c b/mm/memory.c
index 7d608765932b..edd2d6497bb3 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1542,6 +1542,7 @@ void zap_page_range(struct vm_area_struct *vma, unsigned long start,
mmu_notifier_invalidate_range_end(&range);
tlb_finish_mmu(&tlb, start, range.end);
}
+EXPORT_SYMBOL(zap_page_range);
/**
* zap_page_range_single - remove user pages in a given range
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-12-23 14:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-23 6:32 [RFC v2 01/13] mm: export zap_page_range() for driver use Yongji Xie
2020-12-23 8:13 ` Christoph Hellwig
2020-12-23 14:21 ` [External] " Yongji Xie
-- strict thread matches above, loose matches on Subject: below --
2020-12-22 14:52 [RFC v2 00/13] Introduce VDUSE - vDPA Device in Userspace Xie Yongji
2020-12-22 14:52 ` [RFC v2 01/13] mm: export zap_page_range() for driver use Xie Yongji
2020-12-22 15:44 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).