cpufreq_curr_sysctl: memory allocation

Andriy Gapon avg at freebsd.org
Sun Jun 20 15:59:42 UTC 2010


I noticed that cpufreq_curr_sysctl performs a substantial memory allocation and
deallocation on each call.  Its size is CF_MAX_LEVELS * sizeof(*levels), which
is ~24KB.  This happens even for read-only calls to just query current level.
And such calls happen quite frequently when powerd is running.

I think that this is an unnecessary and avoidable load for VM system.
Couldn't a buffer be preallocated in sc and re-used for the calls?
Even if not, for some reason, then wouldn't it be better to have a dedicated uma
zone for that rather than doing malloc+free?

-- 
Andriy Gapon


More information about the freebsd-acpi mailing list