/tools/perf/scripts/python/

993527754f062c589b73f125024d216'>commitdiffstats
path: root/mm/mempolicy.c
blob: e9493b1c1117a4090fa8998b9ea2e29c1239ebbc (plain) (tree)
1
2
3
4
5



                                                  
                                                               














                                                                             
  

                                                                  



                                                                              




                                                                          
  































                                                                              







                            





                           
                          


                            
                       

                           
                          
                       
                           
                           
                        
 


                         

                     
                    
                                                                                             
                                                                                       
                                                                               
 

                                       
 

                                                                    
                               
 


                                                          
                                   
                                                     
                               
                              

  




                                                                       
                                                                  
                                                        
 
                  
 









                                                               
                 
         

                 

 

                                                                       








                                                                           

 










                                                                              
                                                                      














                                                                        
                         

                                                                            

                                 
                                        
                
 

                                                                  
 

                                                  
                                                
                                                                       
         















                                                                             



                                                            
                            
                              
 



                                                                         














                                                                             
                                                                      



                                                      
                      

 




                                             


                                         

















                                                                               
 














                                                                    


                                                            
                                               
                                                     


                                                    


                                                                           
                                                  




                                                                              

 



                                                         

                       


                                                              
                                                 



























                                                                     

















                                                               
                                                               

                                                                           
 
                                                                     
                                                                  

                                                             
                              
 

                        
                        
 
                                                                          
            
                                  
                        

                                       
                                 

                                                       
                                 










                                                                          

                                       
                                        


                                                                          
                                          
                                                                     
                                                                   
                                                               

                              
                                                        
                                        


                           
                                                                         

                                                             
                              








                                               
                                                                
                                                    




                                                  
                                                                         

                                                             
                              








                                               
                                                                
                                                    




                                                  
                                                             

                                                             
                              



                           
                                           



                                               
                                                                
                                                    


                                                  

 




                                                          

                                                                         
                                                                            



                                                  
 




                                                                           









                                                                    
                                                           
 



                                                      
                                                                        
                                                                















                                                                        
                                                                        








                                                               
                              

























                                                                       





























                                                                   
                                   

                                                                       
 
                              
                                           
 
                                           

                                    








                                                                
                                     
                                 
                                    
                                                  
                                       
                                                            


                                        


                 



                                                                       
 
                            


                                 
                          

                                  
                             
                                    

                            
                                               
                                                              
                                                                      


















                                                                               
                          

                                                                     
 
                



                                                   
                                          

                                                                              
                               








                                                              
                                  




                                                            













                                                                 
                                                                        





                                                    
                                      
                                                       
                                                               
                                                   



                                      


                                                                 




                                                                              
         





                                                
                
                  
                                                

     
                           




                                                
                       
  

                 

                                                                           

          
                                                             
           




                                                                     
 
 
                                                                                 
 
                                                               

 



                                                     

                                                                      






                                
 


                                                                 
                                   

                                                                    
                   


  

                                                                     





                                                                            
                     
                
                       
 



                             
                                 
 



                                                            





























                                                                      
 


























                                                                  
         
    
                               


                           


 






                                                                      
                                                                                   

                                                                      
                                                 
 










                                                                           
 




                                                                           

 




                                                                            
 
                                                                                   


                    

      
                                                            

                                                                    







                                           

                                                                      
                               
                                                                 















                                                
                                                









                                                            


                                                              
 





                                                        








                                                             
 
                                           

                                                                          



                                                                  
 
                                
                      


                   
  



                                                                  
                                                                          









                                           
                                              
                               























































                                                                                    
                                  
 

                                            

                               


                                                 


                                                
                                                                     







                                                                        
                             
 


                                           
                               

                                                                             


                                                
                                                     

 




















                                                                   
                                                      












                                                                      
                                                         



                                                                            
                                     





                                                             
                                                                       



                             
                                                             



                              



                                             
                                              
                                                                         





                   





                                                                        

                                    


















                                                                 



























































                                                                                
                      




                                                                
                                                                        
                                                         
                                                                    









                                                                 







                                                              






                                                                             
   
                                                                 
                                                               
 
                                                

                  
                                                             



                                                                              
                                          






                                             




                                                                       

                                                                    
                                                  






                                                                             

                                                                            
 
                                
 
                               
                            

                                                      

                       
                  



                                                                               
                   



                                                                           
                                                     

                      

                      
                                      








                                                          
                                               
                                 
                                                   

                                   


                   


                                                                           



                                                                         


                                            
                                                    



                                      



                                                
 


                                                
                         



                                                                          







                                                                         
         
 
                
                      


         



                                                              
                                                     
                        


                     


                                            

              
                                                   

                              


                   






                                                                           








                                                                       





                                                       
                       




                                                                         

                                                                       
  



                                                                         
   
                                                                              

                                                                         
 
                            
 
                                                   
                                                       
 

                                                                   
                                                                              



                                                       

                  
 
      
 

                                                         

                                                                    



                            
                                     
                                             
                                                                        
                                                               

























                                                                              
                                                                         
 
                                                                   
                            
 
                                          
 
                                                     
                             

                                                                 
                                   

                                                          

                                                 
                  
                                                       
                   
                                                                   
                                                                               
                                




                                             
                                                                             
















                                                                             
                                                           


                                                       
                                                           



                                                   
                                                  
                                                             
                                      




                                                              
                                         
                                                                                
                                                 
                                                                              


                                   
  
                                                                      




                                                                    
 

                                                   




                                                                           



                                                               

                                    


                   





















                                                                             









                                                                   




                                                          
                               
                         
                                                                
                         
                          

                                  
                             
                                                           
                            

                                                                    





                         
  



























































                                                                           
                                                                 
                                                      






















                                                                      
                                                          
                                    
                            


                                     

                                                                       







                                                                   
                                                       













































                                                                                
                                       




                                                




























                                                                                


         






                                                                           
                                                            
                               
                                            
                                         
                                                           
























                                                                                
                                           
                                    


                                             




                                  



                                    

                                                                  
                                                              


                                                            
                                                          
 





                                                                        
                                                 















                                                                    
 
                                                                    


                                                                  
                                                

                              
                                                
 
 
  



                                             
                                                                   
                                                   
   
                                        
                                          
                                                               
 




                                              

                                                                    



                                     







                                                                         
   
                                                                      
 



                                                     







                                                        
                                                    
                                 
                                                                     
                                 


                                   


                                                                   
                                           
                                                    
                                 


                              
                           

                         
                       
                            


                                                        







                                              




                                                                     
                                                           
                        
                      
                        
                  
                                                                   
                   
                             
                                 
                                      
                      




                                                                                

         
                       





                                                                    
                                                          
                                                    
                                                            


                                






                                                                                





                                              

                            



                         






                                                                           



                                                           
                                                                                



                         
                            
                                                    
 




                                                                           




                                           






                                   
                                         

                                                                   
                                                               


                       
                                  
                             



                                                     



                      


                                       

                                        



                                      
                                      



                                            


                                                                           
                                                


                                                                          

         


                                            
                           







                                                                       

                                
                                   

                                


                                         
                                                                         



                                        


                                         
 

                                
 
                                                      



                                



                           


                                         
                                      

 
                          





                                                        

                                             
 


                                                                          















                                                         






                                                               
 


                                                                

                                              
                                                    

                                       

                                          
                              


                        
                





                                                           
                                                             
                                                    
                           




                                                         
                                                     










                                                                              
                                                                
                                                                        



                         
 

                                                   
 

                                                     
 

                                                            
 

                                                               
 








                                                               
                                             



                                                                  


                               
                                                                         

                 
/*
 * Simple NUMA memory policy for the Linux kernel.
 *
 * Copyright 2003,2004 Andi Kleen, SuSE Labs.
 * (C) Copyright 2005 Christoph Lameter, Silicon Graphics, Inc.
 * Subject to the GNU Public License, version 2.
 *
 * NUMA policy allows the user to give hints in which node(s) memory should
 * be allocated.
 *
 * Support four policies per VMA and per process:
 *
 * The VMA policy has priority over the process policy for a page fault.
 *
 * interleave     Allocate memory interleaved over a set of nodes,
 *                with normal fallback if it fails.
 *                For VMA based allocations this interleaves based on the
 *                offset into the backing object or offset into the mapping
 *                for anonymous memory. For process policy an process counter
 *                is used.
 *
 * bind           Only allocate memory on a specific set of nodes,
 *                no fallback.
 *                FIXME: memory is allocated starting with the first node
 *                to the last. It would be better if bind would truly restrict
 *                the allocation to memory nodes instead
 *
 * preferred       Try a specific node first before normal fallback.
 *                As a special case node -1 here means do the allocation
 *                on the local CPU. This is normally identical to default,
 *                but useful to set in a VMA when you have a non default
 *                process policy.
 *
 * default        Allocate on the local node first, or when on a VMA
 *                use the process policy. This is what Linux always did
 *		  in a NUMA aware kernel and still does by, ahem, default.
 *
 * The process policy is applied for most non interrupt memory allocations
 * in that process' context. Interrupts ignore the policies and always
 * try to allocate on the local CPU. The VMA policy is only applied for memory
 * allocations for a VMA in the VM.
 *
 * Currently there are a few corner cases in swapping where the policy
 * is not applied, but the majority should be handled. When process policy
 * is used it is not remembered over swap outs/swap ins.
 *
 * Only the highest zone in the zone hierarchy gets policied. Allocations
 * requesting a lower zone just use default policy. This implies that
 * on systems with highmem kernel lowmem allocation don't get policied.
 * Same with GFP_DMA allocations.
 *
 * For shmfs/tmpfs/hugetlbfs shared memory the policy is shared between
 * all users and remembered even when nobody has memory mapped.
 */

/* Notebook:
   fix mmap readahead to honour policy and enable policy for any page cache
   object
   statistics for bigpages
   global policy for page cache? currently it uses process policy. Requires
   first item above.
   handle mremap for shared memory (currently ignored for the policy)
   grows down?