From patchwork Tue Mar 5 06:57:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 15228 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id C440723E24 for ; Tue, 5 Mar 2013 06:59:08 +0000 (UTC) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by fiordland.canonical.com (Postfix) with ESMTP id 76018A18CCD for ; Tue, 5 Mar 2013 06:59:08 +0000 (UTC) Received: by mail-vc0-f169.google.com with SMTP id n10so3895898vcn.14 for ; Mon, 04 Mar 2013 22:59:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-auditid:from:to:date:message-id:x-mailer:in-reply-to :references:x-brightmail-tracker:cc:subject:x-beenthere :x-mailman-version:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-gm-message-state; bh=cqofWcJRXgVKwj3zZMWG9KNWbi9d2PkgSA7e8/I/0D4=; b=R3t9MqqPEfeH7DA8ShqjrgPUtm5SUSu4Dpr/8/9kb1ebapO6haazCSw5O+fRXJtruE 16oYt5THoPD8Ag5p6I2w3/Mnd11PZzvYb5MaVZUQPO4esfXuZbbRdbub3glbH+GbhHCS vu6fZZgcc6FlUO3RNV0quqGZrbu9sYsudaq/ETLp8MuPTCM0beC8ubfvPE4PlPTaMqRU y7WI8WXcc45nsjFarJwXGwaTnRB/PKzSALDwyINjdTmlcAT49cx+/tn89CZpyb0SGSlI 53rccwjNef3k6fbJIqWgUKHFT5LmgAVuIn91vFli4fMCY9aLfE34zx3BQslMeQJPXN6x kOUw== X-Received: by 10.220.149.82 with SMTP id s18mr9088185vcv.14.1362466747920; Mon, 04 Mar 2013 22:59:07 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp96912veb; Mon, 4 Mar 2013 22:59:07 -0800 (PST) X-Received: by 10.205.134.3 with SMTP id ia3mr8543295bkc.92.1362466746779; Mon, 04 Mar 2013 22:59:06 -0800 (PST) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id hu1si6517194bkc.286.2013.03.04.22.59.06; Mon, 04 Mar 2013 22:59:06 -0800 (PST) Received-SPF: neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) client-ip=91.189.95.16; Authentication-Results: mx.google.com; spf=neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) smtp.mail=linaro-mm-sig-bounces@lists.linaro.org Received: from localhost ([127.0.0.1] helo=mombin.canonical.com) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1UClq5-0004EV-8z; Tue, 05 Mar 2013 06:59:05 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1UClq3-0004EQ-PW for linaro-mm-sig@lists.linaro.org; Tue, 05 Mar 2013 06:59:04 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MJ6003GFE1TOQR0@mailout3.samsung.com> for linaro-mm-sig@lists.linaro.org; Tue, 05 Mar 2013 15:58:46 +0900 (KST) X-AuditID: cbfee61b-b7fb06d000000f28-f1-513597a59407 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id AD.E3.03880.5A795315; Tue, 05 Mar 2013 15:58:46 +0900 (KST) Received: from localhost.localdomain ([106.116.147.30]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MJ600A49E14LIB0@mmp2.samsung.com>; Tue, 05 Mar 2013 15:58:45 +0900 (KST) From: Marek Szyprowski To: linux-mm@kvack.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org Date: Tue, 05 Mar 2013 07:57:59 +0100 Message-id: <1362466679-17111-6-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1362466679-17111-1-git-send-email-m.szyprowski@samsung.com> References: <1362466679-17111-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDLMWRmVeSWpSXmKPExsVy+t9jQd1l000DDbruM1vMWb+GzeLvpGPs FhtnrGe1ONv0ht3iy5WHTBaXd81hs7i35j+rxdojd9ktfh/sZLdYcLyF1WLZ1/fsDtwev39N YvTo3fuV1WPTqk42j02fJrF7nJjxm8Xj9r/HzB7r/rxi8ujbsorR4/MmuQDOKC6blNSczLLU In27BK6MTTP3Mxd0c1cs/H2TqYFxOmcXIyeHhICJxInFTcwQtpjEhXvr2boYuTiEBKYzSpx9 8pMVwmlnkthx8CQLSBWbgKFE19suNhBbRCBM4k/jNrAiZoHjTBJ/Lq4FSwgL5Ei0b/gG1sAi oCrxceJJsBW8Ah4SvZOWAdVwAK1TkJgzyQYkzCngKfFk+UewciGgknnbPjNNYORdwMiwilE0 tSC5oDgpPddIrzgxt7g0L10vOT93EyM4TJ9J72Bc1WBxiFGAg1GJh5fhqEmgEGtiWXFl7iFG CQ5mJRFesTrTQCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8jKeeBAgJpCeWpGanphakFsFkmTg4 pRoYSzLfZ9nudXz3hc/uRZOv/AyHczlBahOn/JL966LjPW217VQNrR/sSw9VStUpm3Fdbq70 FL2fuPnYxJYZAW+X1i+NnmH05v5i/fdCm36U8+1L4X4+t6ZG++abBs05dt/faK4+8anpxrLo s5kl6cGOzIzHnSSVor73CNmsm3xMKKD3h7zFpy8dSizFGYmGWsxFxYkAWIRx2k8CAAA= Cc: Arnd Bergmann , Bartlomiej Zolnierkiewicz , Mel Gorman , Michal Nazarewicz , Minchan Kim , Kyungmin Park , Andrew Morton Subject: [Linaro-mm-sig] [RFC/PATCH 5/5] media: vb2: use FOLL_DURABLE and __get_user_pages() to avoid CMA migration issues X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Unified memory management interest group." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linaro-mm-sig-bounces@lists.linaro.org Errors-To: linaro-mm-sig-bounces@lists.linaro.org X-Gm-Message-State: ALoCoQkB85o+odnwCIwoIeo3BDh1e29VbKhPjfDdPtC1yDYzH5wgvj+jVt8h1duZIJJB6zIVhSlq V4L2 devices usually grab additional references to user pages for a very long period of time, what causes permanent migration failures if the given page has been allocated from CMA pageblock. By setting FOLL_DURABLE flag, videobuf2 will instruct __get_user_pages() to migrate user pages out of CMA pageblocks before blocking them with an additional reference. Signed-off-by: Marek Szyprowski Signed-off-by: Kyungmin Park --- drivers/media/v4l2-core/videobuf2-dma-contig.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index 10beaee..70649ab 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c @@ -443,9 +443,13 @@ static int vb2_dc_get_user_pages(unsigned long start, struct page **pages, } } else { int n; + int flags = FOLL_TOUCH | FOLL_GET | FOLL_FORCE | FOLL_DURABLE; - n = get_user_pages(current, current->mm, start & PAGE_MASK, - n_pages, write, 1, pages, NULL); + if (write) + flags |= FOLL_WRITE; + + n = __get_user_pages(current, current->mm, start & PAGE_MASK, + n_pages, flags, pages, NULL, NULL); /* negative error means that no page was pinned */ n = max(n, 0); if (n != n_pages) {