[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Does get_user_pages() lock the pages?



Hi Boris
For each page I get the information that it is not locked. I also looked
at the source code of get_user_pages() (Kernel 2.6.18) and couldn't find
any code that seems to lock the pages, but I'm not familiar with the
code, so maybe I'm mistaken.

So, does get_user_pages() lock the pages?

I also did fast code review....and I also found no indication of page locking functions inside get_user_pages() (or at least 2-3 function call deep ). However, I saw this in prep_new_page() (mm/page_alloc.c):
if (unlikely(page_mapcount(page) |
(page->mapping != NULL) |
(page_count(page) != 0) |
(page->flags & (
1 << PG_lru |
1 << PG_private |
1 << PG_locked
....


Here's my cscope's stack when traversing these frustating call chain:
1 1 __handle_mm_fault 1064 mm/memory.c
2 1 handle_pte_fault 2474 mm/memory.c
3 1 do_anonymous_page 2405 mm/memory.c
4 1 do_anonymous_page 2405 mm/memory.c
5 1 do_anonymous_page 2405 mm/memory.c
6 1 alloc_zeroed_user_highpage 2097 mm/memory.c
7 1 alloc_page_vma 38 include/asm-i386/page.h
8 1 alloc_page_vma 0 mm/mempolicy.c
9 1 alloc_page_vma 0 mm/mempolicy.c
10 1 alloc_page_vma 38 include/asm-i386/page.h
11 1 alloc_pages 156 include/linux/gfp.h
12 1 alloc_pages_current 149 include/linux/gfp.h
13 1 __alloc_pages 1305 mm/mempolicy.c
14 1 get_page_from_freelist 1283 page = get_page_from_freelist(gfp_mask, order, zo
15 1 buffered_rmqueue 1186 page = buffered_rmqueue(zonelist, zone, order, gf
16 1 prep_new_page 881 if (prep_new_page(page, order, gfp_flags))


__handle_mm_fault() itself is called inside get_user_pages(). So, there is a chance, somewhere in these long chain, the lock bit is unset.


regards,


Mulyadi


-- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