*参照元 [#p6b94a10] #backlinks *説明 [#u99e1171] -パス: 複数あり --版: [[linux-2.6.33/include/linux/mm.h]] --版: [[linux-2.6.33/include/linux/mm.h]] --版: [[linux-2.6.33/mm/highmem.c]] -FIXME: これは何? --説明 -関連する関数 --[[linux-2.6.33/page_address()]] --[[linux-2.6.33/set_page_address()]] --[[linux-2.6.33/page_address_init()]] **引数 [#m09eee55] -struct page *page -- --[[linux-2.6.33/page]] -void *virtual -- **返り値 [#ke15b896] -なし **参考 [#keb59fa2] *実装 [#y94cbf29] **版 [#f525c982] #if defined(WANT_PAGE_VIRTUAL) - --[[linux-2.6.33/WANT_PAGE_VIRTUAL]] (略) #define set_page_address(page, address) \ do { \ (page)->virtual = (address); \ } while(0) (略) #endif **版 [#xb71430b] - include/linux/mm.h の宣言部分 #if defined(HASHED_PAGE_VIRTUAL) (略) void set_page_address(struct page *page, void *virtual); (略) #endif --[[linux-2.6.33/HASHED_PAGE_VIRTUAL]] /** * set_page_address - set a page's virtual address * @page: &struct page to set * @virtual: virtual address to use */ void set_page_address(struct page *page, void *virtual) { unsigned long flags; struct page_address_slot *pas; struct page_address_map *pam; - --[[linux-2.6.33/page_address_slot]] - --[[linux-2.6.33/page_address_map]] BUG_ON(!PageHighMem(page)); - --[[linux-2.6.33/BUG_ON()]] - --[[linux-2.6.33/PageHighMem()]] pas = page_slot(page); - --[[linux-2.6.33/page_slot()]] if (virtual) { /* Add */ BUG_ON(list_empty(&page_address_pool)); - --[[linux-2.6.33/list_empty()]] - --[[linux-2.6.33/page_address_pool(global)]] spin_lock_irqsave(&pool_lock, flags); - --[[linux-2.6.33/spin_lock_irqsave()]] - --[[linux-2.6.33/pool_lock(global)]] pam = list_entry(page_address_pool.next, struct page_address_map, list); list_del(&pam->list); spin_unlock_irqrestore(&pool_lock, flags); - --[[linux-2.6.33/list_entry()]] - --[[linux-2.6.33/list_del()]] - --[[linux-2.6.33/spin_unlock_irqrestore()]] pam->page = page; pam->virtual = virtual; spin_lock_irqsave(&pas->lock, flags); list_add_tail(&pam->list, &pas->lh); spin_unlock_irqrestore(&pas->lock, flags); - --[[linux-2.6.33/list_add_tail()]] } else { /* Remove */ spin_lock_irqsave(&pas->lock, flags); list_for_each_entry(pam, &pas->lh, list) { - --[[linux-2.6.33/list_for_each_entry()]] if (pam->page == page) { list_del(&pam->list); spin_unlock_irqrestore(&pas->lock, flags); spin_lock_irqsave(&pool_lock, flags); list_add_tail(&pam->list, &page_address_pool); spin_unlock_irqrestore(&pool_lock, flags); goto done; } } spin_unlock_irqrestore(&pas->lock, flags); } done: return; } **版 [#b2f70abc] #if !defined(HASHED_PAGE_VIRTUAL) && !defined(WANT_PAGE_VIRTUAL) - (略) #define set_page_address(page, address) do { } while(0) (略) #endif *コメント [#d5bd13be]