Chinaunix首页 | 论坛 | 博客
  • 博客访问: 701959
  • 博文数量: 126
  • 博客积分: 2944
  • 博客等级: 上校
  • 技术积分: 1160
  • 用 户 组: 普通用户
  • 注册时间: 2005-02-17 11:09
个人简介

文章分类

全部博文(126)

文章存档

2022年(1)

2018年(1)

2017年(5)

2016年(5)

2013年(5)

2012年(21)

2011年(24)

2010年(1)

2009年(2)

2008年(12)

2007年(6)

2006年(19)

2005年(24)

分类: LINUX

2013-01-04 16:04:34

用dd读u盘时,发现有时速度很快,大于200M/s,而从bushound上看不出读动作,说明是从缓存里读的数据。

在读之前执行下 echo 1 > /proc/sys/vm/drop_caches 就正常了。

关于drop_caches 的解释:

Kernels 2.6.16 and newer provide a mechanism to have the kernel drop the page cache and/or inode and dentry caches on command, which can help free up a lot of memory. Now you can throw away that script that allocated a ton of memory just to get rid of the cache...

To use /proc/sys/vm/drop_caches , just echo a number to it.

To free pagecache:

# echo 1 > /proc/sys/vm/drop_caches

To free dentries and inodes:

# echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:

echo 3 > /proc/sys/vm/drop_caches

This is a non-destructive operation and will only free things that are completely unused. Dirty objects will continue to be in use until written out to disk and are not freeable. If you run "sync" first to flush them out to disk, these drop operations will tend to free more memory.

阅读(1771) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~