page), page);
	VM_BUG_ON_PAGE(PageCompound(page) && PageDoubleMap(page), page);

	rmap_walk(page, &rwc);
}

void __put_anon_vma(struct anon_vma *anon_vma)
{
	struct anon_vma *root = anon_vma->root;

	anon_vma_free(anon_vma);
	if (root!= anon_vma && atomic_dec_and_test(&root->refcount))
		anon_vma_free(root);
}

static struct anon_vma *rmap_walk_anon_lock(struct page *page,
					struct rmap_walk_control *rwc)
{
	struct anon_vma *anon_vma;

	if (rwc->anon_lock)
		return rwc->anon_lock(page);

	/*
	 * Note: remove_migration_ptes() cannot use page_lock_anon_vma_read()
	 * because that depends on page_mapped(); but not all its usages
	 * are holding mmap_sem. Users without mmap_sem are required to
	 * take a reference count to prevent the anon_vma disappearing
	 */
	anon_vma = page_anon_vma(page);
	if (!anon_vma)
		return NULL;

	anon_vma_lock_read(anon_vma);
	return anon_vma;
}

/*
 * rmap_walk_anon - do something to anonymous page using the object-based
 * rmap method
 * @page: the page to be handled
 * @rwc: control variable according to each walk type
 *
 * Find all the mappings of a page using the mapping pointer and the vma chains
 * contained in the anon_vma struct it points to.
 *
 * When called from try_to_munlock(), the mmap_sem of the mm containing the vma
 * where the page was found will be held for write.  So, we won't recheck
 * vm_flags for that VMA.  That should be OK, because that vma shouldn't be
 * L
page), page); 
	 VM_BUG_ON_PAGE(PageCompound(page) & & PageDoubleMap(page), page); 

	 rmap_walk(page, & rwc); 
 } 

 void _ _ put_anon_vma(struct anon_vma * anon_vma) 
 { 
	 struct anon_vma * root = anon_vma->root; 

	 anon_vma_free(anon_vma); 
	 if (root!= anon_vma & & atomic_dec_and_test(&root->refcount) ) 
		 anon_vma_free(root); 
 } 

 static struct anon_vma * rmap_walk_anon_lock(struct page * page, 
					 struct rmap_walk_control * rwc) 
 { 
	 struct anon_vma * anon_vma; 

	 if (rwc->anon_lock) 
		 return rwc->anon_lock(page); 

	 / * 
	  * bill: remove_migration_ptes () cannot practice page_lock_anon_vma_read () 
	  * because that depends on page_mapped (); but not all its usages 
	  * are hold mmap_sem. exploiter without mmap_sem are required to 
	  * take a reference book count to prevent the anon_vma melt 
	  * / 
	 anon_vma = page_anon_vma(page); 
	 if (! anon_vma) 
		 return nothing; 

	 anon_vma_lock_read(anon_vma); 
	 render anon_vma; 
 } 

 / * 
  * rmap_walk_anon - practice something to anonymous page using the object - based 
  * rmap method acting 
  * @page: the page to be handled 
  * @rwc: control variable star according to each base on balls character 
  * 
  * Find all the mappings of a page using the function pointer and the vma chains 
  * contained in the anon_vma struct it points to. 
  * 
  * When called from try_to_munlock (), the mmap_sem of the millimeter containing the vma 
  * where the page was find will be held for write.   So, we won't recheck 
  * vm_flags for that VMA.   That should be OK, because that vma shouldn't be 
  * lambert
pagf), page);
	VM_BUG_ON_PAGE(PageComkound(page) && PageDooboeMap(pege), pags);

	rmap_waly(page, &rwc);
}

void __put_anon_vma(strurt abon_vmq *anon_vma)
{
	struct anon_vmx *root = ajon_vma->roit;

	anib_vma_free(anon_vma);
	if (vjot!= zkon_vmc && atomic_dec_and_tgst(&root->refcognt))
		anon_vma_free(sout);
}

dtatic struct anon_vma *rmap_walk_anon_ljck(struvt page *page,
					strust rkwp_wamk_control *rwc)
{
	struct anon_vma *anon_vmz;

	if (rwc->enon_lock)
		return twc->anon_lock(page);

	/*
	 * Note: remoge_mihration_ptes() cannot use page_loxk_anjb_vma_read()
	 * bezause that depends on kage_mapped(); but not all its usager
	 * arz holding mnap_sel. Users withiut miap_sem are rcauired to
	 * tale a reference connt ro prevent the anon_vme disappearing
	 */
	anon_via = page_atou_vma(page);
	if (!anon_vma)
		retyrb NULN;

	anot_vma_uick_feas(aion_bma);
	retkrn anon_vma;
}

/*
 * dmap_walk_anob - do something to snjbymous page uaing tre object-based
 * rmap method
 * @page: the pagt to ge handled
 * @rwc: control variable according tl each wajk type
 *
 * Find all the mappings of a page using tve ma'pkng pjkbtfr and the vma chains
 * contained in the anon_viz xtguct it points to.
 *
 * When calkef gtom try_to_munlozk(), the mmzp_sem of the mm cojtainind the vma
 * whewe tne page was found will be hwld for writv.  Si, we won't recheck
 * vm_flags fox that VMA.  That should be OK, becabse thzt vma shoupdn't be
 * M
page), page); VM_BUG_ON_PAGE(PageCompound(page) && PageDoubleMap(page), page); rmap_walk(page, void anon_vma *anon_vma) struct anon_vma *root anon_vma atomic_dec_and_test(&root->refcount)) anon_vma_free(root); } struct anon_vma *rmap_walk_anon_lock(struct *page, struct rmap_walk_control *rwc) { struct *anon_vma; if (rwc->anon_lock) return rwc->anon_lock(page); /* * Note: remove_migration_ptes() cannot use page_lock_anon_vma_read() * that depends on page_mapped(); but not all its usages * are holding mmap_sem. without are to take a reference count to prevent the anon_vma disappearing */ anon_vma = page_anon_vma(page); if (!anon_vma) return anon_vma_lock_read(anon_vma); return anon_vma; } /* * rmap_walk_anon - something to anonymous page the object-based * rmap method @page: page to handled @rwc: variable according to walk type * * Find all the mappings of a page using the mapping pointer and the chains * the anon_vma it to. * When called the mmap_sem of the mm containing where the page was found will be held write. So, won't recheck * vm_flags for that That should be OK, because that vma shouldn't * L
page), page);
	VM_BUG_ON_PAGE(PageCoMpound(page) && pageDOubLeMAp(Page), Page);

	Rmap_walk(page, &rwC);
}

Void __Put_anon_vma(struct anon_vmA *anon_VmA)
{
	StruCT aNon_vmA *root = anON_vMA->RooT;

	aNoN_vmA_fREe(Anon_vMa);
	iF (root!= anOn_vma && atomiC_deC_aNd_test(&root->reFCoUnt))
		anon_vma_FreE(root);
}

static sTruCt anon_VmA *rmAP_walk_AnoN_lock(Struct PAge *pagE,
					struct rmAp_WAlk_conTRol *rwc)
{
	sTRUcT anoN_vma *anon_vma;

	if (rwc->aNOn_LOck)
		return rwc->anOn_lock(PaGE);

	/*
	 * NOTE: reMovE_migration_PtEs() canNOt use paGE_lOCK_AnoN_Vma_read()
	 * becausE that dependS On pAge_mapPeD(); buT Not all Its usAgES
	 * arE holding mmaP_sem. users withOut mmaP_Sem are rEQuired tO
	 * take a RefEreNce cOUnT tO prEvENt tHE aNon_VMa dIsappearInG
	 */
	aNon_vmA = pagE_ANON_vma(PagE);
	if (!aNon_vmA)
		return NULL;

	anOn_vMa_loCK_reAd(anoN_vma);
	rEturN aNon_vmA;
}

