swaminathan sundararaman yupu zhang sriram subramanian
play

Swaminathan Sundararaman, Yupu Zhang, Sriram Subramanian, - PowerPoint PPT Presentation

Swaminathan Sundararaman, Yupu Zhang, Sriram Subramanian, Andrea C. Arpaci-Dusseau, Remzi H. Arpaci-Dusseau Why do file systems not crash all the


  1. Swaminathan ¡Sundararaman, ¡Yupu ¡Zhang, ¡Sriram ¡Subramanian, ¡ ¡ Andrea ¡C. ¡Arpaci-­‑Dusseau, ¡Remzi ¡H. ¡Arpaci-­‑Dusseau ¡

  2.  Why ¡do ¡file ¡systems ¡not ¡crash ¡all ¡the ¡time? ¡  Bad ¡things ¡rarely ¡happen ¡  Common ¡case ¡code: ¡frequently ¡run ¡code ¡  Well ¡tested ¡– ¡run ¡all ¡the ¡time ¡by ¡users ¡  “Hardened” ¡code ¡– ¡lower ¡failure ¡probability ¡  Ideal: ¡if ¡everything ¡was ¡common ¡case ¡code ¡  We ¡can ¡significantly ¡reduce ¡the ¡occurrence ¡of ¡bugs ¡ 3/11/11 ¡ FAST ¡'11: ¡Making ¡the ¡Common ¡Case ¡the ¡Only ¡Case ¡with ¡Anticipatory ¡Memory ¡Allocation ¡ 2 ¡

  3.  Code ¡to ¡handle ¡exceptions/errors/failures ¡  Worst ¡property : ¡rarely ¡run ¡but ¡when ¡executed ¡ must ¡run ¡absolutely ¡correctly ¡  Prior ¡work ¡uncovered ¡bugs ¡in ¡recovery ¡code ¡  Memory ¡allocation ¡ [Engler ¡OSDI ¡’00, ¡Yang ¡OSDI ¡‘04, ¡Yang ¡OSDI ¡‘06] ¡  Error ¡propagation ¡ [Gunawi ¡FAST ¡‘08, ¡Rubio-­‑Gonzalez ¡PLDI ¡’09] ¡  Missing ¡recovery ¡code ¡ [Engler ¡OSDI ¡’00, ¡Swift ¡SOSP ¡’03] ¡  Focus ¡on ¡memory ¡allocation ¡failures ¡ 3/11/11 ¡ FAST ¡'11: ¡Making ¡the ¡Common ¡Case ¡the ¡Only ¡Case ¡with ¡Anticipatory ¡Memory ¡Allocation ¡ 3 ¡

  4.  Memory ¡is ¡a ¡limited ¡resource ¡  Virtualization, ¡cloud ¡computing ¡(data ¡centers) ¡  Buggy ¡components ¡slowly ¡leak ¡memory ¡  Memory ¡is ¡allocated ¡throughout ¡the ¡OS ¡  Core ¡kernel ¡code, ¡file ¡systems, ¡device ¡drivers, ¡etc. ¡  Allocation ¡requests ¡may ¡not ¡succeed ¡  Memory ¡can ¡be ¡allocated ¡deep ¡inside ¡the ¡stack ¡  Deep ¡recovery ¡is ¡difficult ¡ [Gunawi FAST ‘08, Rubio-Gonzalez PLDI ’09] ¡ 3/11/11 ¡ FAST ¡'11: ¡Making ¡the ¡Common ¡Case ¡the ¡Only ¡Case ¡with ¡Anticipatory ¡Memory ¡Allocation ¡ 4 ¡

  5. Fault ¡injection ¡during ¡memory ¡allocation ¡calls ¡  15 ¡runs ¡of ¡μbenchmark ¡ Process ¡ ¡State ¡ File-­‑system ¡State ¡ FS probabilty ¡ Error ¡ Abort ¡ Unusable ¡ Inconsistent ¡  .1, ¡.5 ¡failure ¡prob. ¡ ext2 10 ¡ 10 ¡ 5 ¡ 5 ¡ 0 ¡ ext2 50 ¡ 10 ¡ 5 ¡ 5 ¡ 0 ¡  Error ¡-­‑ ¡ good ¡ Btrfs 10 ¡ 0 ¡ 14 ¡ 15 ¡ 0 ¡ Btrfs 50 ¡ 0 ¡ 15 ¡ 15 ¡ 0 ¡  Abort, ¡unusable, ¡or ¡ ¡ ¡ ¡inconsistent ¡-­‑ ¡ bad ¡ jfs 10 ¡ 15 ¡ 0 ¡ 2 ¡ 5 ¡ jfs 50 ¡ 15 ¡ 0 ¡ 5 ¡ 5 ¡ xfs 10 ¡ 13 ¡ 1 ¡ 0 ¡ 3 ¡ xfs 50 ¡ 10 ¡ 5 ¡ 0 ¡ 5 ¡ 3/11/11 ¡ FAST ¡'11: ¡Making ¡the ¡Common ¡Case ¡the ¡Only ¡Case ¡with ¡Anticipatory ¡Memory ¡Allocation ¡ 5 ¡

  6.  Deadlocks ¡  Requests ¡need ¡not ¡make ¡progress ¡  Not ¡always ¡possible ¡  Critical ¡sections, ¡interrupt ¡handlers ¡  What ¡about ¡GFP_NOFAIL ¡flag? ¡  “ GFP_NOFAIL ¡should ¡only ¡be ¡used ¡when ¡we ¡have ¡no ¡way ¡of ¡ recovering ¡from ¡failure. ¡... ¡GFP_NOFAIL ¡is ¡there ¡as ¡a ¡marker ¡ which ¡says ¡’we ¡really ¡shouldn’t ¡be ¡doing ¡this ¡but ¡we ¡don’t ¡ know ¡how ¡to ¡fix ¡it’” ¡-­‑ ¡ Andrew ¡Morton ¡ 3/11/11 ¡ FAST ¡'11: ¡Making ¡the ¡Common ¡Case ¡the ¡Only ¡Case ¡with ¡Anticipatory ¡Memory ¡Allocation ¡ 6 ¡

  7. Mantra: ¡ ¡ Most ¡robust ¡recovery ¡code ¡is ¡recovery ¡code ¡that ¡never ¡runs ¡at ¡all ¡ 3/11/11 ¡ FAST ¡'11: ¡Making ¡the ¡Common ¡Case ¡the ¡Only ¡Case ¡with ¡Anticipatory ¡Memory ¡Allocation ¡ 7 ¡

  8.  Attempt ¡to ¡make ¡common ¡case ¡the ¡ONLY ¡case ¡  Pre-­‑allocate ¡memory ¡inside ¡OS ¡(context ¡of ¡file ¡systems) ¡ Application ¡ Application ¡ Advantages ¡ Pre-­‑allocated ¡ Syscall ¡ Syscall ¡ Memory ¡ Kernel ¡ Kernel ¡ • ¡Recovery ¡code ¡not ¡scattered ¡ Cleanup ¡ • ¡Shallow ¡recovery ¡ • ¡Code ¡naturally ¡written ¡ Block ¡Driver ¡ Block ¡Driver ¡ Vanilla ¡Kernel ¡ AMA ¡Kernel ¡ Memory ¡Allocation ¡ 3/11/11 ¡ FAST ¡'11: ¡Making ¡the ¡Common ¡Case ¡the ¡Only ¡Case ¡with ¡Anticipatory ¡Memory ¡Allocation ¡ 8 ¡

  9.  We ¡have ¡evaluated ¡AMA ¡with ¡ext2 ¡file ¡system ¡  ext2-­‑mfr ¡(memory ¡failure ¡robust ¡ext2) ¡  Robustness ¡  Recovers ¡from ¡all ¡memory ¡allocation ¡failures ¡  Performance ¡  Low ¡overheads ¡for ¡most ¡user ¡workloads ¡  Memory ¡overheads ¡  Most ¡cases: ¡we ¡do ¡really ¡well ¡  Few ¡cases: ¡we ¡perform ¡badly ¡ 3/11/11 ¡ FAST ¡'11: ¡Making ¡the ¡Common ¡Case ¡the ¡Only ¡Case ¡with ¡Anticipatory ¡Memory ¡Allocation ¡ 9 ¡

  10.  Introduction ¡  Challenges ¡  Anticipatory ¡Memory ¡Allocation ¡(AMA) ¡  Reducing ¡memory ¡overheads ¡  Evaluation ¡  Conclusions ¡ 3/11/11 ¡ FAST ¡'11: ¡Making ¡the ¡Common ¡Case ¡the ¡Only ¡Case ¡with ¡Anticipatory ¡Memory ¡Allocation ¡ 10 ¡

  11.  Different ¡types ¡of ¡memory ¡allocation ¡calls ¡  kmalloc (size, ¡flag) ¡  vmalloc (size, ¡flag) ¡  kmem_cache_alloc (cachep, ¡flag) ¡  alloc_pages (order, ¡flag) ¡ Need: ¡to ¡handle ¡all ¡memory ¡allocation ¡calls ¡ ¡ 3/11/11 ¡ FAST ¡'11: ¡Making ¡the ¡Common ¡Case ¡the ¡Only ¡Case ¡with ¡Anticipatory ¡Memory ¡Allocation ¡ 11 ¡

  12.  Hard ¡to ¡determine ¡the ¡number ¡of ¡objects ¡ allocated ¡inside ¡each ¡function ¡  Simple ¡calls ¡  Parameterized ¡& ¡conditional ¡calls ¡  Loops ¡ struct ¡dentry ¡*d ¡alloc(..., ¡struct ¡qstr ¡* name ) ¡ ¡ { ¡  Function ¡calls ¡ ¡ ¡ ¡... ¡ ¡ ¡if ¡( name → len ¡> ¡DNAME ¡INLINE ¡LEN-­‑1) ¡{ ¡ ¡  Recursions ¡ ¡ ¡ ¡ ¡ ¡ ¡dname ¡= ¡ kmalloc ( name → len ¡ + ¡1, ¡…); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡if ¡(!dname) ¡return ¡NULL; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡... ¡ ¡ ¡ ¡ ¡ ¡}} ¡ 3/11/11 ¡ FAST ¡'11: ¡Making ¡the ¡Common ¡Case ¡the ¡Only ¡Case ¡with ¡Anticipatory ¡Memory ¡Allocation ¡ 12 ¡

  13.  Introduction ¡  Challenges ¡  Anticipatory ¡Memory ¡Allocation ¡(AMA) ¡  Reducing ¡memory ¡overheads ¡  Evaluation ¡  Conclusions ¡ 3/11/11 ¡ FAST ¡'11: ¡Making ¡the ¡Common ¡Case ¡the ¡Only ¡Case ¡with ¡Anticipatory ¡Memory ¡Allocation ¡ 13 ¡

  14. User ¡ User ¡ Application ¡ Application ¡ Legend ¡ Input ¡Arguments ¡ Input ¡Arguments ¡ VFS ¡ FS ¡ MM ¡ System ¡Call ¡ System ¡Call ¡ Memory ¡Allocation ¡Calls ¡ Kernel ¡ Kernel ¡ VFS ¡ Pre-­‑allocate ¡ Memory ¡ File ¡System ¡ How ¡much ¡to ¡allocate? ¡ Static ¡analysis ¡ Mem ¡Mgmt ¡ How ¡to ¡use ¡the ¡pre-­‑allocated ¡objects? ¡ ¡ Runtime ¡support ¡ Disk ¡ Disk ¡ Vanilla ¡Kernel ¡ AMA ¡Kernel ¡ 3/11/11 ¡ FAST ¡'11: ¡Making ¡the ¡Common ¡Case ¡the ¡Only ¡Case ¡with ¡Anticipatory ¡Memory ¡Allocation ¡ 14 ¡

  15. Seen ¡Before? ¡ Is ¡KMA? ¡ 1. ¡Identify ¡loops ¡ ¡ G ¡ If ¡(c==0) ¡{ ¡ Generate ¡ . ¡ print ¡(“Driver ¡ and ¡recursions. ¡ init”); ¡ } ¡ Allocation ¡Relevant ¡ . ¡ Loops ¡ . ¡ 2. ¡Detect ¡ ¡ Recursion ¡ Graph ¡ ¡ Kernel ¡code ¡ exit ¡condition ¡ CIL ¡ Nodes: ¡ 400 ¡ [Necula ¡CC ¡‘02] ¡ LOC: ¡ 9k ¡ ¡ Syscall ¡ Nodes: ¡ 2k ¡ Edges: ¡ ¡7k ¡ LOC: ¡180k ¡ ¡ Memory ¡allocation ¡ functions ¡ 2: ¡Loops ¡& ¡ 3: ¡Slicing ¡& ¡ 0: ¡Call ¡graph ¡ 1: ¡Pruning ¡ recursions ¡ backtracking ¡ 3/11/11 ¡ FAST ¡'11: ¡Making ¡the ¡Common ¡Case ¡the ¡Only ¡Case ¡with ¡Anticipatory ¡Memory ¡Allocation ¡ 15 ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend