SHARE
TWEET

adadfgadf

a guest Jun 18th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <linux/kernel.h>
  2. #include <linux/sched.h>
  3. #include <linux/mm_types.h>
  4. #include <linux/mmzone.h>
  5. #include <asm/pgtable.h>
  6. #include <stdio.h>
  7. #include <linux/page-flags.h>
  8.  
  9. asmlinkage int sys_zone_stats(void){
  10.         struct zone *actualmemory;
  11.         struct page *actualpage;
  12.         struct list_head actualLru;
  13.         int i,active, inactive,referencedA, referencedI;
  14.         active=inactive=referencedA=referencedI=0;
  15.         for_each_zone(actualmemory){
  16.           for_each_lru(i) {
  17.             actualLru = actualmemory->zone_pgdat->lruvec.lists[i];
  18.             list_for_each_entry(actualpage, &actualLru.list, lru) {
  19.               if(i == LRU_ACTIVE_ANON || i == LRU_ACTIVE_FILE){
  20.                 active++;
  21.                 if(PageReferenced(actualpage)){
  22.                         referencedA ++;
  23.                 }
  24.               }else{
  25.                 inactive++;
  26.                 if(PageReferenced(actualpage)){
  27.                         referencedI++;
  28.                 }
  29.               }
  30.             }
  31.           }
  32.         }
  33.         printk("Pages activos: %d \n", active);
  34.         printk("Pages inactivos: %d \n", inactive);
  35.         printk("Pages activos con bit de referencia: %d \n", referencedA);
  36.         printk("Pages inactivos con bit de referencia: %d \n", referencedI);
  37.         return 0;
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top