*参照元 [#m5c7c71d]
#backlinks

*説明 [#q1eeaca6]
-パス: [[linux-4.4.1/mm/mempolicy.c]]

-FIXME: これは何?
--説明


**引数 [#s1ae6f1e]
-gfp_t gfp
--
--[[linux-4.4.1/gfp_t]]
-unsigned order
--


**返り値 [#a3d8f19e]
-struct page *
--
--[[linux-4.4.1/page]]


**参考 [#cf893187]


*実装 [#v2d71090]
 /**
  *      alloc_pages_current - Allocate pages.
  *
  *      @gfp:
  *              %GFP_USER   user allocation,
  *              %GFP_KERNEL kernel allocation,
  *              %GFP_HIGHMEM highmem allocation,
  *              %GFP_FS     don't call back into a file system.
  *              %GFP_ATOMIC don't sleep.
  *      @order: Power of two of allocation size in pages. 0 is a single page.
  *
  *      Allocate a page from the kernel page pool.  When not in
  *      interrupt context and apply the current process NUMA policy.
  *      Returns NULL when no page can be allocated.
  *
  *      Don't call cpuset_update_task_memory_state() unless
  *      1) it's ok to take cpuset_sem (can WAIT), and
  *      2) allocating for current task (not interrupt).
  */
 struct page *alloc_pages_current(gfp_t gfp, unsigned order)
 {
         struct mempolicy *pol = &default_policy;
         struct page *page;
         unsigned int cpuset_mems_cookie;
 
-
--[[linux-4.4.1/mempolicy]]
--[[linux-4.4.1/default_policy(global)]]
--[[linux-4.4.1/page]]

         if (!in_interrupt() && !(gfp & __GFP_THISNODE))
                 pol = get_task_policy(current);
 
-
--[[linux-4.4.1/in_interrupt()]]
--[[linux-4.4.1/get_task_policy()]]
--[[linux-4.4.1/__GFP_THISNODE]]

 retry_cpuset:
         cpuset_mems_cookie = read_mems_allowed_begin();
 
-
--[[linux-4.4.1/read_mems_allowed_begin()]]

         /*
          * No reference counting needed for current->mempolicy
          * nor system default_policy
          */
         if (pol->mode == MPOL_INTERLEAVE)
                 page = alloc_page_interleave(gfp, order, interleave_nodes(pol));
-
--[[linux-4.4.1/alloc_page_interleave()]]
--[[linux-4.4.1/interleave_nodes()]]

         else
                 page = __alloc_pages_nodemask(gfp, order,
                                 policy_zonelist(gfp, pol, numa_node_id()),
                                 policy_nodemask(gfp, pol));
 
-
--[[linux-4.4.1/__alloc_pages_nodemask()]]
--[[linux-4.4.1/policy_zonelist()]]
--[[linux-4.4.1/numa_node_id()]]
--[[linux-4.4.1/policy_nodemask()]]

         if (unlikely(!page && read_mems_allowed_retry(cpuset_mems_cookie)))
                 goto retry_cpuset;
 
-
--[[linux-4.4.1/read_mems_allowed_retry()]]

         return page;
 }
 EXPORT_SYMBOL(alloc_pages_current);
-
--[[linux-4.4.1/EXPORT_SYMBOL()]]


*コメント [#h9a54f48]

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS