1*4882a593Smuzhiyun.. _slub: 2*4882a593Smuzhiyun 3*4882a593Smuzhiyun========================== 4*4882a593SmuzhiyunShort users guide for SLUB 5*4882a593Smuzhiyun========================== 6*4882a593Smuzhiyun 7*4882a593SmuzhiyunThe basic philosophy of SLUB is very different from SLAB. SLAB 8*4882a593Smuzhiyunrequires rebuilding the kernel to activate debug options for all 9*4882a593Smuzhiyunslab caches. SLUB always includes full debugging but it is off by default. 10*4882a593SmuzhiyunSLUB can enable debugging only for selected slabs in order to avoid 11*4882a593Smuzhiyunan impact on overall system performance which may make a bug more 12*4882a593Smuzhiyundifficult to find. 13*4882a593Smuzhiyun 14*4882a593SmuzhiyunIn order to switch debugging on one can add an option ``slub_debug`` 15*4882a593Smuzhiyunto the kernel command line. That will enable full debugging for 16*4882a593Smuzhiyunall slabs. 17*4882a593Smuzhiyun 18*4882a593SmuzhiyunTypically one would then use the ``slabinfo`` command to get statistical 19*4882a593Smuzhiyundata and perform operation on the slabs. By default ``slabinfo`` only lists 20*4882a593Smuzhiyunslabs that have data in them. See "slabinfo -h" for more options when 21*4882a593Smuzhiyunrunning the command. ``slabinfo`` can be compiled with 22*4882a593Smuzhiyun:: 23*4882a593Smuzhiyun 24*4882a593Smuzhiyun gcc -o slabinfo tools/vm/slabinfo.c 25*4882a593Smuzhiyun 26*4882a593SmuzhiyunSome of the modes of operation of ``slabinfo`` require that slub debugging 27*4882a593Smuzhiyunbe enabled on the command line. F.e. no tracking information will be 28*4882a593Smuzhiyunavailable without debugging on and validation can only partially 29*4882a593Smuzhiyunbe performed if debugging was not switched on. 30*4882a593Smuzhiyun 31*4882a593SmuzhiyunSome more sophisticated uses of slub_debug: 32*4882a593Smuzhiyun------------------------------------------- 33*4882a593Smuzhiyun 34*4882a593SmuzhiyunParameters may be given to ``slub_debug``. If none is specified then full 35*4882a593Smuzhiyundebugging is enabled. Format: 36*4882a593Smuzhiyun 37*4882a593Smuzhiyunslub_debug=<Debug-Options> 38*4882a593Smuzhiyun Enable options for all slabs 39*4882a593Smuzhiyun 40*4882a593Smuzhiyunslub_debug=<Debug-Options>,<slab name1>,<slab name2>,... 41*4882a593Smuzhiyun Enable options only for select slabs (no spaces 42*4882a593Smuzhiyun after a comma) 43*4882a593Smuzhiyun 44*4882a593SmuzhiyunMultiple blocks of options for all slabs or selected slabs can be given, with 45*4882a593Smuzhiyunblocks of options delimited by ';'. The last of "all slabs" blocks is applied 46*4882a593Smuzhiyunto all slabs except those that match one of the "select slabs" block. Options 47*4882a593Smuzhiyunof the first "select slabs" blocks that matches the slab's name are applied. 48*4882a593Smuzhiyun 49*4882a593SmuzhiyunPossible debug options are:: 50*4882a593Smuzhiyun 51*4882a593Smuzhiyun F Sanity checks on (enables SLAB_DEBUG_CONSISTENCY_CHECKS 52*4882a593Smuzhiyun Sorry SLAB legacy issues) 53*4882a593Smuzhiyun Z Red zoning 54*4882a593Smuzhiyun P Poisoning (object and padding) 55*4882a593Smuzhiyun U User tracking (free and alloc) 56*4882a593Smuzhiyun T Trace (please only use on single slabs) 57*4882a593Smuzhiyun A Enable failslab filter mark for the cache 58*4882a593Smuzhiyun O Switch debugging off for caches that would have 59*4882a593Smuzhiyun caused higher minimum slab orders 60*4882a593Smuzhiyun - Switch all debugging off (useful if the kernel is 61*4882a593Smuzhiyun configured with CONFIG_SLUB_DEBUG_ON) 62*4882a593Smuzhiyun 63*4882a593SmuzhiyunF.e. in order to boot just with sanity checks and red zoning one would specify:: 64*4882a593Smuzhiyun 65*4882a593Smuzhiyun slub_debug=FZ 66*4882a593Smuzhiyun 67*4882a593SmuzhiyunTrying to find an issue in the dentry cache? Try:: 68*4882a593Smuzhiyun 69*4882a593Smuzhiyun slub_debug=,dentry 70*4882a593Smuzhiyun 71*4882a593Smuzhiyunto only enable debugging on the dentry cache. You may use an asterisk at the 72*4882a593Smuzhiyunend of the slab name, in order to cover all slabs with the same prefix. For 73*4882a593Smuzhiyunexample, here's how you can poison the dentry cache as well as all kmalloc 74*4882a593Smuzhiyunslabs:: 75*4882a593Smuzhiyun 76*4882a593Smuzhiyun slub_debug=P,kmalloc-*,dentry 77*4882a593Smuzhiyun 78*4882a593SmuzhiyunRed zoning and tracking may realign the slab. We can just apply sanity checks 79*4882a593Smuzhiyunto the dentry cache with:: 80*4882a593Smuzhiyun 81*4882a593Smuzhiyun slub_debug=F,dentry 82*4882a593Smuzhiyun 83*4882a593SmuzhiyunDebugging options may require the minimum possible slab order to increase as 84*4882a593Smuzhiyuna result of storing the metadata (for example, caches with PAGE_SIZE object 85*4882a593Smuzhiyunsizes). This has a higher liklihood of resulting in slab allocation errors 86*4882a593Smuzhiyunin low memory situations or if there's high fragmentation of memory. To 87*4882a593Smuzhiyunswitch off debugging for such caches by default, use:: 88*4882a593Smuzhiyun 89*4882a593Smuzhiyun slub_debug=O 90*4882a593Smuzhiyun 91*4882a593SmuzhiyunYou can apply different options to different list of slab names, using blocks 92*4882a593Smuzhiyunof options. This will enable red zoning for dentry and user tracking for 93*4882a593Smuzhiyunkmalloc. All other slabs will not get any debugging enabled:: 94*4882a593Smuzhiyun 95*4882a593Smuzhiyun slub_debug=Z,dentry;U,kmalloc-* 96*4882a593Smuzhiyun 97*4882a593SmuzhiyunYou can also enable options (e.g. sanity checks and poisoning) for all caches 98*4882a593Smuzhiyunexcept some that are deemed too performance critical and don't need to be 99*4882a593Smuzhiyundebugged by specifying global debug options followed by a list of slab names 100*4882a593Smuzhiyunwith "-" as options:: 101*4882a593Smuzhiyun 102*4882a593Smuzhiyun slub_debug=FZ;-,zs_handle,zspage 103*4882a593Smuzhiyun 104*4882a593SmuzhiyunThe state of each debug option for a slab can be found in the respective files 105*4882a593Smuzhiyununder:: 106*4882a593Smuzhiyun 107*4882a593Smuzhiyun /sys/kernel/slab/<slab name>/ 108*4882a593Smuzhiyun 109*4882a593SmuzhiyunIf the file contains 1, the option is enabled, 0 means disabled. The debug 110*4882a593Smuzhiyunoptions from the ``slub_debug`` parameter translate to the following files:: 111*4882a593Smuzhiyun 112*4882a593Smuzhiyun F sanity_checks 113*4882a593Smuzhiyun Z red_zone 114*4882a593Smuzhiyun P poison 115*4882a593Smuzhiyun U store_user 116*4882a593Smuzhiyun T trace 117*4882a593Smuzhiyun A failslab 118*4882a593Smuzhiyun 119*4882a593SmuzhiyunCareful with tracing: It may spew out lots of information and never stop if 120*4882a593Smuzhiyunused on the wrong slab. 121*4882a593Smuzhiyun 122*4882a593SmuzhiyunSlab merging 123*4882a593Smuzhiyun============ 124*4882a593Smuzhiyun 125*4882a593SmuzhiyunIf no debug options are specified then SLUB may merge similar slabs together 126*4882a593Smuzhiyunin order to reduce overhead and increase cache hotness of objects. 127*4882a593Smuzhiyun``slabinfo -a`` displays which slabs were merged together. 128*4882a593Smuzhiyun 129*4882a593SmuzhiyunSlab validation 130*4882a593Smuzhiyun=============== 131*4882a593Smuzhiyun 132*4882a593SmuzhiyunSLUB can validate all object if the kernel was booted with slub_debug. In 133*4882a593Smuzhiyunorder to do so you must have the ``slabinfo`` tool. Then you can do 134*4882a593Smuzhiyun:: 135*4882a593Smuzhiyun 136*4882a593Smuzhiyun slabinfo -v 137*4882a593Smuzhiyun 138*4882a593Smuzhiyunwhich will test all objects. Output will be generated to the syslog. 139*4882a593Smuzhiyun 140*4882a593SmuzhiyunThis also works in a more limited way if boot was without slab debug. 141*4882a593SmuzhiyunIn that case ``slabinfo -v`` simply tests all reachable objects. Usually 142*4882a593Smuzhiyunthese are in the cpu slabs and the partial slabs. Full slabs are not 143*4882a593Smuzhiyuntracked by SLUB in a non debug situation. 144*4882a593Smuzhiyun 145*4882a593SmuzhiyunGetting more performance 146*4882a593Smuzhiyun======================== 147*4882a593Smuzhiyun 148*4882a593SmuzhiyunTo some degree SLUB's performance is limited by the need to take the 149*4882a593Smuzhiyunlist_lock once in a while to deal with partial slabs. That overhead is 150*4882a593Smuzhiyungoverned by the order of the allocation for each slab. The allocations 151*4882a593Smuzhiyuncan be influenced by kernel parameters: 152*4882a593Smuzhiyun 153*4882a593Smuzhiyun.. slub_min_objects=x (default 4) 154*4882a593Smuzhiyun.. slub_min_order=x (default 0) 155*4882a593Smuzhiyun.. slub_max_order=x (default 3 (PAGE_ALLOC_COSTLY_ORDER)) 156*4882a593Smuzhiyun 157*4882a593Smuzhiyun``slub_min_objects`` 158*4882a593Smuzhiyun allows to specify how many objects must at least fit into one 159*4882a593Smuzhiyun slab in order for the allocation order to be acceptable. In 160*4882a593Smuzhiyun general slub will be able to perform this number of 161*4882a593Smuzhiyun allocations on a slab without consulting centralized resources 162*4882a593Smuzhiyun (list_lock) where contention may occur. 163*4882a593Smuzhiyun 164*4882a593Smuzhiyun``slub_min_order`` 165*4882a593Smuzhiyun specifies a minimum order of slabs. A similar effect like 166*4882a593Smuzhiyun ``slub_min_objects``. 167*4882a593Smuzhiyun 168*4882a593Smuzhiyun``slub_max_order`` 169*4882a593Smuzhiyun specified the order at which ``slub_min_objects`` should no 170*4882a593Smuzhiyun longer be checked. This is useful to avoid SLUB trying to 171*4882a593Smuzhiyun generate super large order pages to fit ``slub_min_objects`` 172*4882a593Smuzhiyun of a slab cache with large object sizes into one high order 173*4882a593Smuzhiyun page. Setting command line parameter 174*4882a593Smuzhiyun ``debug_guardpage_minorder=N`` (N > 0), forces setting 175*4882a593Smuzhiyun ``slub_max_order`` to 0, what cause minimum possible order of 176*4882a593Smuzhiyun slabs allocation. 177*4882a593Smuzhiyun 178*4882a593SmuzhiyunSLUB Debug output 179*4882a593Smuzhiyun================= 180*4882a593Smuzhiyun 181*4882a593SmuzhiyunHere is a sample of slub debug output:: 182*4882a593Smuzhiyun 183*4882a593Smuzhiyun ==================================================================== 184*4882a593Smuzhiyun BUG kmalloc-8: Right Redzone overwritten 185*4882a593Smuzhiyun -------------------------------------------------------------------- 186*4882a593Smuzhiyun 187*4882a593Smuzhiyun INFO: 0xc90f6d28-0xc90f6d2b. First byte 0x00 instead of 0xcc 188*4882a593Smuzhiyun INFO: Slab 0xc528c530 flags=0x400000c3 inuse=61 fp=0xc90f6d58 189*4882a593Smuzhiyun INFO: Object 0xc90f6d20 @offset=3360 fp=0xc90f6d58 190*4882a593Smuzhiyun INFO: Allocated in get_modalias+0x61/0xf5 age=53 cpu=1 pid=554 191*4882a593Smuzhiyun 192*4882a593Smuzhiyun Bytes b4 (0xc90f6d10): 00 00 00 00 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a ........ZZZZZZZZ 193*4882a593Smuzhiyun Object (0xc90f6d20): 31 30 31 39 2e 30 30 35 1019.005 194*4882a593Smuzhiyun Redzone (0xc90f6d28): 00 cc cc cc . 195*4882a593Smuzhiyun Padding (0xc90f6d50): 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ 196*4882a593Smuzhiyun 197*4882a593Smuzhiyun [<c010523d>] dump_trace+0x63/0x1eb 198*4882a593Smuzhiyun [<c01053df>] show_trace_log_lvl+0x1a/0x2f 199*4882a593Smuzhiyun [<c010601d>] show_trace+0x12/0x14 200*4882a593Smuzhiyun [<c0106035>] dump_stack+0x16/0x18 201*4882a593Smuzhiyun [<c017e0fa>] object_err+0x143/0x14b 202*4882a593Smuzhiyun [<c017e2cc>] check_object+0x66/0x234 203*4882a593Smuzhiyun [<c017eb43>] __slab_free+0x239/0x384 204*4882a593Smuzhiyun [<c017f446>] kfree+0xa6/0xc6 205*4882a593Smuzhiyun [<c02e2335>] get_modalias+0xb9/0xf5 206*4882a593Smuzhiyun [<c02e23b7>] dmi_dev_uevent+0x27/0x3c 207*4882a593Smuzhiyun [<c027866a>] dev_uevent+0x1ad/0x1da 208*4882a593Smuzhiyun [<c0205024>] kobject_uevent_env+0x20a/0x45b 209*4882a593Smuzhiyun [<c020527f>] kobject_uevent+0xa/0xf 210*4882a593Smuzhiyun [<c02779f1>] store_uevent+0x4f/0x58 211*4882a593Smuzhiyun [<c027758e>] dev_attr_store+0x29/0x2f 212*4882a593Smuzhiyun [<c01bec4f>] sysfs_write_file+0x16e/0x19c 213*4882a593Smuzhiyun [<c0183ba7>] vfs_write+0xd1/0x15a 214*4882a593Smuzhiyun [<c01841d7>] sys_write+0x3d/0x72 215*4882a593Smuzhiyun [<c0104112>] sysenter_past_esp+0x5f/0x99 216*4882a593Smuzhiyun [<b7f7b410>] 0xb7f7b410 217*4882a593Smuzhiyun ======================= 218*4882a593Smuzhiyun 219*4882a593Smuzhiyun FIX kmalloc-8: Restoring Redzone 0xc90f6d28-0xc90f6d2b=0xcc 220*4882a593Smuzhiyun 221*4882a593SmuzhiyunIf SLUB encounters a corrupted object (full detection requires the kernel 222*4882a593Smuzhiyunto be booted with slub_debug) then the following output will be dumped 223*4882a593Smuzhiyuninto the syslog: 224*4882a593Smuzhiyun 225*4882a593Smuzhiyun1. Description of the problem encountered 226*4882a593Smuzhiyun 227*4882a593Smuzhiyun This will be a message in the system log starting with:: 228*4882a593Smuzhiyun 229*4882a593Smuzhiyun =============================================== 230*4882a593Smuzhiyun BUG <slab cache affected>: <What went wrong> 231*4882a593Smuzhiyun ----------------------------------------------- 232*4882a593Smuzhiyun 233*4882a593Smuzhiyun INFO: <corruption start>-<corruption_end> <more info> 234*4882a593Smuzhiyun INFO: Slab <address> <slab information> 235*4882a593Smuzhiyun INFO: Object <address> <object information> 236*4882a593Smuzhiyun INFO: Allocated in <kernel function> age=<jiffies since alloc> cpu=<allocated by 237*4882a593Smuzhiyun cpu> pid=<pid of the process> 238*4882a593Smuzhiyun INFO: Freed in <kernel function> age=<jiffies since free> cpu=<freed by cpu> 239*4882a593Smuzhiyun pid=<pid of the process> 240*4882a593Smuzhiyun 241*4882a593Smuzhiyun (Object allocation / free information is only available if SLAB_STORE_USER is 242*4882a593Smuzhiyun set for the slab. slub_debug sets that option) 243*4882a593Smuzhiyun 244*4882a593Smuzhiyun2. The object contents if an object was involved. 245*4882a593Smuzhiyun 246*4882a593Smuzhiyun Various types of lines can follow the BUG SLUB line: 247*4882a593Smuzhiyun 248*4882a593Smuzhiyun Bytes b4 <address> : <bytes> 249*4882a593Smuzhiyun Shows a few bytes before the object where the problem was detected. 250*4882a593Smuzhiyun Can be useful if the corruption does not stop with the start of the 251*4882a593Smuzhiyun object. 252*4882a593Smuzhiyun 253*4882a593Smuzhiyun Object <address> : <bytes> 254*4882a593Smuzhiyun The bytes of the object. If the object is inactive then the bytes 255*4882a593Smuzhiyun typically contain poison values. Any non-poison value shows a 256*4882a593Smuzhiyun corruption by a write after free. 257*4882a593Smuzhiyun 258*4882a593Smuzhiyun Redzone <address> : <bytes> 259*4882a593Smuzhiyun The Redzone following the object. The Redzone is used to detect 260*4882a593Smuzhiyun writes after the object. All bytes should always have the same 261*4882a593Smuzhiyun value. If there is any deviation then it is due to a write after 262*4882a593Smuzhiyun the object boundary. 263*4882a593Smuzhiyun 264*4882a593Smuzhiyun (Redzone information is only available if SLAB_RED_ZONE is set. 265*4882a593Smuzhiyun slub_debug sets that option) 266*4882a593Smuzhiyun 267*4882a593Smuzhiyun Padding <address> : <bytes> 268*4882a593Smuzhiyun Unused data to fill up the space in order to get the next object 269*4882a593Smuzhiyun properly aligned. In the debug case we make sure that there are 270*4882a593Smuzhiyun at least 4 bytes of padding. This allows the detection of writes 271*4882a593Smuzhiyun before the object. 272*4882a593Smuzhiyun 273*4882a593Smuzhiyun3. A stackdump 274*4882a593Smuzhiyun 275*4882a593Smuzhiyun The stackdump describes the location where the error was detected. The cause 276*4882a593Smuzhiyun of the corruption is may be more likely found by looking at the function that 277*4882a593Smuzhiyun allocated or freed the object. 278*4882a593Smuzhiyun 279*4882a593Smuzhiyun4. Report on how the problem was dealt with in order to ensure the continued 280*4882a593Smuzhiyun operation of the system. 281*4882a593Smuzhiyun 282*4882a593Smuzhiyun These are messages in the system log beginning with:: 283*4882a593Smuzhiyun 284*4882a593Smuzhiyun FIX <slab cache affected>: <corrective action taken> 285*4882a593Smuzhiyun 286*4882a593Smuzhiyun In the above sample SLUB found that the Redzone of an active object has 287*4882a593Smuzhiyun been overwritten. Here a string of 8 characters was written into a slab that 288*4882a593Smuzhiyun has the length of 8 characters. However, a 8 character string needs a 289*4882a593Smuzhiyun terminating 0. That zero has overwritten the first byte of the Redzone field. 290*4882a593Smuzhiyun After reporting the details of the issue encountered the FIX SLUB message 291*4882a593Smuzhiyun tells us that SLUB has restored the Redzone to its proper value and then 292*4882a593Smuzhiyun system operations continue. 293*4882a593Smuzhiyun 294*4882a593SmuzhiyunEmergency operations 295*4882a593Smuzhiyun==================== 296*4882a593Smuzhiyun 297*4882a593SmuzhiyunMinimal debugging (sanity checks alone) can be enabled by booting with:: 298*4882a593Smuzhiyun 299*4882a593Smuzhiyun slub_debug=F 300*4882a593Smuzhiyun 301*4882a593SmuzhiyunThis will be generally be enough to enable the resiliency features of slub 302*4882a593Smuzhiyunwhich will keep the system running even if a bad kernel component will 303*4882a593Smuzhiyunkeep corrupting objects. This may be important for production systems. 304*4882a593SmuzhiyunPerformance will be impacted by the sanity checks and there will be a 305*4882a593Smuzhiyuncontinual stream of error messages to the syslog but no additional memory 306*4882a593Smuzhiyunwill be used (unlike full debugging). 307*4882a593Smuzhiyun 308*4882a593SmuzhiyunNo guarantees. The kernel component still needs to be fixed. Performance 309*4882a593Smuzhiyunmay be optimized further by locating the slab that experiences corruption 310*4882a593Smuzhiyunand enabling debugging only for that cache 311*4882a593Smuzhiyun 312*4882a593SmuzhiyunI.e.:: 313*4882a593Smuzhiyun 314*4882a593Smuzhiyun slub_debug=F,dentry 315*4882a593Smuzhiyun 316*4882a593SmuzhiyunIf the corruption occurs by writing after the end of the object then it 317*4882a593Smuzhiyunmay be advisable to enable a Redzone to avoid corrupting the beginning 318*4882a593Smuzhiyunof other objects:: 319*4882a593Smuzhiyun 320*4882a593Smuzhiyun slub_debug=FZ,dentry 321*4882a593Smuzhiyun 322*4882a593SmuzhiyunExtended slabinfo mode and plotting 323*4882a593Smuzhiyun=================================== 324*4882a593Smuzhiyun 325*4882a593SmuzhiyunThe ``slabinfo`` tool has a special 'extended' ('-X') mode that includes: 326*4882a593Smuzhiyun - Slabcache Totals 327*4882a593Smuzhiyun - Slabs sorted by size (up to -N <num> slabs, default 1) 328*4882a593Smuzhiyun - Slabs sorted by loss (up to -N <num> slabs, default 1) 329*4882a593Smuzhiyun 330*4882a593SmuzhiyunAdditionally, in this mode ``slabinfo`` does not dynamically scale 331*4882a593Smuzhiyunsizes (G/M/K) and reports everything in bytes (this functionality is 332*4882a593Smuzhiyunalso available to other slabinfo modes via '-B' option) which makes 333*4882a593Smuzhiyunreporting more precise and accurate. Moreover, in some sense the `-X' 334*4882a593Smuzhiyunmode also simplifies the analysis of slabs' behaviour, because its 335*4882a593Smuzhiyunoutput can be plotted using the ``slabinfo-gnuplot.sh`` script. So it 336*4882a593Smuzhiyunpushes the analysis from looking through the numbers (tons of numbers) 337*4882a593Smuzhiyunto something easier -- visual analysis. 338*4882a593Smuzhiyun 339*4882a593SmuzhiyunTo generate plots: 340*4882a593Smuzhiyun 341*4882a593Smuzhiyuna) collect slabinfo extended records, for example:: 342*4882a593Smuzhiyun 343*4882a593Smuzhiyun while [ 1 ]; do slabinfo -X >> FOO_STATS; sleep 1; done 344*4882a593Smuzhiyun 345*4882a593Smuzhiyunb) pass stats file(-s) to ``slabinfo-gnuplot.sh`` script:: 346*4882a593Smuzhiyun 347*4882a593Smuzhiyun slabinfo-gnuplot.sh FOO_STATS [FOO_STATS2 .. FOO_STATSN] 348*4882a593Smuzhiyun 349*4882a593Smuzhiyun The ``slabinfo-gnuplot.sh`` script will pre-processes the collected records 350*4882a593Smuzhiyun and generates 3 png files (and 3 pre-processing cache files) per STATS 351*4882a593Smuzhiyun file: 352*4882a593Smuzhiyun - Slabcache Totals: FOO_STATS-totals.png 353*4882a593Smuzhiyun - Slabs sorted by size: FOO_STATS-slabs-by-size.png 354*4882a593Smuzhiyun - Slabs sorted by loss: FOO_STATS-slabs-by-loss.png 355*4882a593Smuzhiyun 356*4882a593SmuzhiyunAnother use case, when ``slabinfo-gnuplot.sh`` can be useful, is when you 357*4882a593Smuzhiyunneed to compare slabs' behaviour "prior to" and "after" some code 358*4882a593Smuzhiyunmodification. To help you out there, ``slabinfo-gnuplot.sh`` script 359*4882a593Smuzhiyuncan 'merge' the `Slabcache Totals` sections from different 360*4882a593Smuzhiyunmeasurements. To visually compare N plots: 361*4882a593Smuzhiyun 362*4882a593Smuzhiyuna) Collect as many STATS1, STATS2, .. STATSN files as you need:: 363*4882a593Smuzhiyun 364*4882a593Smuzhiyun while [ 1 ]; do slabinfo -X >> STATS<X>; sleep 1; done 365*4882a593Smuzhiyun 366*4882a593Smuzhiyunb) Pre-process those STATS files:: 367*4882a593Smuzhiyun 368*4882a593Smuzhiyun slabinfo-gnuplot.sh STATS1 STATS2 .. STATSN 369*4882a593Smuzhiyun 370*4882a593Smuzhiyunc) Execute ``slabinfo-gnuplot.sh`` in '-t' mode, passing all of the 371*4882a593Smuzhiyun generated pre-processed \*-totals:: 372*4882a593Smuzhiyun 373*4882a593Smuzhiyun slabinfo-gnuplot.sh -t STATS1-totals STATS2-totals .. STATSN-totals 374*4882a593Smuzhiyun 375*4882a593Smuzhiyun This will produce a single plot (png file). 376*4882a593Smuzhiyun 377*4882a593Smuzhiyun Plots, expectedly, can be large so some fluctuations or small spikes 378*4882a593Smuzhiyun can go unnoticed. To deal with that, ``slabinfo-gnuplot.sh`` has two 379*4882a593Smuzhiyun options to 'zoom-in'/'zoom-out': 380*4882a593Smuzhiyun 381*4882a593Smuzhiyun a) ``-s %d,%d`` -- overwrites the default image width and height 382*4882a593Smuzhiyun b) ``-r %d,%d`` -- specifies a range of samples to use (for example, 383*4882a593Smuzhiyun in ``slabinfo -X >> FOO_STATS; sleep 1;`` case, using a ``-r 384*4882a593Smuzhiyun 40,60`` range will plot only samples collected between 40th and 385*4882a593Smuzhiyun 60th seconds). 386*4882a593Smuzhiyun 387*4882a593SmuzhiyunChristoph Lameter, May 30, 2007 388*4882a593SmuzhiyunSergey Senozhatsky, October 23, 2015 389