All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Cc: Inki Dae <inki.dae@samsung.com>,
	'Jerome Glisse' <j.glisse@gmail.com>,
	airlied@linux.ie, dri-devel@lists.freedesktop.org,
	kyungmin.park@samsung.com, sw0312.kim@samsung.com,
	linux-mm@kvack.org
Subject: Re: [PATCH 2/2 v3] drm/exynos: added userptr feature.
Date: Thu, 10 May 2012 16:27:23 +0900	[thread overview]
Message-ID: <4FAB6DDB.7020504@kernel.org> (raw)
In-Reply-To: <4FAB65D7.6080003@gmail.com>

On 05/10/2012 03:53 PM, KOSAKI Motohiro wrote:

> (5/10/12 12:58 AM), Minchan Kim wrote:
>> On 05/10/2012 10:39 AM, Inki Dae wrote:
>>
>>> Hi Jerome,
>>>
>>>> -----Original Message-----
>>>> From: Jerome Glisse [mailto:j.glisse@gmail.com]
>>>> Sent: Wednesday, May 09, 2012 11:46 PM
>>>> To: Inki Dae
>>>> Cc: airlied@linux.ie; dri-devel@lists.freedesktop.org;
>>>> kyungmin.park@samsung.com; sw0312.kim@samsung.com; linux-mm@kvack.org
>>>> Subject: Re: [PATCH 2/2 v3] drm/exynos: added userptr feature.
>>>>
>>>> On Wed, May 9, 2012 at 2:17 AM, Inki Dae<inki.dae@samsung.com>  wrote:
>>>>> this feature is used to import user space region allocated by malloc()
>>>> or
>>>>> mmaped into a gem. and to guarantee the pages to user space not to be
>>>>> swapped out, the VMAs within the user space would be locked and then
>>>> unlocked
>>>>> when the pages are released.
>>>>>
>>>>> but this lock might result in significant degradation of system
>>>> performance
>>>>> because the pages couldn't be swapped out so we limit user-desired
>>>> userptr
>>>>> size to pre-defined.
>>>>>
>>>>> Signed-off-by: Inki Dae<inki.dae@samsung.com>
>>>>> Signed-off-by: Kyungmin Park<kyungmin.park@samsung.com>
>>>>
>>>>
>>>> Again i would like feedback from mm people (adding cc). I am not sure
>>>
>>> Thank you, I missed adding mm as cc.
>>>
>>>> locking the vma is the right anwser as i said in my previous mail,
>>>> userspace can munlock it in your back, maybe VM_RESERVED is better.
>>>
>>> I know that with VM_RESERVED flag, also we can avoid the pages from
>>> being
>>> swapped out. but these pages should be unlocked anytime we want
>>> because we
>>> could allocate all pages on system and lock them, which in turn, it may
>>> result in significant deterioration of system performance.(maybe other
>>> processes requesting free memory would be blocked) so I used
>>> VM_LOCKED flags
>>> instead. but I'm not sure this way is best also.
>>>
>>>> Anyway even not considering that you don't check at all that process
>>>> don't go over the limit of locked page see mm/mlock.c RLIMIT_MEMLOCK
>>>
>>> Thank you for your advices.
>>>
>>>> for how it's done. Also you mlock complete vma but the userptr you get
>>>> might be inside say 16M vma and you only care about 1M of userptr, if
>>>> you mark the whole vma as locked than anytime a new page is fault in
>>>> the vma else where than in the buffer you are interested then it got
>>>> allocated for ever until the gem buffer is destroy, i am not sure of
>>>> what happen to the vma on next malloc if it grows or not (i would
>>>> think it won't grow at it would have different flags than new
>>>> anonymous memory).
>>
>>
>> I don't know history in detail because you didn't have sent full
>> patches to linux-mm and
>> I didn't read the below code, either.
>> Just read your description and reply of Jerome. Apparently, there is
>> something I missed.
>>
>> Your goal is to avoid swap out some user pages which is used in kernel
>> at the same time. Right?
>> Let's use get_user_pages. Is there any issue you can't use it?
> 
> Maybe because get_user_pages() is fork unsafe? dunno.


If there is such problem, I think user program should handle it by MADV_DONTFORK 
and make to allow write by only parent process.

