Pro Yearly is on sale from $80 to $50! »

SLUB data structures

SLUB data structures

457c3c757b4fae74c7cdc79ad67a5645?s=128

Masami Ichikawa

November 30, 2014
Tweet

Transcript

  1. 4-6# EBUBTUSVDUVSFT .BTBNJ*DIJLBXB !NBTBNJ

  2. 3&"%.& w ͜ͷεϥΠυ͸ҎԼͷ఺ʹߜͬͯ·͢ w 4-6#ͷσʔλߏ଄ w TMBCDBDIFͷ࡞੒ w Լهࢿྉʹ͋Δ4-6#EBUBTUSVDUVSFTΛཧղ͢Δ w

    IUUQFWFOUTMJOVYGPVOEBUJPOPSHTJUFTFWFOUTpMFT TMJEFTTMBCBMMPDBUPSTQEG w NFNPSZDPOUSPMHSPVQ΋བྷΉͷͰ͕͢ɺͦ͜͸ؾʹ͠ͳ͍ํ ޲ͰίʔυϦʔσΟϯάͯ͠·͢
  3. $PNNPOWBSJBCMFOBNF w TMVCDͰΑ͘࢖ΘΕΕΔม਺໊ w ͜ͷεϥΠυͰ΋୯ʹDͱॻ͍͍ͯΔ৔߹͸TUSVDULNFN@DBDIF@DQVͷม਺ Λࢦ͠·͢ w T w TUSVDULNFN@DBDIFͷม਺

    w D w TUSVDULNFN@DBDIF@DQVͷม਺ w O w TUSVDULNFN@DBDIF@OPEFͷม਺
  4. *NQPSUBOUWBSJBCMFT w TDQV@TMBC w ݱࡏͷDQVʹඥͮ͘TUSVDULNFN@DBDIF@DQV΁ͷϙΠϯλ w DQBHF w TMBCPCKFDU͕࢖༻͍ͯ͠ΔTUSVDUQBHF΁ͷϙΠϯλ w

    DGSFFMJTU w Ϧετͱ໊લ͕෇͍ͯΔ͕࣍ͷۭ͖TMBCΦϒδΣΫτΛࢦ͢
  5. 4MBCBMMPDBUPS JNQMFNFOUBUJPOTJO-JOVY w -JOVYʹ͓͚Δ4MBCBMMPDBUPS࣮૷ͷҰͭ w 4-"# w 4VO04ͷ4MBCBMMPDBUPSΞϧΰϦζϜʹجͮ͘ w 4-6#

    w ͔ΒσϑΥϧτͷ4MBCBMMPDBUPSʹ w ϝϞϦͷϑϥάϝϯςʔγϣϯ͕ൃੜ͠ʹ͍͘ w 4-0# w αΠζͷখ͍͞BMMPDBUPS
  6. 4-6#CBTJT w 4-"#ʹ͋ͬͨGVMMɺQBSUJBMɺFNQUZͱ͍ͬͨϦετʹΑ Δ؅ཧΛ͍ͯ͠ͳ͍ w TMBCPCKFDU΁͸TUSVDULNFN@DBDIF@DQVͷGSFFMJTU ΑΓࢀর w QBSUJBMMJTU͸͋Δ͚Ͳ4-"#ͱ͸ҧ͏࢖͍ํ w

    4MBCDBDIF࡞੒࣌ʹࣅͨαΠζͷεϥϒ͕͋Ε͹Ϛʔδ w $BDIF$PMPSJOHແ͠
  7. 4-6#NFSHF w εϥϒΩϟογϡ࡞੒࣌ʹ͢ͰʹಉαΠζͷεϥϒ͕͋Ε͹ͦ͜ ʹϚʔδ w TMBCJOGPBͰϚʔδ͞Εͨ4MBCΛ֬ೝՄೳ w LFSOFMTPVSDFUSFFʹ͋ΔUPPMTWNTMBCJOGPD :at-0000104 <-

    sda1 buffer_head :at-0000320 <- jbd2_transaction_s nfs_direct_cache :t-0000024 <- scsi_data_buffer numa_policy :t-0000032 <- sd_ext_cdb dnotify_struct kmalloc-32 :t-0000040 <- khugepaged_mm_slot Acpi-Namespace ext4_system_zone
  8. $BDIF$PMPSJOH w 4-"#Ͱ͸࢖༻͍ͯ͠Δ w 4-6#Ͱ͸࣮૷͍ͯ͠ͳ͍ w $ISJTUPQI͞Μᐌ͘ɺ͜Εʹ͍ͭͯ͸DQVͷ ΩϟογϡઃܭଆͰ໘౗ݟΔ΂͖ͩΖ͏ w IUUQTMLNMPSHMLNM

  9. .BJOTUSVDUVSFT w TUSVDULNFN@DBDIF w JODMVEFMJOVYTMVC@EFGI w TMBCPCKFDUΛ؅ཧ͢Δߏ଄ମ w Լهͷͭͷߏ଄ମ͸LNFN@DBDIFߏ଄ମͷϝϯόม਺ w

    TUSVDULNFN@DBDIF@DQV w JODMVEFMJOVYTMVC@EFGI w TMBCPCKFDU΁ͷΞΫηε͸͔͜͜Β w TUSVDULNFN@DBDIF@OPEF w NNTMBCI w /6."ϊʔυຖͷTMBCΛࢦ͢ w TUSVDUQBHF w GSFFMJTU΁ͷϙΠϯλɺΦϒδΣΫτ࢖༻਺ͳͲͷม਺͕௥Ճ͞Εͨ
  10. 4MBCPCKFDUGPSNBU w 4MBCPCKFUͷϑΥʔϚοτ͸ԼਤͷΑ͏ͳܗ w 0CKFDUͱQBEEJOHҎ֎͸σόοάػೳ޲͚

  11. 4MBCPCKFDUP⒎TFU w TUSVDULNFN@DBDIFͷม਺P⒎TFU w Լهͷ৚݅ʹ֘౰͢Δ৔߹ɺPCKFDUͷઌ಄ΞυϨεʴP⒎TFUόΠτ໨͔ΒΛTMBC PCKFDUʹ͢Δ w TMBCPCKFDUͷGSFF࣌ʹ3$6Λ࢖͏ w 4-"#@10*40/͕ηοτ͞Ε͍ͯΔ

    w ίϯετϥΫλ͕ࢦఆ͞Ε͍ͯΔ w P⒎TFU͸ԼهͷαΠζʹઃఆ͞ΕΔ w PCKFDUͷαΠζΛTJ[FPG WPJE ͷڥքʹ͋͏Α͏ʹBMJHOͨ͠αΠζ w 4-"#@3&%;0/&͕ηοτ͞Ε͍ͯΔ৔߹͸3&%;0/&ͷαΠζ΋଍͢
  12. TUSVDULNFN@DBDIF TUSVDULNFN@DBDIF\  TUSVDULNFN@DBDIF@DQV@@QFSDQV DQV@TMBC   6TFEGPSSFUSJWJOHQBSUJBMTMBCTFUD  

    VOTJHOFEMPOHqBHT  VOTJHOFEMPOHNJO@QBSUJBM  JOUTJ[F  5IFTJ[FPGBOPCKFDUJODMVEJOHNFUBEBUB   JOUPCKFDU@TJ[F  5IFTJ[FPGBOPCKFDUXJUIPVUNFUBEBUB   JOUP⒎TFU   'SFFQPJOUFSP⒎TFU   JOUDQV@QBSUJBM  /VNCFSPGQFSDQVQBSUJBMPCKFDUTUPLFFQBSPVOE   TUSVDULNFN@DBDIF@PSEFS@PCKFDUTPP ʙུʙ  TUSVDULNFN@DBDIF@OPEF OPEF<."9@/6./0%&4> ^ 4MBC0CKFDUͷ؅ཧ ʹ࢖͏ओͳม਺
  13. TUSVDULNFN@DBDIF@DQV TUSVDULNFN@DBDIF@DQV\  WPJE GSFFMJTU  1PJOUFSUPOFYUBWBJMBCMFPCKFDU   VOTJHOFEMPOHUJE

     (MPCBMMZVOJRVFUSBOTBDUJPOJE   TUSVDUQBHF QBHF  5IFTMBCGSPNXIJDIXFBSFBMMPDBUJOH   TUSVDUQBHF QBSUJBM 1BSUJBMMZBMMPDBUFEGSP[FOTMBCT  JGEFG$0/'*(@4-6#@45"54  VOTJHOFETUBU</3@4-6#@45"5@*5&.4> FOEJG ^
  14. TUSVDULNFN@DBDIF@OPEF TUSVDULNFN@DBDIF@OPEF\  TQJOMPDL@UMJTU@MPDL ʙུʙ JGEFG$0/'*(@4-6#  VOTJHOFEMPOHOS@QBSUJBM  TUSVDUMJTU@IFBEQBSUJBM

    JGEFG$0/'*(@4-6#@%&#6(  BUPNJD@MPOH@UOS@TMBCT  BUPNJD@MPOH@UUPUBM@PCKFDUT  TUSVDUMJTU@IFBEGVMM FOEJG FOEJG EFCVH༻్Λআ͘ͱMJTUͱݸ ਺Λอ࣋͢Δม਺͚ͩ
  15. TUSVDUQBHF  TUSVDU\   VOJPO\    QHP⒎@UJOEFY

      0VSP⒎TFUXJUIJONBQQJOH     WPJE GSFFMJTU   TM<BPV>CpSTUGSFFPCKFDU  ʙུʙ   ^   VOJPO\ ʙུʙ     6TFEGPSDNQYDIH@EPVCMFJOTMVC     VOTJHOFEMPOHDPVOUFST ʙུʙ    TUSVDU\     VOJPO\ ʙུ      TUSVDU\ 4-6#        VOTJHOFEJOVTF       VOTJHOFEPCKFDUT       VOTJHOFEGSP[FO      ^
  16. 4MBCEBUBSFMBUJPO w ݱࡏͷDQVͰ࢖༻͍ͯ͠ΔTMBC΁ͷΞΫηε w DΑΓΞΫηε w DGSFFMJTUɺDQBHFͳͲ w TDQV@TMBC͔Β֎͞ΕͨTMBC w

    TOPEF<OPEFOVNCFS>͔ΒΞΫηε
  17. None
  18. $SFBUFBTMBC w TMBCͷ࡞੒͸LNFN@DBDIF@DSFBUF  w ,.&.@$"$)& @@TUSVDU @@qBHT ɹϚΫϩ΋͋Δ w

    LNFN@DBDIF@DSFBUF ͷ࣌఺Ͱ͸TMBCPCKFDUTͷ࡞੒͸͠ͳ͍ w GSFFMJTUͷ࡞੒ɺTMBCPCKFDUͷॳظԽͳͲ͸LNFN@DBDIF@BMMPD ࣮ߦ࣌ w ॲཧ͸ஈ֊ w ࠷ॳʹTUSVDULNFN@DBDIFͷΦϒδΣΫτΛऔಘ w ࣍ʹऔಘͨ͠Tͷม਺Λઃఆ TUSVDULNFN@DBDIF  LNFN@DBDIF@DSFBUF DPOTUDIBS OBNF TJ[F@UTJ[F TJ[F@UBMJHO  VOTJHOFEMPOHqBHT WPJE DUPS WPJE
  19. TMBCDSFBUJOHqPX LNFN@DBDIF@DSFBUF  Š@@LNFN@DBDIF@BMJBT  ŠEP@LNFN@DBDIF@DSFBUF  ŠLNFN@DBDIF@[BMMPD  Š@@LNFN@DBDIF@DSFBUF

     ŠLNFN@DBDIF@PQFO  ŠDBMVDBMBUF@TJ[FT  ŠJOJU@LNFN@DBDIF@OPEFT  ŠBMMPD@LNFN@DBDIF@DQVT ओͳͱ͜Ζ
  20. LNFN@DBDIF@DSFBUF w LNFN@DBDIFߏ଄ମͷΦϒδΣΫτΛऔಘͯ͠ฦ͢ w ࡞੒͠Α͏ͱͨ͠TMBC͕ϚʔδՄೳ͔νΣοΫ w ϚʔδՄೳͳΒTMBCΦϒδΣΫτͷ࡞੒ͤͣʹऴྃ w EP@LNFN@DBDIF@DSFBUF ͰLNFN@DBDIFߏ଄ମͷ

    ΦϒδΣΫτ T Λऔಘ
  21. @@LNFN@DBDIF@BMJBT w ࡞੒͠Α͏ͱ͍ͯ͠ΔTMBC͕ϚʔδՄೳ͔ νΣοΫ w ࣮ࡍʹνΣοΫ͢Δͷ͸pOE@NFSHFBCMF  w ϚʔδՄೳͳΒϚʔδઌͷTΛฦ͢

  22. EP@LNFN@DBDIF@DSFBUF w LNFN@DBDIF@[BMMPD ͰTUSVDULNFN@DBDIFߏ଄ମͷΦϒδΣΫτΛऔಘ w LNFN@DBDIFߏ଄ମ͸TMVCͰ؅ཧ͞Ε͍ͯΔ w ͜ΕΛ؅ཧ͍ͯ͠ΔΦϒδΣΫτ͸LNFN@DBDIF w LFSOFMͷॳظԽ࣌ʹLNFN@DBDIF@JOJU

    ʹͯઃఆ w Tͷม਺ΛҰ෦ઃఆ w @@LNFN@DBDIF@DSFBUF ͰTͷઃఆ w TMBC@DBDIFTϦετʹTΛͭͳ͙ w શLNFN@DBDIFߏ଄ମΛͭͳ͍Ͱ͍ΔϦετ
  23. LNFN@DBDIF@[BMMPD w @@('1@;&30Λϑϥάʹઃఆͯ͠LNFN@DBDIF@BMMPD ΛݺͿ͚ͩ w LNFN@DBDIF@BMMPD ͸TMBC@BMMPD ͷϥούʔతͳ΋ͷ w TMBC@BMMPD

    ͸TMBC@BMMPD@OPEF ΁ͷϥούʔ w େࡶ೺ʹ͍͏ͱTUSVDULNFN@DBDIFߏ଄ମͷΠϯελϯ εΛऔಘͯ͠ฦ͢ w ͔͠͠ɺ͜ͷॲཧ͕؊ͳͷͰޙͷεϥΠυͰઆ໌͠·͢
  24. @@LNFN@DBDIF@DSFBUF w LNFN@DBDIF@PQFO ͰTͷॳظԽ w TZTGTͰΦϒδΣΫτ͕ݟ͑ΔΑ͏ʹઃఆ <SPPU!NJLPTMBC>MTBMTZTLFSOFMTMBC UPUBM ESXYSYSYSPPUSPPU%FD ESXYSYSYSPPUSPPU%FD

    MSXYSXYSXYSPPUSPPU%FD"DQJ/BNFTQBDFU MSXYSXYSXYSPPUSPPU%FD"DQJ0QFSBOEU MSXYSXYSXYSPPUSPPU%FD"DQJ1BSTFU MSXYSXYSXYSPPUSPPU%FD"DQJ1BSTF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OPPQFSBUJPOPOUIF   MJOLFEMJTUJOCFUXFFO   
  29. TFUVQGSFFMJTU w LNFN@DBDIF@BMMPD ࣮ߦ࣌ʹߦ͏ w GSFFMJTU༻ͷQBHFऔಘ w TMBCPCKFDUTͷॳظԽ w @@TMBC@BMMPD

    ʹͯҎԼʹ֘౰͢Δ৔߹ʹTFUVQ͢Δ w DQBHF/6--PSDGSFFMJTU/6--
  30. TFUVQqPX @@TMBC@BMMPD  ŠOFX@TMBC@PCKFDUT  ŠOFX@TMBC  ŠBMMPDBUF@TMBC  ŠBMMPD@TMBC@QBHF

     ŠBMMPD@QBHFT PSBMMPD@QBHFT@FYBDU@OPEF  ŠTFUVQ@PCKFDU  ŠTFU@GSFFQPJOUFS ओͳ΋ͷ
  31. @@TMBC@BMMPD w DQBHFɺDGSFFMJTU͕/6--͔νΣοΫ͠ɺ /6--ͷ৔߹ʹOFX@TMBC@PCKFDUT ΛݺͿ w QBHFΛ֬อग़དྷͨΒDGSFFMJTUɺDUJEΛઃఆ w GSFFMJTU͕࠷ॳͷະ࢖༻TMBCPCKFDUΛࢦ͢ w

    HFU@GSFFQPJOUFS Ͱઃఆ
  32. OFX@TMBC@PCKFDUT w HFU@QBSUJBM ͰଞͷϊʔυʹGSFFMJTU͕͋Δ͔νΣοΫ w ݟ͔ͭΕ͹ͦΕΛฦ͢ʢաڈʹTFUVQࡁΈͳͷͰʣ w OFX@TMBC ͰQBHFͷ֬อ w

    TΑΓDΛऔಘ͠ɺD͕/6--Ͱͳ͍৔߹͸DQV@TMBCΛೖΕସ͑ΔͨΊԼهΛ࣮ߦ w EFBDUJWBUF@TMBC ͰTMBCΛQBSUJBMϦετʹͭͳ͙ w DͷσʔλΛॳظԽ͢Δ w DQBHFDGSFFMJTU/6--౳ w QBHFGSFFMJTUΛ໭Γ஋ͷม਺GSFFMJTUʹ୅ೖ͠ɺQBHFGSFFMJTU͸/6--ʹ w DQBHFΛ֬อͨ͠QBHFʹஔ͖׵͑
  33. OFX@TMBC w BMMPDB@TMBC ͰGSFFMJTU༻ͷQBHFΛ֬อ w TMBCPCKFDUΛॳظԽ GPS@FBDI@PCKFDU@JEY Q JEY T

    TUBSU QBHFPCKFDUT \   TFUVQ@PCKFDU T QBHF Q    JG MJLFMZ JEYQBHFPCKFDUT     TFU@GSFFQPJOUFS T Q Q TTJ[F    FMTF    TFU@GSFFQPJOUFS T Q /6--  ^ GPS@FBDI@PCKFDU@JEYϚΫϩͷऴྃ৚݅͸JEYQBHFPCKFDUT
  34. BMMPDBUF@TMBC w BMMPDBUF@TMBC@QBHF ͰQBHFΛ֬อ͢Δͷ͕࢓ࣄ w TPPͰࢦఆ͞Ε͍ͯΔPSEFSͰQBHFΛ֬อΛࢼ ΈΔ w ΋ࣦ͠ഊͨ͠৔߹͸TNJOʹઃఆ͞Ε͍ͯΔ࠷ খαΠζͰQBHF֬อΛϦτϥΠ

    w ͜ΕͰ΋ࣦഊͨ͠Β/6--Λฦ͢
  35. BMMPD@TMBC@QBHF w ࣮ࡍʹQBHF֬อͷؔ਺ΛݺͿͷ͕ݸʑ w /6."ϊʔυͷࢦఆ༗ແͰݺͿؔ਺͕มΘΔ w OPEF/6."@/0@/0%& ϊʔυෆ໰  w

    BMMPD@QBHFT  w OPEF/6."@/0@/0%& w BMMPD@QBHFT@FYBDU@OPEF
  36. TFUVQ@PCKFDU w TFUVQ@PCKFDU@EFCVH Ͱσόοά༻ͷΦϒδΣ Ϋτઃఆ w 10*40/ɺ3&%;0/&ɺ5SBDLJOH w TDUPS͕ઃఆ͞Ε͍ͯΕ͹ίϯετϥΫλؔ਺ ͷݺͼग़͠

  37. TFU@GSFFQPJOUFS w PCKFDU TP⒎TFUͷͱ͜Ζʹ࣍ͷPCKFDUͷΞυϨε Λઃఆ TUBUJDJOMJOFWPJETFU@GSFFQPJOUFS TUSVDULNFN@DBDIF T WPJE PCKFDU

    WPJE GQ  \  WPJE PCKFDU TP⒎TFU GQ ^ GPS@FBDI@PCKFDU@JEY Q JEY T TUB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