All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [RFC v2 01/13] mm: export zap_page_range() for driver use
@ 2020-12-23  6:32 ` Yongji Xie
  0 siblings, 0 replies; 6+ 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] 6+ messages in thread

* Re: [RFC v2 01/13] mm: export zap_page_range() for driver use
@ 2020-12-23  6:32 ` Yongji Xie
  0 siblings, 0 replies; 6+ 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] 6+ messages in thread

* 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
  -1 siblings, 0 replies; 6+ 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] 6+ messages in thread

* Re: [RFC v2 01/13] mm: export zap_page_range() for driver use
@ 2020-12-23  8:13   ` Christoph Hellwig
  0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2020-12-23  8:13 UTC (permalink / raw)
  To: Yongji Xie
  Cc: axboe, corbet, kvm, Michael S. Tsirkin, linux-aio, netdev,
	Randy Dunlap, Matthew Wilcox, virtualization, Christoph Hellwig,
	linux-mm, bcrl, viro, Stefan Hajnoczi, linux-fsdevel, akpm

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.
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 6+ 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
  -1 siblings, 0 replies; 6+ 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] 6+ messages in thread

* Re: [External] Re: [RFC v2 01/13] mm: export zap_page_range() for driver use
@ 2020-12-23 14:21     ` Yongji Xie
  0 siblings, 0 replies; 6+ 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] 6+ messages in thread

end of thread, other threads:[~2020-12-23 14:21 UTC | newest]

Thread overview: 6+ 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  6:32 ` Yongji Xie
2020-12-23  8:13 ` Christoph Hellwig
2020-12-23  8:13   ` Christoph Hellwig
2020-12-23 14:21   ` [External] " Yongji Xie
2020-12-23 14:21     ` Yongji Xie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.