Z/OS Basics: Virtual Storage Management (VSM) Overview

Transcription

IBM Systems & Technolgy Groupz/OS Basics: Virtual StorageManagement (VSM) OverviewElpida Tzortzatos – email: elpida@us.ibm.com1 2009 IBM Corporation

Agendaz/OS Memory/Storage Types z/OS Memory Managers 31-Bit VSM Basics Recent Enhancements 64-BitVSM/RSMBasics Recent Enhancements Appendices CSA Common Storage Tracker2

z/OS Memory/Storage Types3

z/OS Memory Types Memory management viewsPageDatasetsReal storageframes (physicalCPU memory)Virtual pages inmultiple address spaces(created through DAT)Auxiliary slots on(DASD) volumes(paging datasets)4

z/OS Memory Controls Real Virtual Mixture of z/OS internal thresholds and system-wideparametersCustomer-specified policies via JCL, SystemManagement Facility (SMF) parameters and exitsGenerally either prevent work exceeding the limitsfrom starting or causes work to terminate if itexceeds a limit during executionProcess-level granularityAux z/OS internal thresholds coupled with paging datasetconfiguration: number of datasets, size of each5

Storage Types (all with respect to z/OS’s point of view) Virtual memory/storage DATDAT-on addressingExplicitly allocated either by the system or applications24, 31, or 64 bit residency mode (rmode(rmode))3131-bit virtual is allocated/freed in multiple of 8 byte chunks6464-bit virtual is allocated in 1MB multiples on a 1M boundaryVirtual storage attributes are specified when virtual storage is allocated Real memory/storage Based on addressing mode of application and whether or not the “real view”view” will be usedExample: the ordinary 3131-bit application requires 3131-bit virtual pages but the frame backingeach page may have a 6464-bit real addressExpanded storage DATDAT-off addressing, Real Space ALET, I/O, some privileged opop-codes specify real addresses4 KB page frames (often: just “frames”frames”), 1MB page frames (often just “large pages”pages”)24, 31, or 64 bit residency mode (rmode(rmode))Each memory allocation request to z/OS specifies allowable virtual and real rmodes Fixed (pinned), DREF, pageable,pageable, 1MB pagesWhen physical resources (real memory/paging space) are assigned to virtual storage depends on thevirtual storage attributesNo longer used by z/OSMidMid-1980s to early 2000s, electronic storage with characteristics betweenbetween real and auxiliaryin terms of response time and monetary costFunctioned mostly as a fast synchronous paging deviceAuxiliary (storage, on Disk/DASD) Used for paging and swapping4 KB slots in one or more paging datasetsInvisible to applications6

Virtual/Real MapTheoretical Max 16 EB (2**64)64 bitaddressable4 TBCurrent maximumreal storagesupported by z/OS“The Bar” 2 GB“The Line” 16 MB31 bit addressable24 bit addressableLow memory address: 07

z/OS Memory Managers8

z/OS Memory Managers: VSMVirtual Storage ManagerAddress Space-centric view of the system andprocessesObjectives 1.2.Control the allocation/deallocation of 31/64-bit virtual storageaddressesObey policies imposed on it by customer specified limits1.3. Each installation can use virtual storage parameters (inSys1.Parmlib,JCL, SMF) to specify how certain virtual storageareas are to be allocated to programsEfficiency – minimum overhead per requestAssociate a storage protection key with each virtualstorage block requestedMaintain storage use information by generating SMFrecords.9

z/OS Memory Managers: RSMReal Storage ManagerFrame-centric view of the system and processesObjectives 1.2.3.4.Keep the system upObey policies imposed on it by the customer, SRMEfficiency – minimum overhead per requestManage 64-bit storage requestsResource pools Expanded frames (historical only)Real storage frames Individual framesFrame pairs: 2 contiguous in real on particular boundaryQuad frames: 4 contiguous in real on particular boundaryMajor policy knobs that control its behavior Optional per-process minimum/maximum number of frames Processes below minimum stolen from last, above maximum firstSystem-wide thresholds controlling paging Begin stealing when less than X frames unallocated, steal until Y frames available10

