diff options
author | fr157268 <none@none> | 2006-06-30 05:41:26 -0700 |
---|---|---|
committer | fr157268 <none@none> | 2006-06-30 05:41:26 -0700 |
commit | d5fbc2382ba3b6e27ed2481fcfd8f091b5850cd7 (patch) | |
tree | 4b0efd75acb1f059946c45914cdc06c97638097f /usr/src/uts/common/syscall/pset.c | |
parent | 582eadee8ab962bd0c2428714daa56ecb51f9402 (diff) | |
download | illumos-joyent-d5fbc2382ba3b6e27ed2481fcfd8f091b5850cd7.tar.gz |
6298715 Memory allocation in pset_getloadavg not needed
Diffstat (limited to 'usr/src/uts/common/syscall/pset.c')
-rw-r--r-- | usr/src/uts/common/syscall/pset.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/usr/src/uts/common/syscall/pset.c b/usr/src/uts/common/syscall/pset.c index 73b45c88be..5d3b7e6233 100644 --- a/usr/src/uts/common/syscall/pset.c +++ b/usr/src/uts/common/syscall/pset.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -626,7 +625,7 @@ pset_bind(psetid_t pset, idtype_t idtype, id_t id, psetid_t *opset) static int pset_getloadavg(psetid_t pset, int *buf, int nelem) { - int *loadbuf; + int loadbuf[LOADAVG_NSTATS]; int error = 0; if (nelem < 0) @@ -639,16 +638,12 @@ pset_getloadavg(psetid_t pset, int *buf, int nelem) if (nelem > LOADAVG_NSTATS) nelem = LOADAVG_NSTATS; - loadbuf = kmem_alloc(nelem * sizeof (int), KM_SLEEP); - mutex_enter(&cpu_lock); error = cpupart_get_loadavg(pset, loadbuf, nelem); mutex_exit(&cpu_lock); if (!error && nelem && copyout(loadbuf, buf, nelem * sizeof (int)) != 0) error = EFAULT; - kmem_free(loadbuf, nelem * sizeof (int)); - if (error) return (set_errno(error)); else |