-- 
Kind regards,
Minchan Kim

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2012-05-10  7:27 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-23 13:43 [PATCH 0/4] updated exynos-drm-next Inki Dae
2012-04-23 13:43 ` [PATCH 1/4] drm/exynos: added cache attribute support for gem Inki Dae
2012-04-23 13:43 ` [PATCH 2/4] drm/exynos: added drm prime feature Inki Dae
2012-04-23 13:43 ` [PATCH 3/4] drm/exynos: added userptr feature Inki Dae
2012-04-24  5:17   ` [PATCH v2 " Inki Dae
2012-04-25 10:15     ` Dave Airlie
2012-04-25 12:46       ` InKi Dae
2012-05-05 10:19       ` daeinki
2012-05-05 10:22         ` Dave Airlie
2012-05-07 18:18           ` Jerome Glisse
2012-05-08  7:59             ` Inki Dae
2012-05-08 15:05               ` Jerome Glisse
2012-05-08  6:48           ` Inki Dae
2012-05-09  6:17   ` [PATCH 0/2 v3] " Inki Dae
2012-05-09  6:17     ` [PATCH 1/2 v3] drm/exynos: added userptr limit ioctl Inki Dae
2012-05-09  6:17     ` [PATCH 2/2 v3] drm/exynos: added userptr feature Inki Dae
2012-05-09 14:45       ` Jerome Glisse
2012-05-09 18:32         ` Jerome Glisse
2012-05-10  2:44           ` Inki Dae
2012-05-10 15:05             ` Jerome Glisse
2012-05-10 15:31               ` Daniel Vetter
2012-05-10 15:31                 ` Daniel Vetter
2012-05-10 15:52                 ` Jerome Glisse
2012-05-11  1:47                   ` Inki Dae
2012-05-11  2:08                     ` Minchan Kim
2012-05-10  1:39         ` Inki Dae
2012-05-10  4:58           ` Minchan Kim
2012-05-10  6:53             ` KOSAKI Motohiro
2012-05-10  7:27               ` Minchan Kim [this message]
2012-05-10  7:31                 ` Kyungmin Park
2012-05-10  7:56                   ` Minchan Kim
2012-05-10  7:58                     ` Minchan Kim
2012-05-10  6:57             ` Inki Dae
2012-05-10  7:05               ` Minchan Kim
2012-05-10  7:59                 ` InKi Dae
2012-05-10  8:11                   ` Minchan Kim
2012-05-10  8:44                     ` Inki Dae
2012-05-10 17:53                       ` KOSAKI Motohiro
2012-05-11  0:50                         ` Minchan Kim
2012-05-11  2:51                           ` KOSAKI Motohiro
2012-05-11  3:01                             ` Jerome Glisse
2012-05-11 21:20                               ` KOSAKI Motohiro
2012-05-11 22:22                                 ` Jerome Glisse
2012-05-11 22:59                                   ` KOSAKI Motohiro
2012-05-11 22:59                                     ` KOSAKI Motohiro
2012-05-11 23:29                                     ` Jerome Glisse
2012-05-11 23:39                                       ` KOSAKI Motohiro
2012-05-12  4:48                                         ` InKi Dae
2012-05-14  4:29                                           ` Minchan Kim
2012-05-14  4:29                                             ` Minchan Kim
2012-05-14  6:17     ` [PATCH 0/2 v4] " Inki Dae
2012-05-14  6:17       ` [PATCH 1/2 v4] drm/exynos: added userptr limit ioctl Inki Dae
2012-05-14  8:12         ` Inki Dae
2012-05-14  6:17       ` [PATCH 2/2 v4] drm/exynos: added userptr feature Inki Dae
2012-05-14  6:33         ` KOSAKI Motohiro
2012-05-14  6:52           ` Inki Dae
2012-05-14  7:04             ` KOSAKI Motohiro
2012-05-14  7:21               ` Inki Dae
2012-05-14  8:13               ` Inki Dae
2012-05-14 19:26         ` Jerome Glisse
2012-05-15  4:33           ` Inki Dae
2012-05-15 14:31             ` Jerome Glisse
2012-05-16  8:49               ` Inki Dae
2012-05-14  8:12       ` [PATCH 0/2 " Inki Dae
2012-05-15  7:34   ` [PATCH 3/4] " Rob Clark
2012-05-15  8:17     ` Inki Dae
2012-05-15  9:35       ` Rob Clark
2012-05-15 13:40         ` InKi Dae
2012-05-15 14:28           ` Rob Clark
2012-05-16  6:04             ` Inki Dae
2012-05-16  8:42               ` Rob Clark
2012-05-16 10:30                 ` Inki Dae
2012-05-16  9:22     ` Dave Airlie
2012-05-16 10:20       ` Inki Dae
2012-05-16 12:12         ` Rob Clark
2012-05-16 13:27           ` Inki Dae
2012-04-23 13:43 ` [PATCH 4/4] drm/exynos: added a feature to get gem buffer information Inki Dae

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FAB6DDB.7020504@kernel.org \
    --to=minchan@kernel.org \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=inki.dae@samsung.com \
    --cc=j.glisse@gmail.com \
    --cc=kosaki.motohiro@gmail.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-mm@kvack.org \
    --cc=sw0312.kim@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.