Dynamic Address Translation V ir t u a l A d d r e s s S p a c e seSzASCEA S C E .6 0 -6 11 1 - R e g io n 1 s t ta b le1 0 - R e g io n 2 n d t a b le0 1 - R e g io n 3 r d t a b le0 0 - S e g m e n t t a b leP a g e Ta b leerisD a ta P a g eSegm entTa b leR e g io n 3 r dTa b leR e g io n 2 n dTa b leE ffe c tiv e V ir tu a l A d d r e s sR e g io n 1 s tTa b le11RFX111111812RSXRTXSXPXBXT r a n s la tio n c a n s ta r t a t R 1 T , R 2 T , R 3 T o r S G TT h e s ta r tin g p o in t o f th e tr a n s la tio n is d e s ig n a te d inth e A d d r e s s S p a c e C o n tr o l E le m e n t ( A S C E .6 0 - 6 1 )C o p y r ig h t IB M C o r p o r a tio n 2 0 0 0 , 2 0 0 111

Large (1MB) Page DATArchitectureASCEASCE.60-6111 - Region 1st table10 - Region 2nd table01 - Region 3rd table00 - Segment tableLarge Data PageSegmentTableRegion 2ndTableRegion 1stTable.Region 3rdTableEffective Virtual Address11RFX11RSX11RTX11SX20BXTranslation can start at R1T, R2T, R3T or SGTThe starting point of the translation is designated inthe Address Space Control Element (ASCE.60-61)12

z/OS Memory Managers: ASMAuxiliary Storage ManagerPaging-centric view of the system; virtually no process awarenessObjectives 1.Efficiency – minimum overhead per request Highly optimized Slot allocation efficiency falls dramatically once utilization ofof a dataset rises above 30%ASM tries to equalize the number of slots allocated across the datasets,datasets, not their % allocatedRelies on other managers to only give it sensible requestsAn auxiliary storage slot is allocated to a page when the page isis paged outAn aux slot is freed when the page is freed or reused when the pagepage is paged outagainPeriodically RSM calls ASM to free slots for pages that are changedchanged in real storageResource pools 1-n Paging datasets formatted into 4 KB slots Called paging datasets, but used for both paged out and physicallyphysically swapped framesMajor policy knobs that control its behavior Number of paging datasets and size of each Datasets may be different sizes13

31-Bit VSM14

Virtual memory/storage DAT-on addressingExplicitly allocated either by the system or applications24, 31, or 64 bit residency mode (rmode)31-bit virtual is allocated/freed in multiple of 8 byte chunks64-bit virtual is allocated in 1MB multiples on a 1M boundaryVirtual storage attributes are specified when virtual storage isallocated Fixed (pinned), DREF, pageable, 1MB pagesWhen physical resources (real memory/paging space) are assignedto virtual storage depends on the virtual storage attributes15

31-Bit Address Space Memory Map2 Gig 80000000Extended Private16 Meg 1000000Extended CSAExtended LPAExtended SQAExtended NucleusNucleusSQALPACSAPrivate600020000System RegionPSAGlobal storage includes Nucleus,Extended Nucleus, SQA, ESQA,LPA, ELPA, CSA, and ECSAGlobal storage managed by VSMincludes SQA, ESQA, CSA, andECSAUpper boundary of ECSA storageand lower boundary of CSAstorage are always on aMegabyte boundarySizes of SQA, ESQA, CSA, andECSA storage are specified at IPLtime via the IEASYSxx parmlibmember16

Local Storage AreaLSQA / SWA / high pvtUser regionAuthorized storage (LSQA, SWA, and highprivate) is assigned from the high end of the localstorage box. In other words, this storage growsfrom the top of the box down.Unauthorized storage (user region) isassigned from the low end of the localstorage box. It grows from the bottom of thebox up.17

z/OS Memory Managers: VSMV S M S to ra g e M a n a g e m e n t R u le sM V S m a n a g e s s to ra g e th ro u g h th e u s e o f s u b p o o lsd e s ig n e d to a c c o m m o d a te a v a rie ty o f s to ra g e n e e d sS to ra g e is a llo c a te d o r a s s ig n e d to a s u b p o o l in o n ep a g e (4 K ) m u ltip le sS to ra g e b e lo n g in g to d iffe re n t s u b p o o ls c a n n o t o c c u p yth e s a m e p a g eS to ra g e w ith d iffe re n t s to ra g e k e y s c a n n o t o c c u p y th esam e pageS to ra g e b e lo n g in g to d iffe re n t T C B s c a n n o t o c c u p y th esam e page18

