prepopulate/cache cleared pages
In-Reply-To: <[email protected]>
Quoted 37 lines · Arjan van de Ven
Index:
linux-work/mm/mempolicy.c
===================================================================mm/mempolicy.c +22
-0@@ -1231,6 +1231,13 @@ alloc_page_vma(gfp_t gfp, struct vm_area {struct mempolicy *pol =get_vma_policy (current, vma, addr); +if ( (gfp & __GFP_ZERO) && current->cleared_page) { +struct page *addr; + addr = current->cleared_page; + current->cleared_page =NULL ; +return addr; + } +cpuset_update_task_memory_state ();if (unlikely (pol->policy ==MPOL_INTERLEAVE )) {@@ -1242,6 +1249,36 @@ alloc_page_vma(gfp_t gfp, struct vm_areareturn __alloc_pages (gfp,0 ,zonelist_policy (gfp, pol)); } + +/** +* prepare_cleared_page - populate the per-task zeroed-page cache +* +* This function populates the per-task cache with one zeroed page +* (if there wasn't one already) +* The idea is that this (expensive) clearing is done before any +* locks are taken, speculatively, and that when the page is actually +* needed under a lock, it is ready for immediate use +*/ + +void prepare_cleared_page (void ) +{ +struct mempolicy *pol = current->mempolicy; +
mm/mempolicy.c alloc_page_vma(gfp_t gfp, struct vm_area · line 1276
Quoted 10 lines
mm/mempolicy.c +10
-0+if (current->cleared_page) +return ; + +cpuset_update_task_memory_state (); + +if (!pol) + pol = &default_policy; +if (pol->policy ==MPOL_INTERLEAVE ) + current->cleared_page =alloc_page_interleave ( +GFP_HIGHUSER | __GFP_ZERO,0 ,interleave_nodes (pol));
======> else ???
Quoted 8 lines
mm/mempolicy.c +5
-0+ current->cleared_page =__alloc_pages (GFP_USER | __GFP_ZERO, +0 ,zonelist_policy (GFP_USER , pol)); +} + +/** * alloc_pages_current - Allocate pages. *
Signature · 2 lines
Chuck "Equations are the Devil's sentences." --Stephen Colbert
Quoted 10 lines · Chuck Ebbert
Review
Quoted 3 lines
(quoted diff) +3
-0+ if (pol->policy == MPOL_INTERLEAVE) + current->cleared_page = alloc_page_interleave( + GFP_HIGHUSER | __GFP_ZERO, 0, interleave_nodes(pol));======> else ???
Review
Quoted 4 lines
(quoted diff) +4
-0+ current->cleared_page = __alloc_pages(GFP_USER | __GFP_ZERO, + 0, zonelist_policy(GFP_USER, pol)); +} +
good catch, thanks!