Guest User

Untitled

a guest
Jul 21st, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.87 KB | None | 0 0
  1. Cong> It introduces a new fcntl command F_DROP_CACHES to drop
  2. Cong> file caches of a specific file. The reason is that currently
  3. Cong> we only have a system-wide drop caches interface, it could
  4. Cong> cause system-wide performance down if we drop all page caches
  5. Cong> when we actually want to drop the caches of some huge file.
  6.  
  7. file_drop_caches(filp, arg);
  8.  
  9. void file_drop_caches(struct file *filp, unsigned long which);
  10.  
  11. $ dd if=ifile iflag=nocache count=0
  12.  
  13. $ dd of=ofile oflag=nocache conv=notrunc,fdatasync count=0
  14.  
  15. $ dd if=ifile iflag=nocache skip=10 count=10 of=/dev/null
  16.  
  17. $ dd if=ifile of=ofile iflag=nocache oflag=nocache
  18.  
  19. $ dd if=/dev/urandom of=sample.txt bs=100M count=1
  20.  
  21. $ sudo fatrace | grep sample.txt
  22.  
  23. $ top
  24.  
  25. $ cat sample.txt > /dev/null
  26.  
  27. $ sudo dd of=/home/saml/tst/162600/sample.txt
  28. oflag=nocache conv=notrunc,fdatasync count=0
  29.  
  30. $ dd if=/dev/urandom of=sample.txt bs=100M count=1
  31. 1+0 records in
  32. 1+0 records out
  33. 104857600 bytes (105 MB) copied, 7.37996 s, 14.2 MB/s
  34.  
  35. $ ls -l sample.txt
  36. -rw-rw-r--. 1 saml saml 104857600 Oct 17 22:54 sample.txt
  37.  
  38. $ top
  39. ...
  40. KiB Mem: 7968336 total, 6900956 used, 1067380 free, 267080 buffers
  41. ...
  42.  
  43. $ sudo fatrace | grep sample.txt
  44.  
  45. $ cat sample.txt > /dev/null
  46.  
  47. KiB Mem: 7968336 total, 7011896 used, 956440 free, 267336 buffers
  48.  
  49. cat(25940): R /home/saml/tst/162600/sample.txt
  50. cat(25940): R /home/saml/tst/162600/sample.txt
  51. cat(25940): RC /home/saml/tst/162600/sample.txt
  52.  
  53. $ sudo dd of=/home/saml/tst/162600/sample.txt
  54. oflag=nocache conv=notrunc,fdatasync count=0
  55.  
  56. dd(26229): O /home/saml/tst/162600/sample.txt
  57. dd(26229): CW /home/saml/tst/162600/sample.txt
  58.  
  59. KiB Mem: 7968336 total, 6908364 used, 1059972 free, 267364 buffers
  60.  
  61. $ sudo pyadvise --help
  62. Usage:
  63. pyadvise [options] [FILE]..
  64.  
  65. Options:
  66. -h, --help show this help message and exit
  67. -w, --willneed The specified files will be accessed in the near future
  68. -s, --sequential The application expects to access the specified files
  69. sequentially (with lower offsets read before higher ones)
  70. -d, --dontneed The specified files will not be accessed in the near
  71. future
  72. -r, --random The specified files will be accessed in random order
  73. -o, --noreuse The specified files will be accessed only once. Under
  74. Linux, this operation is a no-op; see contrib/copyfileobj-
  75. fadvise.py in the python-fadvise source tree for an
  76. example on how to achieve approximately the same effect
  77. -n, --normal Indicates that the application has no advice to give about
  78. its access pattern for the specified files. If no advice
  79. is given for an open file, this is the default assumption
  80. -v, --verbose Explain what is being done
  81.  
  82. $ pyadvise -d /home/saml/tst/162600/sample.txt
Add Comment
Please, Sign In to add comment