linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Does get_user_pages_fast lock the user pages in memory in my case?
@ 2009-04-17  7:01 Huang Shijie
  2009-04-18  6:18 ` KOSAKI Motohiro
  2009-04-19 23:45 ` Minchan Kim
  0 siblings, 2 replies; 25+ messages in thread
From: Huang Shijie @ 2009-04-17  7:01 UTC (permalink / raw)
  To: linux-mm


   I'm writting a driver for a video card with the V4L2 interface .
   V4L2 interface supports the USER-POINTER method for the video frame 
handling.

   VLC player supports the USER-POINTER method,while MPALYER does not.

   In the USER-POINTER method, VLC will call the posix_memalign() to 
allocate
203 pages in certain PAL mode (that is 720*576*2) for a single frame.
   In my driver , I call the get_user_pages_fast() to obtain the pages 
array,and then call
the vmap() to map the pages to VMALLOC space for the memcpy().The code 
shows below:
   ....................
   get_user_pages_fast();
   ...
   f->data = vmap();
   .......................

   In comments, it said :
"
+/**
+ * get_user_pages_fast() - pin user pages in memory
+ * @start:     starting user address
+ * @nr_pages:  number of pages from start to pin
+ * @write:     whether pages will be written to
+ * @pages:     array that receives pointers to the pages pinned.
+ *             Should be at least nr_pages long.
"

   But after I digged the code of kswap and the get_user_pages(called by 
get_user_pages_fast),
I did not find how the pages pinned in memory.I really need the pages 
pinned in memory.

   Assume page A is one of the pages obtained by get_user_pages_fast() 
during page-fault.

[1] page A will on the LRU_ACTIVE_ANON list;
   the _count of page A increment by one;
   PTE for page A will be set ACCESSED.

[2] kswapd will scan the lru list,and move page A from LRU_ACTIVE_ANON  
to LRU_INACTIVE_ANON.
   In the shrink_page_list(), there is nothing can stop page A been 
swapped out.
   I don't think the page_reference() can move page A back to 
LRU_ACTIVE_ANON.In my driver,
   I am not sure if the VLC can access the page A.

   Is this a bug? or I miss something?
   Thanks .


 






 

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2009-04-22  9:46 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-17  7:01 Does get_user_pages_fast lock the user pages in memory in my case? Huang Shijie
2009-04-18  6:18 ` KOSAKI Motohiro
2009-04-20  2:22   ` Huang Shijie
2009-04-19 23:45 ` Minchan Kim
2009-04-20  2:15   ` Huang Shijie
2009-04-20  2:42     ` Minchan Kim
2009-04-20  3:28       ` Huang Shijie
2009-04-20  3:42         ` KOSAKI Motohiro
2009-04-20  4:53         ` Minchan Kim
2009-04-20  5:05           ` KOSAKI Motohiro
2009-04-20  5:05           ` Huang Shijie
2009-04-20  5:19             ` KOSAKI Motohiro
2009-04-20  5:37               ` Huang Shijie
2009-04-20  7:59                 ` KOSAKI Motohiro
2009-04-20  8:23                   ` Huang Shijie
2009-04-20  9:24                     ` KOSAKI Motohiro
2009-04-20  9:47                       ` Huang Shijie
2009-04-21  1:43                         ` KOSAKI Motohiro
2009-04-21 19:47                         ` Christoph Lameter
2009-04-20  5:24             ` Minchan Kim
2009-04-20  5:42               ` Huang Shijie
2009-04-20  3:57       ` Huang Shijie
2009-04-22  6:08       ` Huang Shijie
2009-04-22  9:46         ` Minchan Kim
2009-04-20  3:18     ` KOSAKI Motohiro

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).