z/OS Memory Managers: VSMV S M S to ra g e M a n a g e m e n t R u le sW h e n th e re is n o t e n o u g h s to ra g e a b o v e th e lin e tofu lfill a n a b o v e th e lin e s to ra g e re q u e s t, V S M w illa tte m p t to h o n o r th e re q u e s t fro m b e lo w th e lin ein s te a dL S Q A / S W A / h ig h p riv a te p a g e s m a y n o t in te rm ixw ith u s e r re g io n p a g e sU n le s s o th e rw is e d ire c te d o n th e G E T M A INre q u e s t, V S M w ill g iv e o u t s to ra g e a t th e h ig h e n do f th e p a g e firs t19

z/OS Memory Managers: VSMP riv a te S u b p o o l A ttrib u te sS u b p o o l n u m b e rs 0 - 2 5 5S to r a g e p ro te c tio n K e y s 0 - 1 5U s e r R e g io n s u b p o o ls0 - 132, 250 - 252T C B -re la te dK e y e d s to ra g eU n a u th o riz e dG e n e ra l p u rp o s e s u b p o o ls* S e e M V S D ia g n o s is : R e fe r e n c e , C h a p te r 8 ,fo r a d d itio n a l s u b p o o l in fo r m a tio n .H ig h P riv a te s u b p o o ls229, 230, 249T C B -re la te dK e y e d s to ra g eA u th o riz e dS p e c ia l a u th o riz e da p p lic a tio n s to ra g eneedsLSQA2 5 5 (m a in ly )F ix e d , k e y 0 s to ra g eA d d re s s s p a c e -re la te d ,n o t T C B -re la te d20

Virtual Storage Allocation GETMAIN, STORAGE OBTAIN, or CPOOL macro requiredfor virtual storage allocation.GETMAIN will get storage from subpool 0STORAGE OBTAIN obtains storage in the primaryaddress space (by default) or in the address spacedefined through the ALET parameterNOTE: Compared to GETMAIN, STORAGE OBTAINprovides an easier-to-use interface and has fewerrestrictions. For programs running in AR mode or crossmemory mode use the STORAGE OBTAIN macro toobtain storage.Cellpool (carve storage as wanted after doing an initialGETMAIN - specify size of storage needed at each time)21

