Merge pull request #10 from modelrockettier/shrinkers

Don't read meminfo if there are no shrinkers
This commit is contained in:
koverstreet 2018-11-04 17:42:20 -05:00 committed by GitHub
commit 6da91e81cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,8 +69,15 @@ static struct meminfo read_meminfo(void)
void run_shrinkers(void) void run_shrinkers(void)
{ {
struct shrinker *shrinker; struct shrinker *shrinker;
struct meminfo info = read_meminfo(); struct meminfo info;
s64 want_shrink = (info.total >> 2) - info.available; s64 want_shrink;
/* Fast out if there are no shrinkers to run. */
if (list_empty(&shrinker_list))
return;
info = read_meminfo();
want_shrink = (info.total >> 2) - info.available;
if (want_shrink <= 0) if (want_shrink <= 0)
return; return;