释放内存

refill_inactive_zone

637 static void                                                                     
 638 refill_inactive_zone(struct zone *zone, struct scan_control *sc)                
 639 {                                                                               
 640         int pgmoved;                                                            
 641         int pgdeactivate = 0;                                                   
 642         int pgscanned = 0;                                                      
 643         int nr_pages = sc->nr_to_scan;                                          
 644         LIST_HEAD(l_hold);      /* The pages which were snipped off */          
 645         LIST_HEAD(l_inactive);  /* Pages to go onto the inactive_list */        
 646         LIST_HEAD(l_active);    /* Pages to go onto the active_list */          
 647         struct page *page;                                                      
 648         struct pagevec pvec;                                                    
 649         int reclaim_mapped = 0;                                                 
 650         long mapped_ratio;                                                      
 651         long distress;                                                          
 652         long swap_tendency;                                                     
 653                                                                                 
 654         lru_add_drain();                                                        
 655         pgmoved = 0;                                                            
 656         spin_lock_irq(&zone->lru_lock);                                         
 657         while (pgscanned < nr_pages && !list_empty(&zone->active_list)) {       
 658                 page = lru_to_page(&zone->active_list);      //取出zone的active_list链表的一个节点,并找到这个节点对应的page的指针                   
 659                 prefetchw_prev_lru_page(page, &zone->active_list, flags);       
 660                 if (!TestClearPageLRU(page))       //清除页中的LRU标志                             
 661                         BUG();                                                  
 662                 list_del(&page->lru);                 //从zone的active_list链表中删除这个page                          
 663                 if (get_page_testone(page)) {                                   
 664                         /*                                                      
 665                          * It was already free!  release_pages() or put_page()  
 666                          * are about to remove it from the LRU and free it. So  
 667                          * put the refcount back and put the page back on the   
 668                          * LRU                                                  
 669                          */                                                     
 670                         __put_page(page);                                       
 671                         SetPageLRU(page);                                       
 672                         list_add(&page->lru, &zone->active_list);               
 673                 } else {                                                        
 674                         list_add(&page->lru, &l_hold);                          
 675                         pgmoved++;                                              
 676                 }                                                               
 677                 pgscanned++;                                                    

637 static void
638 refill_inactive_zone(struct zone *zone, struct scan_control sc)
639 {
640 int pgmoved;
641 int pgdeactivate = 0;
642 int pgscanned = 0;
643 int nr_pages = sc->nr_to_scan;
644 LIST_HEAD(l_hold); /
The pages which were snipped off /
645 LIST_HEAD(l_inactive); /
Pages to go onto the inactive_list /
646 LIST_HEAD(l_active); /
Pages to go onto the active_list */
647 struct page page;
648 struct pagevec pvec;
649 int reclaim_mapped = 0;
650 long mapped_ratio;
651 long distress;
652 long swap_tendency;
653
654 lru_add_drain();
655 pgmoved = 0;
656 spin_lock_irq(&zone->lru_lock);
657 while (pgscanned < nr_pages && !list_empty(&zone->active_list)) {
658 page = lru_to_page(&zone->active_list);
659 prefetchw_prev_lru_page(page, &zone->active_list, flags);
660 if (!TestClearPageLRU(page))
661 BUG();
662 list_del(&page->lru);
663 if (get_page_testone(page)) {
664 /

665 * It was already free! release_pages() or put_page()
666 * are about to remove it from the LRU and free it. So
667 * put the refcount back and put the page back on the
668 * LRU
669 */
670 __put_page(page);
671 SetPageLRU(page);
672 list_add(&page->lru, &zone->active_list);
673 } else {
674 list_add(&page->lru, &l_hold);
675 pgmoved++;
676 }
677 pgscanned++;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值