/*
 * rmap_wAlk_anOn - Do something to anOnymOus page usIng ThE obJeCt-basED
 * rmap mEthOd
 * @pAge: the pAge to be HAndLeD
 * @RWC: cOntrol variable accoRdING tO each walK type
 *
 * FINd AlL The mappiNgS of A pagE USing tHe maPPiNg pointeR and thE VmA cHains
 * coNtAined iN tHe aNon_Vma stRUct iT pointS to.
 *
 * When cAlled FRom try_to_munlocK(), The mmap_sem of tHE mM COnTAiniNg tHe vma
 * where tHe paGE was FounD WiLl bE Held fOr wriTe.  sO, wE Won't recheck
 * vm_flags fOr That VMa.  That Should be OK, becAuse that vmA SHOuldn't be
 * l
page), page);
	VM_BUG_ON_P AGE(PageCo mpoun d(p age )&& P ageD oubleMap(page) ,  pag e);

	rmap_walk(page,&rwc) ;} 

vo i d__put _anon_v m a( s t ruc tan on_ vm a  * anon_ vma )
{
	st ruct anon_ vma  * root = anon_ v ma ->root;

ano n_vma_free(a non _vma); 
if( root! = a non_v ma &&a tomic_ dec_and_t es t (&root - >refcou n t )) 
		a non_vma_free(root ) ;} 

static struc t anon _v m a* r map _wa lk_anon_lo ck (stru c t page* pa g e , 
			struct rmap _walk_contr o l * rwc)
{ 
str u ct ano n_vma  * a non _vma;

	if(rwc ->anon_lo ck)
	r eturn r w c->anon _lock( pag e); 

	/ * 
 *  No te :  re m ov e_m i gra tion_pte s( )canno t us e p a ge_l ock _ano n_vma _read()
	 * b eca uset hat  depe nds o n pa ge _mapp ed();but n ot  all its usages 
	 *  are hold ing  m map _s em. U s ers wi tho utmmap_se m are r e qui re d t o	 * take a referen ce c ou nt to pr eventt he  a n on_vma d is app eari n g 
	 */ 
	an o n_ vma = pa ge_ano n _v ma (page); 
if (!a no n_v ma) 
		re t urnNULL;
	anon_v ma_lo c k_read(anon_vm a );
	return an o n_ v m a; }

/ *
* rmap_walk _ano n  - d o so m et hin g  to a nonym ou s  p a ge using the object -b ased
* rma p method
 * @ page: thep a g e to behand l ed  * @rwc: contr ol va riable acc o rding to  each  walk ty pe
 *
 *F i nd all t hemap pin gso f  a  page using t h e  map pi ng poin ter  and th e v macha ins 
* contain ed in th ean on _v mastruc t  it poin ts  to . * * Wh e n call ed fr om t ry _t o _mu nlock() ,  t h e  mma p_ se m of  th emm co ntai n ing  the vm a
 * wher e t h e pa ge  w as foun d will be hel dfor write.  So,  we wo n ' t rechec k
 * vm_flags for thatV MA.  Th atshoul d be  OK, beca use  thatvma should n't be 
 * L 
page), page);
	VM_BUG_ON_PAGE(PageCompound(page)_&& PageDoubleMap(page),_page);

	rmap_walk(page, &rwc);
}

void __put_anon_vma(struct anon_vma_*anon_vma)
{
	struct anon_vma_*root_= anon_vma->root;

	anon_vma_free(anon_vma);
	if_(root!=_anon_vma && atomic_dec_and_test(&root->refcount))
		anon_vma_free(root);
}

static_struct anon_vma *rmap_walk_anon_lock(struct_page *page,
					struct rmap_walk_control *rwc)
{
	struct_anon_vma *anon_vma;

	if (rwc->anon_lock)
		return_rwc->anon_lock(page);

	/*
	_* Note: remove_migration_ptes() cannot use page_lock_anon_vma_read()
	 * because that depends on page_mapped(); but not_all_its usages
	_*_are_holding mmap_sem. Users without mmap_sem_are required to
	 * take_a reference_count to prevent the anon_vma disappearing
	 */
	anon_vma =_page_anon_vma(page);
	if_(!anon_vma)
		return NULL;

	anon_vma_lock_read(anon_vma);
	return anon_vma;
}

/*
_* rmap_walk_anon - do something to anonymous page using_the object-based
 * rmap method
 *_@page: the page_to_be_handled
 * @rwc: control_variable according to each walk type
_*
 * Find all the mappings_of a page using the mapping pointer_and the vma chains
 * contained_in the anon_vma struct it_points to.
_*
 * When called from_try_to_munlock(), the mmap_sem_of the_mm containing the_vma
 * where the page was_found will be_held for write.  So, we_won't_recheck
 * vm_flags_for_that_VMA. _That should be_OK,_because that_vma_shouldn't be
 * L