GETMAIN and STORAGE OBTAINUsing LOC Option LOC parameter on GETMAIN macro and/or STORAGE OBTAINindicates location of requested virtual storage and real storage whenthe page is fixed.Allows storage to be acquired anywhere in the 2 gigabyte addressrange.Caller can be in 24, 31, or 64 bit AMODEAll values and addresses are treated as 31-bit values and addresses.Specifying LOC(xx,64) indicates that central storage (real) can belocated anywhere in 64-bit storage.The LOC parameter is only valid for the following GETMAIN options RU - Register, Unconditional (get storage, if not available, ABEND)RC - Register, Conditional (get storage, return code, won't ABEND)VRU - Variable, Unconditional (between 200 and 500 bytes long, will tryto give 500 at worst, give 200, if not 200 ABEND)VRC - Variable, Conditional (if not minimum, get return code)22

Returning Virtual Storage STORAGE RELEASE releases storage in theprimary address space (by default) or in theaddress space defined through the ALETparameterFREEMAIN options Register, UnconditionalRegister, ConditionalTo free storage above the 16 MB line the RU/RCoptions of the FREEMAIN macro must be used.23

Obtaining Storage via CPOOL The CPOOL macro provides faster storage managementthan GETMAIN macroThe following services are available: Create a Cell Pool (Build) Obtain a Cell from an existing pool ?CPOOL (GET) UNCOND . . . ;Return a Cell to a Cell pool ?CPOOL (GET) COND . . . ;Extend a Cell pool, if necessary ?CPOOL (BUILD) . . . ;?CPOOL (FREE) . . . ;Free an entire Cell Pool ?CPOOL (DELETE) . . . ;24

IBM Systems & Technology GroupVSM GETMAIN Changes in z/OS 1.10 Problem:– A large number of datasets are opened in theDB2 address space. This causes VSAM to do alot of GETMAINs/STORAGE OBTAINs** insubpool 252. This creates a long chain of DQEs for subpool 252 inthe DB2 address space. Long DQE chains causeperformance problems** Subsequent references to GETMAIN also apply to STORAGEOBTAIN25 2009 IBM Corporation

IBM Systems & Technology GroupVSM GETMAIN Changes in z/OS 1.10 Solution– Allocate virtual storage described by DQEs forlow private from the bottom of the page up,instead of from the top of the page down– This change in VSM allocation processing allowsfor a new allocation request to be merged into anexisting DQE since the address range iscontiguous; only the DQE size has to change26 2009 IBM Corporation

IBM Systems & Technology GroupVSM GETMAIN Changes in z/OS 1.10 Implementation Details (via DIAGxx)With APAR OA27291 / PTF UA45583 installed:– To enable this new behavior, code the following in theactive DIAGxx member:– VSM UsezOSV1R9Rules(No)– To revert back to the old algorithm of allocating virtualstorage in low private subpools, use “set diag xx” whereDIAGxx specifies the following:– VSM UsezOSV1R9Rules(Yes) – this is the z/OS 1.10 system default– Allocations are performed according to the current settingfor UsezOSV1R9Rules; prior allocations are not affectedby changing the DIAGxx value27 2009 IBM Corporation

IBM Systems & Technology GroupVSM Changes in z/OS 1.10Allocation Times 200k Data Sets - UsezOSV1R9Rules908070VSM USEzOSV1R9Rules YesMinutes6050403020VSM UsezOSV1R9Rules No100110192837465564738291100 109 118 127#Dsn (VSAM non-SMS) Allocations (in k)136 145 154 163 172 181190 199Z9 processor with 16 CPsVSM UsezOSV1R9Rules YES (R10 default)28 2009 IBM Corporation

IBM Systems & Technology GroupVSM GETMAIN Changes in z/OS 1.10 How can this change affect you? Properly coded programs can benefit from thesechanges. Some, such as DB2, may get a significantperformance benefit. This change can have a negative affect on someprograms which have made unwarranted assumptionsabout internal VSM behavior.1) These changes may give the perception in some cases thatstorage is not being cleared to zero as it previously was.However, storage is cleared by the system no differently inz/OS 1.10 than it was previously.2) These changes mean that a program cannot assume that aGETMAINed area ends on the last byte of the page; while thiswas never guaranteed, it was a common VSM behavior priorto z/OS 1.10.29 2009 IBM Corporation

IBM Systems & Technology GroupVSM GETMAIN Changes in z/OS 1.10 Cautionary Example #1– Do not assume storage is cleared to zeroesunless the GETMAIN either Is for 8192 bytes or more from a pageable, private storagesubpool. Is for 4096 bytes or more from a pageable, private storagesubpool, with BNDRY PAGE specified Specifies CHECKZERO YES and return code is 0.– Storage requests that previously returned anaddress on a freshly GETMAINed page (and wastherefore cleared to zeroes) may now return anaddress on an existing page that containsresidual (garbage) data.30 2009 IBM Corporation

IBM Systems & Technology GroupVSM GETMAIN Changes in z/OS 1.10 Cautionary Example #2– Do not make start/end boundary alignmentassumptions based on the size of virtualstorage being allocated Use STARTBDY to specify the boundary theobtained storage must start on Use CONTBDY to specify the boundary theobtained storage must be contained within– Storage requests that previously returned anaddress that ended on the last byte of a pagemay now return an address that does notend on a page boundary.31 2009 IBM Corporation

IBM Systems & Technology GroupExample 2: VSM Low Private Storage Processing pre-z/OS 1.10Getmain for 8192 bytes fromsubpool 252 then freemain2048 bytes at address74F51800Getmain for 7168 bytes fromsubpool 252 returned virtualends on last byte of the page74F51FFF74F518002048 Bytes7168 Bytes6144 Bytes2 Pages74F53FFF2 Pages74F50000Returned Getmain Address 74F50000DQE A: Addr 74F50000 size‘2000’X (2 pages)1024 Bytes74F5240074F52000Returned Getmain Address 74F52400DQE B: Addr 74F52000 Size ‘2000’XFQE: Addr 74F52000 size ‘400’XFQE: Addr 74F51800 size ‘800’X32 2009 IBM Corporation

