“Invalid argument” error for sysctl vm.drop_caches key in Ubuntu 11.10 (kernel 3.0.0-12)

StackOverflow https://stackoverflow.com/questions/8066252

سؤال

I have the following shell script that I've been using in previous versions of Ubuntu (<= 11.04) to clear memory cache and it has worked fine:

sudo sync && sudo sysctl -w vm.drop_caches=3 && sudo sysctl -w vm.drop_caches=0

I have a new clean install of 11.10 with 3.0.0-12-generic kernel and I get the following error when running the same script script:

vm.drop_caches = 3

error: "Invalid argument" setting key "vm.drop_caches"

هل كانت مفيدة؟

المحلول

Documentation/sysctl/vm.txt:

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

You can't setting this to zero.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top