LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-10-2019, 01:34 AM   #1
daegyu
LQ Newbie
 
Registered: Aug 2019
Posts: 6

Rep: Reputation: Disabled
What is the difference between "drop_caches" and "blockdev --flushbufs"?


Hi folks,

As the title says, I am confused about "echo # > /proc/sys/vm/drop_caches" and blockdev --flushbufs.

http://pages.cs.wisc.edu/~remzi/OSTE...ementation.pdf

According to OSSTEP, If the target inodes are not cached in memory, disk IO should be occur to read the inode, which will make a dentry data structure on memory.

To my knowledge, echo 3 > /proc/sys/vm/drop_caches is to drop(clear) page cahche, inodes and dentry.

I have experimented with blktrace to figure out whether disk io is really occurring to read the inode.

1) echo 3 > /proc/sys/vm/drop_caches

> 259,0 38 1 0.000000000 40641 Q R 109314048 + 32 [cat]
> 259,0 38 2 0.000004096 40641 G R 109314048 + 32 [cat]
> 259,0 38 3 0.000027108 40641 UT N [cat] 1
> 259,0 38 4 0.000027862 40641 I R 109314048 + 32 [cat]
> 259,0 38 5 0.000036393 40641 D R 109314048 + 32 [cat]
> 259,0 38 6 0.006268251 0 C R 109314048 + 32 [0]
However, there is no disk io to read inode. I can only see the disk io to read 16KB data block.

2) echo 3 > /proc/sys/vm/drop_caches and blockdev --flushbufs /dev/nvme0n1

259,0 1 1 0.000000000 325 Q RM 74232 + 8 [cat]
259,0 1 2 0.000004854 325 G RM 74232 + 8 [cat]
259,0 1 3 0.000026263 325 D RM 74232 + 8 [cat]
259,0 1 4 0.006292470 0 C RM 74232 + 8 [0]
259,0 1 5 0.006382162 325 Q RM 109052160 + 8 [cat]
259,0 1 6 0.006385621 325 G RM 109052160 + 8 [cat]
259,0 1 7 0.006393322 325 D RM 109052160 + 8 [cat]
259,0 1 8 0.006455750 0 C RM 109052160 + 8 [0]
259,0 1 9 0.006511245 325 Q RM 109117696 + 8 [cat]
259,0 1 10 0.006512342 325 G RM 109117696 + 8 [cat]
259,0 1 11 0.006514627 325 D RM 109117696 + 8 [cat]
259,0 1 12 0.006591933 0 C RM 109117696 + 8 [0]
259,0 1 13 0.006624544 325 Q RM 109117704 + 8 [cat]
259,0 1 14 0.006625538 325 G RM 109117704 + 8 [cat]
259,0 1 15 0.006627567 325 D RM 109117704 + 8 [cat]
259,0 1 16 0.006688973 0 C RM 109117704 + 8 [0]
259,0 1 17 0.006764838 325 Q R 109314048 + 32 [cat]
259,0 1 18 0.006766035 325 G R 109314048 + 32 [cat]
259,0 1 19 0.006768078 325 UT N [cat] 1
259,0 1 20 0.006768755 325 I R 109314048 + 32 [cat]
259,0 1 21 0.006773426 325 D R 109314048 + 32 [cat]
259,0 1 22 0.006854480 0 C R 109314048 + 32 [0]
I found block access (+8(512*8=4KB)) to read inode.

A quick look at how blockdev --flushbufs works in the kernel code shows that it clears the superblock.

Why doesn't disk io to read inodes with drop_cache alone?

The ULK book says that inodes or superblocks are cached in buffer-cache. The book ULK says that inodes and superblocks are cached in buffer-cache. Is this the reason for this?

Thank you

Last edited by daegyu; 09-10-2019 at 06:30 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
blockdev use satishfaction Linux - Server 0 05-31-2012 10:03 PM
[SOLVED] I/O Tune with blockdev Help Linux_Kidd Linux - Server 2 02-17-2012 09:04 AM
kernel 2.6.9-89.0.9.ELsmp related question - drop_caches amit shukla Linux - Kernel 2 10-10-2009 09:22 PM
/proc/sys/vm/drop_caches sulekha Ubuntu 4 12-06-2008 03:38 AM
SuSE 9.2 - 3ware 9500 - blockdev Occupant Linux - Hardware 1 01-20-2005 01:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration