All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rdma: don't make pages writeable if not requiested
@ 2013-03-21  6:18 ` Michael S. Tsirkin
  0 siblings, 0 replies; 62+ messages in thread
From: Michael S. Tsirkin @ 2013-03-21  6:18 UTC (permalink / raw)
  To: Michael R. Hines
  Cc: Roland Dreier, Sean Hefty, Hal Rosenstock, Yishai Hadas,
	Christoph Lameter, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	qemu-devel-qX2TKyscuCcdnm+yROfE0A

core/umem.c seems to get the arguments to get_user_pages
in the reverse order: it sets writeable flag and
breaks COW for MAP_SHARED if and only if hardware needs to
write the page.

This breaks memory overcommit for users such as KVM:
each time we try to register a page to send it to remote, this
breaks COW.  It seems that for applications that only have
REMOTE_READ permission, there is no reason to break COW at all.

If the page that is COW has lots of copies, this makes the user process
quickly exceed the cgroups memory limit.  This makes RDMA mostly useless
for virtualization, thus the stable tag.

Reported-by: "Michael R. Hines" <mrhines-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Michael S. Tsirkin <mst-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---

Note: compile-tested only, I don't have RDMA hardware at the moment.
Michael, could you please try this patch (also fixing your
usespace code not to request write access) and report?

Note2: grep for get_user_pages in infiniband drivers turns up
lots of users who set write to 1 unconditionally.
These might be bugs too, should be checked.

 drivers/infiniband/core/umem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index a841123..5929598 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -152,7 +152,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
 		ret = get_user_pages(current, current->mm, cur_base,
 				     min_t(unsigned long, npages,
 					   PAGE_SIZE / sizeof (struct page *)),
-				     1, !umem->writable, page_list, vma_list);
+				     !umem->writable, 1, page_list, vma_list);
 
 		if (ret < 0)
 			goto out;
-- 
MST
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 62+ messages in thread

end of thread, other threads:[~2013-03-21 20:09 UTC | newest]

Thread overview: 62+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-21  6:18 [PATCH] rdma: don't make pages writeable if not requiested Michael S. Tsirkin
2013-03-21  6:18 ` [Qemu-devel] " Michael S. Tsirkin
2013-03-21  6:18 ` Michael S. Tsirkin
     [not found] ` <20130321061838.GA28319-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-03-21  6:55   ` Roland Dreier
2013-03-21  6:55     ` [Qemu-devel] " Roland Dreier
2013-03-21  6:55     ` Roland Dreier
     [not found]     ` <CAL1RGDUcMj9QVsuQgK+ozw64L6-cGehL7YBUJ1_ckni6TD=Kcg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-21  7:03       ` Michael S. Tsirkin
2013-03-21  7:03         ` [Qemu-devel] " Michael S. Tsirkin
2013-03-21  7:03         ` Michael S. Tsirkin
     [not found]         ` <20130321070357.GD28328-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-03-21  7:15           ` Roland Dreier
2013-03-21  7:15             ` [Qemu-devel] " Roland Dreier
2013-03-21  7:15             ` Roland Dreier
     [not found]             ` <CAG4TOxPkhOhGmzeA1K4a0Zw8HxS-QkOr-PCx7mJgA+KkuH3ZiQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-21  8:51               ` Michael S. Tsirkin
2013-03-21  8:51                 ` [Qemu-devel] " Michael S. Tsirkin
2013-03-21  8:51                 ` Michael S. Tsirkin
     [not found]                 ` <20130321085107.GE28328-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-03-21  9:13                   ` Roland Dreier
2013-03-21  9:13                     ` [Qemu-devel] " Roland Dreier
2013-03-21  9:13                     ` Roland Dreier
     [not found]                     ` <CAL1RGDVnkLZU2Vge4o3BwDxnAfGv7TQRMqE6ha3MUt39CVp5NQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-21  9:39                       ` Michael S. Tsirkin
2013-03-21  9:39                         ` [Qemu-devel] " Michael S. Tsirkin
2013-03-21  9:39                         ` Michael S. Tsirkin
     [not found]                         ` <20130321093946.GG28328-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-03-21 17:11                           ` Jason Gunthorpe
2013-03-21 17:11                             ` [Qemu-devel] " Jason Gunthorpe
2013-03-21 17:11                             ` Jason Gunthorpe
     [not found]                             ` <20130321171115.GA653-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-03-21 17:15                               ` Michael S. Tsirkin
2013-03-21 17:15                                 ` [Qemu-devel] " Michael S. Tsirkin
2013-03-21 17:15                                 ` Michael S. Tsirkin
     [not found]                                 ` <20130321171525.GE2994-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-03-21 17:21                                   ` Jason Gunthorpe
2013-03-21 17:21                                     ` [Qemu-devel] " Jason Gunthorpe
2013-03-21 17:21                                     ` Jason Gunthorpe
     [not found]                                     ` <20130321172150.GA3118-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-03-21 17:42                                       ` Michael S. Tsirkin
2013-03-21 17:42                                         ` [Qemu-devel] " Michael S. Tsirkin
2013-03-21 17:42                                         ` Michael S. Tsirkin
     [not found]                                         ` <20130321174237.GA4060-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-03-21 17:57                                           ` Jason Gunthorpe
2013-03-21 17:57                                             ` [Qemu-devel] " Jason Gunthorpe
2013-03-21 17:57                                             ` Jason Gunthorpe
     [not found]                                             ` <20130321175732.GA3263-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-03-21 18:03                                               ` Michael S. Tsirkin
2013-03-21 18:03                                                 ` [Qemu-devel] " Michael S. Tsirkin
2013-03-21 18:03                                                 ` Michael S. Tsirkin
2013-03-21 18:16                               ` Michael S. Tsirkin
2013-03-21 18:16                                 ` [Qemu-devel] " Michael S. Tsirkin
2013-03-21 18:16                                 ` Michael S. Tsirkin
     [not found]                                 ` <20130321181633.GC4366-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-03-21 18:41                                   ` Jason Gunthorpe
2013-03-21 18:41                                     ` [Qemu-devel] " Jason Gunthorpe
2013-03-21 18:41                                     ` Jason Gunthorpe
     [not found]                                     ` <20130321184135.GA8044-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-03-21 19:15                                       ` Michael S. Tsirkin
2013-03-21 19:15                                         ` [Qemu-devel] " Michael S. Tsirkin
2013-03-21 19:15                                         ` Michael S. Tsirkin
     [not found]                                         ` <20130321191541.GB5272-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-03-21 20:09                                           ` Jason Gunthorpe
2013-03-21 20:09                                             ` [Qemu-devel] " Jason Gunthorpe
2013-03-21 20:09                                             ` Jason Gunthorpe
2013-03-21  9:32       ` Michael S. Tsirkin
2013-03-21  9:32         ` [Qemu-devel] " Michael S. Tsirkin
2013-03-21  9:32         ` Michael S. Tsirkin
     [not found]         ` <20130321093230.GF28328-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-03-21 11:30           ` Michael S. Tsirkin
2013-03-21 11:30             ` [Qemu-devel] " Michael S. Tsirkin
2013-03-21 11:30             ` Michael S. Tsirkin
2013-03-21 12:23   ` Michael R. Hines
2013-03-21 12:23     ` [Qemu-devel] " Michael R. Hines
2013-03-21 12:23     ` Michael R. Hines
2013-03-21 12:32     ` Michael S. Tsirkin
2013-03-21 12:32       ` [Qemu-devel] " Michael S. Tsirkin

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.