~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/s390/appldata/appldata_mem.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/s390/appldata/appldata_mem.c (Architecture ppc) and /arch/mips/appldata/appldata_mem.c (Architecture mips)


  1 // SPDX-License-Identifier: GPL-2.0                 1 
  2 /*                                                
  3  * Data gathering module for Linux-VM Monitor     
  4  * Collects data related to memory management.    
  5  *                                                
  6  * Copyright IBM Corp. 2003, 2006                 
  7  *                                                
  8  * Author: Gerald Schaefer <gerald.schaefer@de    
  9  */                                               
 10                                                   
 11 #include <linux/module.h>                         
 12 #include <linux/init.h>                           
 13 #include <linux/errno.h>                          
 14 #include <linux/kernel_stat.h>                    
 15 #include <linux/pagemap.h>                        
 16 #include <linux/swap.h>                           
 17 #include <linux/slab.h>                           
 18 #include <linux/io.h>                             
 19                                                   
 20 #include "appldata.h"                             
 21                                                   
 22                                                   
 23 #define P2K(x) ((x) << (PAGE_SHIFT - 10))         
 24                                                   
 25 /*                                                
 26  * Memory data                                    
 27  *                                                
 28  * This is accessed as binary data by z/VM. If    
 29  * the structure version (product ID, see appl    
 30  * as well and all documentation and z/VM appl    
 31  * updated.                                       
 32  */                                               
 33 struct appldata_mem_data {                        
 34         u64 timestamp;                            
 35         u32 sync_count_1;       /* after VM co    
 36         u32 sync_count_2;       /* sync_count_    
 37                                    same. If no    
 38                                    the Linux s    
 39                                    (possibly c    
 40                                                   
 41         u64 pgpgin;             /* data read f    
 42         u64 pgpgout;            /* data writte    
 43         u64 pswpin;             /* pages swapp    
 44         u64 pswpout;            /* pages swapp    
 45                                                   
 46         u64 sharedram;          /* sharedram i    
 47                                                   
 48         u64 totalram;           /* total main     
 49         u64 freeram;            /* free main m    
 50         u64 totalhigh;          /* total high     
 51         u64 freehigh;           /* free high m    
 52                                                   
 53         u64 bufferram;          /* memory rese    
 54         u64 cached;             /* size of (us    
 55         u64 totalswap;          /* total swap     
 56         u64 freeswap;           /* free swap s    
 57                                                   
 58 // New in 2.6 -->                                 
 59         u64 pgalloc;            /* page alloca    
 60         u64 pgfault;            /* page faults    
 61         u64 pgmajfault;         /* page faults    
 62 // <-- New in 2.6                                 
 63                                                   
 64 } __packed;                                       
 65                                                   
 66                                                   
 67 /*                                                
 68  * appldata_get_mem_data()                        
 69  *                                                
 70  * gather memory data                             
 71  */                                               
 72 static void appldata_get_mem_data(void *data)     
 73 {                                                 
 74         /*                                        
 75          * don't put large structures on the s    
 76          * serialized through the appldata_ops    
 77          */                                       
 78         static struct sysinfo val;                
 79         unsigned long ev[NR_VM_EVENT_ITEMS];      
 80         struct appldata_mem_data *mem_data;       
 81                                                   
 82         mem_data = data;                          
 83         mem_data->sync_count_1++;                 
 84                                                   
 85         all_vm_events(ev);                        
 86         mem_data->pgpgin     = ev[PGPGIN] >> 1    
 87         mem_data->pgpgout    = ev[PGPGOUT] >>     
 88         mem_data->pswpin     = ev[PSWPIN];        
 89         mem_data->pswpout    = ev[PSWPOUT];       
 90         mem_data->pgalloc    = ev[PGALLOC_NORM    
 91         mem_data->pgalloc    += ev[PGALLOC_DMA    
 92         mem_data->pgfault    = ev[PGFAULT];       
 93         mem_data->pgmajfault = ev[PGMAJFAULT];    
 94                                                   
 95         si_meminfo(&val);                         
 96         mem_data->sharedram = val.sharedram;      
 97         mem_data->totalram  = P2K(val.totalram    
 98         mem_data->freeram   = P2K(val.freeram)    
 99         mem_data->totalhigh = P2K(val.totalhig    
100         mem_data->freehigh  = P2K(val.freehigh    
101         mem_data->bufferram = P2K(val.bufferra    
102         mem_data->cached    = P2K(global_node_    
103                                 - val.bufferra    
104                                                   
105         si_swapinfo(&val);                        
106         mem_data->totalswap = P2K(val.totalswa    
107         mem_data->freeswap  = P2K(val.freeswap    
108                                                   
109         mem_data->timestamp = get_tod_clock();    
110         mem_data->sync_count_2++;                 
111 }                                                 
112                                                   
113                                                   
114 static struct appldata_ops ops = {                
115         .name      = "mem",                       
116         .record_nr = APPLDATA_RECORD_MEM_ID,      
117         .size      = sizeof(struct appldata_me    
118         .callback  = &appldata_get_mem_data,      
119         .owner     = THIS_MODULE,                 
120         .mod_lvl   = {0xF0, 0xF0},                
121 };                                                
122                                                   
123                                                   
124 /*                                                
125  * appldata_mem_init()                            
126  *                                                
127  * init_data, register ops                        
128  */                                               
129 static int __init appldata_mem_init(void)         
130 {                                                 
131         int ret;                                  
132                                                   
133         ops.data = kzalloc(sizeof(struct appld    
134         if (!ops.data)                            
135                 return -ENOMEM;                   
136                                                   
137         ret = appldata_register_ops(&ops);        
138         if (ret)                                  
139                 kfree(ops.data);                  
140                                                   
141         return ret;                               
142 }                                                 
143                                                   
144 /*                                                
145  * appldata_mem_exit()                            
146  *                                                
147  * unregister ops                                 
148  */                                               
149 static void __exit appldata_mem_exit(void)        
150 {                                                 
151         appldata_unregister_ops(&ops);            
152         kfree(ops.data);                          
153 }                                                 
154                                                   
155                                                   
156 module_init(appldata_mem_init);                   
157 module_exit(appldata_mem_exit);                   
158                                                   
159 MODULE_LICENSE("GPL");                            
160 MODULE_AUTHOR("Gerald Schaefer");                 
161 MODULE_DESCRIPTION("Linux-VM Monitor Stream, M    
162                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php