/.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogblamecommitdiffstats
path: root/mm/page_alloc.c
blob: d6b580c660f5137a80431d8cec5f4656963c89f5 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                                            




                            
                          
                          
                           
                           
                         
                            




                          
                            
                      




                           
                                 

                           
                         
                            
                               

                       
                              
                               
                                 
                              
                               
                           
                         
                             
                              
                               
                             
                           
                          
                                   

                         
                      

                     




                                     










                                                                                
  
                        
   












                                                        
                                           
                                               







                                                                     
                             
                                                     
 








                                                                                



                              

                                             



                                                  

 
                               
 
                                             


                                          
 






                                                      

                            



                                        
                                                                   
 






                                                                             


                                                                           
   
                                                   
                      
             
      
                        
             
      
                     
            
      
            
  

                              
 
                                                
                      
               
      
                        
                 
      
                  
                     
                   
      
                   

  

                           

                                                   
                                               
 










                                                                                
 

                                             
                                      
                           
                               

      

                                                  

                                                                         



                                                      



                                                                    

                                       
                      
                                                                             
 


                                              
 








                                                                      



                                                                   
                                                 
                         
                                    









                                                                     
                         


                                            

                 






                                                                 
                                       
 



                                        

                                                 
                                                                 


                       









                                                                        

                                                                               







                                            
                                                                           
                                                  
                        
 
                        
                     
    
                                                                             
                                                         
                                  

 






                                                                               

                                                                          
  


                                                                            
   


                                                 
                                                    

 
                                                               


                                  





                                                         
                                 
                                     



                                     
                                                                   
                                                                        


                                  
                    
 

                                                      
                               

                      
 
                              
 

                                          
 
                                                                        
                                       

                              
                                   
         

                   
 
 



                                                                                



                                                                              
                                                                 



                                          






























                                                                           

                                                               
                                      
                             



                                                    
                               
                                  
















                                                               
                                                               
   
                           
                                                              
 
                                       




                                                              
                                    
                                          

                                                  
  

                                                                              
  
                                                         
   

                                                                          
 
                                                  
                         
 


                                                      




                                                                 
                                                             
                                                  
                         
         
                 














                                                                        
                                                                            
                                                 
                                                                           

                                                               
                                                             
                                                   



         
                                                     

                                                      

                               
                                   
                                                   
                           
 
                                         

                                                                 
 

                                     

                                                              
                                                 
                                         
 
                                     

                                                                
                                                       
                              












                                                                                
                                                    




                                                        








                                                                           
                                                                            
                                                        



                                                                        








                                                                                


                                         






                                                                     


                                                 
 
                                                     
 

                                          
                                                   

                                                          
                               
                         
         


                                                         


  
                                             
                                                                 
                                        






                                                                             

                                                                  
 
                            
                           
                            
 
                               
                                    
                                
 
                         
                                  


                                       




                                                                                

                    
                                     



                                                              
 



                                                                     



                                                                             


                                                                               
                                                                         
         
                                                          
                                 

 

                                                                          
 
                               
                                    
                                
 
                                                        
                                                               
                                 

 
                                                                     
 
              
                    
 
                                        

                                           



                                                  
                
                             
 
                                 
                                                                                


                                                               
                                    
                                              
 










                                                                  
                              
                                 
                                      
                                              

                                                                         
                                 

 
                                                                          
 

                                           
 







                                                 
         


                                  

 














                                                                       
                                                               

                                                  






                                       
                                                        
















                                                                                 
                                                                         


                                                  

 


                                                            
                                                   
 

                                          
                                                    

                                                          
                               
                         
         











                                                                       
 
                                  
                                  

                                     
                                              






                                                       
                 

 



                                                                 

                                                                      
















                                                                                 







                                                                            



                                                               
                                          


                                                                                            

                                                                     

  

                                                                          
                                                                    

                                                                 


                                                                         


                            
                            






                                                                            
                                     




                                                             


                                                                       










                                                           

                                                                          
                                   
                                          

         
                           

 

                                                                     




                                           
                                                        
                                            

                                                       









                                                                       










                                                                         
                                                                       

                                                                       








                                                                        
                                   

                                                                      

                                                                        
                                      
 








                                                                            
                                                                            

                                                                             
                                                                          
                           
                                                                                

                                                                                   




                                                                                      

                                                                                


                                                                                   
                                                                
                         



                                                                
 


                                                                           


                                                                                    



                                                                               



                                    
                    

 
  


                                                                    

                                                                    
 

                          
              
                                                            
 
                                                                
                                                                    
 










                                                                           
                                                                  
                    

 
  



                                                                             
                                                              
                                                                    
                                                  
 
              
 
                               
                                     
                                                                        
                                           
                              









                                                                               



                                                        
                                                    
                                  
         
                                                                  
                                 
                 

 
                  
  



                                                                   

                                                                   
   
                                                                   
 
                            
                     
 




                                      
                                                

                                 


      







                                                             
 
                            
                          
 
                                       
                                             
                                          
 

                                                       

                                 



                                                                  
                                         

         
 








                                                                       






                                                                           


                          






























                                                                      

 
                         


                                       

                                        
                     





                                              





                                                                   

                                                             
                 
 

                                                                           
                                        
 

                                                                              
                                                                           
                 
         

                                                   
                      

  
                      
                                                 
   
                                                    



                                            
                        
                                                      
 
                                         

                       

                                                      
                              
                                 
                                      
                                 
 














                                                                          
                                                
                 
                                                                    
            
                                                               
                     
                                      
                                                          

                                         

    
                                 

 
  






                                                              
                                                       




                                               










                                                                        

                                      









                                                                

                                              
 
 
  












































                                                                         



                                                                            

                                                          

                                                                      

                            
                          

                                              
      
                                 
                                          
                                       
 
                                      

                                                        
                                       
                                                           
                                                         
                                                           
                                                       
                                            
                 
 




                                                                        

                                     
                







                                                                                
                                                                        

                                        
                                                
                 
                                                      
                                                           


                                         
                                                                          

         
                                                          
                                                         
                                 
 
                                         
                                                  
                           
                    


                                 
                    

 








                                                                        


                                                                   
 

                             
               



                               
                      

                                       

                                
                       









                                                                     

                                              













                                                                             
                                                   
                           
 



                                                                
 











                                                                     
                                      
 
                       














                                                                            
  
                                                                                

                     

                                                                              

                                                   
                        

              
                                       
                                     
                               
                                       


                                                                 
                             







                                                                              
                                     
         



















                                                                              

 





                                                                       
                                                           


                                                                   
                                                      




















                                                                          
                                                           





                                                                        
                                                                    
























                                                                       
                                                                              









                                                                           
                                    










                                                                            
                                                                            







                                                                           
                                    



                                   














                                                                           






                                                                        
                                                                              




                                                         
                                                                            

 



                                                           

                         
  
                                                                      


                    
                                                                                
                                                                             
                                                             
 
                          
                                 
                          
                          


                                                                            
 
                                                 
              
          
                                                              

                                                                     

                                                                         


                                                                          
                                                   
                                                                      
                                         




























                                                                      
 
                                                             
                                                           
                                           

                                
                                                                               



                                                                










                                                                                  


                                                    







                                                                                  



                                                                  
                                         

                                                               
                                         



                                                                            
                                                            
                         

                 
              

                                                                       
                         
                              


                                                        
         





                                                                 
                    

 













                                                                          





                                                                       

                                                    

                                                                    














                                                                      


                                     
                                    





                                     


                             

                                                                     





                                        

                                                      
                                                                
                                                              
 


                                                   
 











                                                                              
















                                                                        
 

                 
 


                                                               

                                                          



                                                                   
                                                        
                                                    

                            
 






                                                                              
                                              
                                             
                 

                         



                                                                      


                                                                              









                                                                                
                                                           
                                                                  





                                               





                                                                           


                                             


                          
                   

                            
                                                         



                                            
                                      
                                                                            
                                                                          
                                       










                                                                               

                                                                

                                                                                 









                                                               





                                                                             
                                                                










                                                                           


                                             




                              



                                                                  
                                                                           
                                                          


                                           
                             




                                                
                                      

                                                    
                                                


                                                                                    
                                      
                                              
                                       


                       

                                            
 



                                                                           

                                                                
                                                               

                                                                    










                                                                            


                    
  

                                                                            
   


                                                               

                                                          




                                                                        
                                                                    
                                                     

                                                     
                                                                                






                                                                   

                                                                             
 

                          
 
                                                               
                                                          
 
 


                                  

                                                         
 
                                                                                  
                                                               
 





                                                                               
                                                             
 
                    





                                                              
                  

                                                                              
                   
                                             
                                                                 



                                                     
                                                      

                                                             
         
 


                           


                                                               

                                                          





                                                 
                                    
                                         
 
          




                                                                           

                                                         
                            
         
 










                                                                         
        

                                                              
                                                                          
 
          


                                                                                
           
                                                   
 







                                                                             
          
                                                                          
                                                                          

                                                                         

                            
 
                                                               





                                                                   





                                                            
                                               
                                         

                            



                                                                         



                                                                            



                                                                    


                                                                    

                            
                              
 








                                                                              



                                                               
                                                                    
                                                                         

                            
 
          

                                                                    
           

                                                                           

                                                



                                                                               

                                                                     

                                                                 

                                            
 
















                                                                                
 

                                     

         
                                                     
                                             

                                                                   
                                                                         
                                                                        
                               









                                                                              


                                                                    

                                    


         
                                                 
                    
       

                                                                 
                    
 
 








                                                                        
                                    
                                 
                                                              
                                        
 

                                     














                                                                          


                                                
                                                             


                                                                          

                            

                                      
                                                                               
                                                                             
                                                     

                                                              
                                                                 
                                                             
 
                                                                










                                                                            
                    
 
                                      



                           
                                                                  
 







                                                                              




                                                  

                                
                                             
 
                                                          
 

                               
                                                        
 
                                      
                               
                                                    






                                                     
                                                       

                        
                                                          





                                                                














                                                                              


















                                                                            
                                                   



                                 

                                                                            
                                                               


















                                                                                 

















                                                                          

                                                  
                          

                          
                                                                 

                             
                                                                              
 
                                                           
                                                         
                                                            

                                           









                                                                 
                                                      
 
                                        





                                                  
                                                                  
 

                                               
 
                       
                                                      
 
 



                                       
                                                        
                                             

                                            










                                                  
                                                           
                     
                                                                       

                                                                         



                           



                                  
  

                                                                              
   
                                                      

                         
                                        



                                             



                                                                    



                   





                                                                             

                                                               
   
                                         
 
                

                          
                                       
                                                                    
                                 

                                                    
 
                                          

                                                        
                                                                  
 


                                                                       


                 

                                                                        
                                  
                                                         
                                                                         
                                                                    
                                                  
                                                    

                                                    
                                                    
                                                    
                                                  
                                                 
                                                
                                                   
                                                 

                                                         
                                                  
                                            

                                                
 
                                       

                      
                                                                    
                                 





                                     



                                              
                                            

                                               
                                        



                                          
                                      

                                                   
                                             



                                              



                                                
                                                                


                                                  



                                                                   
                                                                 

                                                                   
                                               



                                                                 
                                                           

                                                                        

                                                                



                                                                    
                                            
                                                                






                                                                
                                       
                                                                     
 
                                                                    
                                 

                                           


                                                             

                                                                   

                                                           

                                                                         


                                              

                                                                                


                               





                                                                        

                                         

                                                     
   

                                                                            
 

                          
                                          
                    

            
                            
                                                     
                                           

                                                                  
                                                      
                 
 
                            
                        

 




















                                                                        
                  
































                                                                          









                                                                         






                                                              
                                                    



                                                   
                                            
 
                                    
                  
                                                         
                                                                
                
                         








                                                                      

                                                           
                                                  

                                                       
         


                                      


 
                                       

                                   
   
                                                                                              











                                                                              
                                                                    
 
                   

                              
                                                       
 




                                                      
 
                                               




                                                                


                                                                 


                                                                      
                                                                  

                                         

















                                                            






                                                                     
 
              
                                  
 
                                             
                                                             


                                                                          

                                            


  



                                                      


                                  

                                                                       

                                            


  








                                                                         




                                                        






                                                                         

                                                                     
                                                              

                         
         

                                              








                                               
                                                                        

                                                                         
                                                                              










                                                                            








                                                                               










                                                                        

                                                                               






























                                                                            
                             


                                           

                                  
                                             
                                                     

                                                    



                                          
                               

                               
 


                                                  
                                                                           








                                                                             




                                                               
                                                                     

                                               

                                 




                                                                    
 


                                                             
         

                                        

 
                                                                     
                                                  
 

                                   
                          
 


                                                            

                                                                            

 

















                                                                      
 

                         





                                                     
 
                             

                                  

                                    
 

                                                                       
 












                                                                          
         






                                                                          

                                            

 
                                                                            
                                                  
 
                                                    

 

                         
















                                                                             
                                                  
 





                                                                    
                                                   
                                                         
 
                
                
 


                                                
                                   



                                                  
         













                                                                       
                                    

                                                              













                                                                                   


                 



                                          
                                          
 

                             
                                             
                                            
                                         

                                                   
                                                                         
                                 




                                                                

                                                           
                                                   






                                                                        
                                                                  





                                                                        
                                        
                                                                    
                                                                       



                                                             














                                                                          
                             
                                                                           
















                                                                     






















                                                                                












                                                                  
  













                                                                                
                                                             

                                                                                




                                                                          
                                                             
                          

                                        
 





                                                                         

                                                  
                                                           
                                                                       
                                                                        
 








                                                                            
                                                                         



                                        



                                                           

                                                                    








                                                                               
 














                                                                             











                                                                               
 




                                                          
                                                                                
                                                                     
 
                          

                                                 
                       
 


                                                 
                                              
                                                     










                                                             

                                                     
                                                               
                                      

                                          




                                                                         


                                                                      




                                                                             
                   


                                                                   
                                                                         
 



                                                                               
                                                                        
      


         
                                                             
 


                                                                     





                                                   
                                                                          

      
                                            
 
                 



                                                                  
                                                            



                                                                

                                                 




                                                               


                                                              
          



                                                            
           
                                                          
 
                     
















                                                                              

 
                                                                         

                                  
                        
 

                                 
                      
                       

                                         

                                                                            

 









                                                                              
                      





                                            
                                                 
















                                                                              
  

                                                      
   
                                       
 
                          
 

                                         

 
                            
                                                                          


                                                     
                          




                                                                  



                                                                  


                                                                    
                                   
                                                        
                                                                      










                                                                               
                                                       


                               
 
                                                             
                                                          

                 

 





                                                          
                                    


                                             
                                                       


                                      
                                                          










                                                    
                                                      
 





                                                                        
 
                                


                                                                          

 

                                                                     

                                                                    

                                                     



                                               

                                             

                                              





                                                                              
                                   

                 

 
                                    






                                                                          
                                                   
 

                                         
 
                                                                           
                                                      
                                   

                                   


                                              

                                                 






                                      

 










                                                            
 

                                                                                  

                                                                          




                                                                        
                                                                                
 

                                         
 


                                                                         
 



                                                                               
         
 
 

                                                                                        
                                                                                      


                                                                
                                                                     


                                                              

                                         
 

                                                                       



                                                                          


                                                                                            



                                                                         
                  
   
                                                      

                                                                         
                                                   
              
 


                          


                                                                              

         
                               
                               


  



                                                                           
                                                     
















                                                                            
                                                                           






                                                                            
                                                                 

























                                                                              


                                                                             
                                                                  









                                                                   


                                                                














                                                                             
                                                               
   
                                                        


                                                              


                                                                  
 



                                                                             
         
                         






                                                                               
                                                                        







                                                                              
                                                                 


                                                                

                                                                            



                                                                   

                                                                    
 


                                                          
                                                                          
 
 
                                         
                                                                         





                                                                  
                                                                        







                                                                           
 
                                          
 
                                                                          



















                                                                             


                                                                         

                                                                             






                                                                       

                                                           










                                                                          
                       

                                                                               

     
                                                          


                                                                             
                                        









                                                             














                                                                          









                                                                           



                                               





                                   
                                                                       

                                                                      
                         
                                 
                                                             
                
 
                                 


                                                 
                                      
 

                                                          
                                                           
                                  
 


                                                                             
 




                                                                              

                                                                             

                                                 



                                                                                




                                                                              

                                                       
                                                
                                                                            
                                                                    

                 
                                       




                                                    
                  
                                 
                                                                               
                                                      
                                                                                
      


                                                
                                        
                                         
 
                                    

                                                                 



                                                         
                                        
                                


                                 
                                                               
                                                

                                                                     
                            
                                                          
                                       


         
                                                                      
 



                                       
                               

                                                                          
                                               

                                 








                                                                          

                                                        
                                                                      
                                                                            
         
                                  


                                                                        
                                    
                                                     
                                    
                                                                  
                                                                             
                                          
         
      
                                     

 

                                                                         
 

                                          

                                               
                                                                  

                                  




                                                                                            



                                                            
                                    



















                                                   
   




















                                                                           
                                       
                          
                   
 
                                                                     






















                                                                          
                                    
                                                          
 
                                          

                                
 

                                                              
 

                                   
                                                                       



                         





                                                                     
                      





                                                           




                                                       
                                                            
 
                                     




                                                                             
 

                                    
                                                           

                          

 





                                                                     
                                                         



                                                            

                                                                 

                                                                    
 








                                                                      












                                                                             

                                                                       
                         







                                                                               
                                                 

                                                 















                                                                             
                                                                            

                                                 
                                                                          

































































                                                                               



                                                      

 







                                                                    
                                          
                                                                           

                              



         

                                                                
                                                    











                                                                           

                                         
 







                                                                              

                                      




                                                                               




                                                                    
                                           
 

                                       


                                            





                                                                  

                                                                   







                                                                           

                                            


                                                                               

                                   
                                         
                            

                                                  
                                              
                                                                  




                                                           

         
 
                                                                  





                                   
                                      
 
                                                                    



                                                     
 

















                                                                          
                                                    
                                                      
 
                                          
 
   

                                                                                 



                                                                             


                                                                         





                                                          

                                                     
                                          

                                                               
 



                                                                  
 
                                                              
                                       







                                                                      
                                        







                                                                           
                                          


                         






                                                  






                                                                             
                            











                                                                               

                                                                            



                                                          









                                                                      

                 
                                              



                                           







                                                                        
                              
 
                                      





                                                                          

                                     

                                                        

                                      









                                                                               


                                       

 
   
                                                              
                                        
  

                                                                        
   
                                












                                                                       

                        
                                                      

                                                           

                                       



                                                                               
                                                                             

                                                                             







                                                               
                                                               
                        

                                                                           

                                                            
                                                         

                 

                                                                                 
                                                 
                                                           
         


                                       

 
  



















                                                                          
                                                                      
 
                               
 


                                                      
                                          

                          
 

                                     
 
                                                         




                                                    

 























                                                                       
                                           









                                                                   
                                
                                       
                                        
                                        

                 
                                    






                                                                             
                                                          
 
                                                          
                  
                                        


                 

                                                                         
                                                          



                          
                                                                      



                           
                                                                 


                                                                 

                                                                     
                                                          



                          
                                                                      







                                                             

      





                                                                           
                                                                   


                                                                    
                                                          
 
                                                                 



                                        






                                                                                   
                                                          




                          
                                                                       
                                
                           
                                       
                                            

                                                                              

                                                                       




                 
                                

































                                                                         
                                             








                                                                       

                                                                         







                                                                           
                                                            
         
                                                    





                                                                            
                                      



                                 
                                    



                                             
                                                            


                                                                         

                                                                           

                                                                    
                           
                                                          
                                                                            

                                                                           





                                                                       
                                                                               
                         
                                
                                        








                                                 
 














                                                                            
                                                            

                                         
                                                            



                             
                                                                                                            





















                                                                         
 



                     
                                                                                                       
















                                                                         

                                                                     






                                                                       






                                                                    

















                                                                        
                                             
                                 
 




























                                                                                

                          




                                                                          

                                                                              
           





                                            


                                                                          


                                                     


                                              
                                 

                                         


                               
 
                                              





                                          
          








                                                                        
           

                                                                      
                         
                         




                                                                           

                        




                                                                       
    




                                                                  

                                                   
                                  















                                                               
 


























































































































































































                                                                                    













































                                                                        




















                                                                           
























                                                          














































                                                                      
                                                                      

                                            
                                        
 
/*
 *  linux/mm/page_alloc.c
 *
 *  Manages the free list, the system allocates free pages here.
 *  Note that kmalloc() lives in slab.c
 *
 *  Copyright (C) 1991, 1992, 1993, 1994  Linus Torvalds
 *  Swap reorganised 29.12.95, Stephen Tweedie
 *  Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
 *  Reshaped it to be a zoned allocator, Ingo Molnar, Red Hat, 1999
 *  Discontiguous memory support, Kanoj Sarcar, SGI, Nov 1999
 *  Zone balancing, Kanoj Sarcar, SGI, Jan 2000
 *  Per cpu hot/cold page lists, bulk allocation, Martin J. Bligh, Sept 2002
 *          (lots of bits borrowed from Ingo Molnar & Andrew Morton)
 */

#include <linux/stddef.h>
#include <linux/mm.h>
#include <linux/swap.h>