IBM Systems & Technology GroupExample 2: VSM Low Private Storage Processing z/OS 1.10Getmain for 7168 bytes fromsubpool 252: returned virtualdoes not end on a pageboundaryGetmain for 8192 bytes fromsubpool 252 then freemain2048 bytes at address74F5180074F51FFF74F540003072 Bytes4 Pages7168 bytes2048 Bytes74F518006144 Bytes2 Pages13312 Bytes74F53400ReturnedGETMAIN address 74F5180074F51800ReturnedGETMAIN address 74F5000074F50000DQE A: Addr 74F50000 Size 200074F50000DQE A: Addr 74F50000 Size 4000FQE: Addr 74F51800 size 800FQE: Addr 74F53400 size C0033 2009 IBM Corporation

IBM Systems & Technology GroupVSM GETMAIN Changes in z/OS 1.10SUMMARY of pre-z/OS V1R9 allocationbehavior:– Storage is more likely to be obtained from afresh page (which makes it more likely to becleared to binary zeroes)– Storage is allocated from the top (highaddress) of the page to bottom (loweraddress)– Unless a GETMAIN request can be satisfiedentirely from an existing FQE, a new DQEmust be obtained for each GETMAIN request34 2009 IBM Corporation

IBM Systems & Technology GroupVSM Diagxx Changes in z/OS 1.10SUMMARY of z/OS V1R10 allocation behavior: Using VSM UsezOSV1R9Rules(YES)– Same as pre-z/OS 1.10 Using VSM USEzOSV1R9Rules(NO)– Storage requests are more likely to be carved from areasthat were previously obtained with the GETMAIN requests(which means they may contain residual data).– Storage is allocated from the bottom (lower address) of thepage to top (higher address).– Storage requests may now be satisfied partly from an FQEallowing new allocation request to be merged into anexisting DQE35 2009 IBM Corporation

IBM Systems & Technology GroupVSM CPOOL Changes in z/OS 1.9 Problem Statement: Heavy usage of the CPOOL system service leads toCPU “Hot Cache Lines” for the CPOOL headers,degrading system performance Solution: Provide a multiple header option for CPOOL toeliminate the “Hot Cache Line” problem36 2009 IBM Corporation

IBM Systems & Technology GroupVSM CPOOL Changes in z/OS 1.9 Using CPOOL Service Enhancements customers areexpected to See improved performance in workloads involvingheavy usage of z/OS UNIX and/or GRS services Value: Customers are expected to get greater throughputon their systems leading to more transactions persecond, etc 37 2009 IBM Corporation

IBM Systems & Technology GroupVSM CPOOL Changes in z/OS 1.9 CPOOL Service Enhancements will allow a system componentor authorized application to: Use MULTIHDR YES on CPOOL BUILD to create a multipleheader Cell Pool Use MULTIHDR YES on CPOOL GET/FREE to get and freeelements from the Cell Pool Use CPOOL LIST, CPOOL DELETE, VSMLOC and IPCSRUNCPOOL functions against the multiple header Cell Pool38 2009 IBM Corporation

IBM Systems & Technology GroupVSM CPOOL Changes in z/OS 1.9CPOOL BUILD Newoption MULTIHDR YES causes creation of a cell pool with 256byte headers for the maximum number of CPUs allowed on thesystem Available to authorized callers only (System Key, APFAuthorized or Supervisor State) New keywords available with MULTIHDR YES only:only MAXCELLS nnnn indicates maximum number of cells to beallowed in cell pool before expansion will be stopped onconditional GET requests. CELLSPERCPU nnnn indicates the number of cells to beallocated per CPU extent39 2009 IBM Corporation

IBM Systems & Technology GroupVSM CPOOL Changes in z/OS 1.9CPOOL GET Newoption MULTIHDR YES causes the obtain of a cell from theheader associated with the running CPU COND YES callers will get a zero cell address returned if themaxcells limit has been reached for the cell pool and no cells arecurrently available for the running CPU40 2009 IBM Corporation

IBM Systems & Technology GroupVSM CPOOL Changes in z/OS 1.9CPOOL FREE Newoption MULTIHDR YES causes the release of a cell to theheader associated with the CPU it was obtained from41 2009 IBM Corporation

IBM Systems & Technology GroupVSM CPOOL Changes in z/OS 1.9CPOOL DELETE Causesthe deletion of the multiple header cell poolincluding the

z/OS Memory Managers 31-Bit VSM Basics Recent Enhancements 64-Bit VSM/RSM Basics Recent Enhancements Appendices CSA Common Storage Tracker. 3 z/OS Memory/Storage Types. 4 z/OS Memory Types Memory management views Page Datasets Auxiliary s