vmem_alloc() with VM_SLEEP cannot fail, so percpu_alloc() cannot fail either.
This commit is contained in:
parent
c85613c074
commit
1f0e167178
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: percpu.9,v 1.11 2014/03/18 18:20:40 riastradh Exp $
|
||||
.\" $NetBSD: percpu.9,v 1.12 2017/05/31 23:54:17 chs Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
@ -27,7 +27,7 @@
|
||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd January 23, 2010
|
||||
.Dd May 31, 2017
|
||||
.Dt PERCPU 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -84,9 +84,7 @@ bytes of local storage on each CPU.
|
||||
The storage is initialized with zeroes.
|
||||
Treat this as an expensive operation.
|
||||
.Fn percpu_alloc
|
||||
returns
|
||||
.Dv NULL
|
||||
on failure, and a handle for the per-CPU storage on success.
|
||||
returns a handle for the per-CPU storage.
|
||||
.It Fn percpu_free "pc" "size"
|
||||
Call this in thread context to
|
||||
return to the system the per-CPU storage held by
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: subr_percpu.c,v 1.17 2014/11/27 15:00:00 uebayasi Exp $ */
|
||||
/* $NetBSD: subr_percpu.c,v 1.18 2017/05/31 23:54:17 chs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)2007,2008 YAMAMOTO Takashi,
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_percpu.c,v 1.17 2014/11/27 15:00:00 uebayasi Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_percpu.c,v 1.18 2017/05/31 23:54:17 chs Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/cpu.h>
|
||||
@ -257,9 +257,8 @@ percpu_alloc(size_t size)
|
||||
percpu_t *pc;
|
||||
|
||||
ASSERT_SLEEPABLE();
|
||||
if (vmem_alloc(percpu_offset_arena, size, VM_SLEEP | VM_BESTFIT,
|
||||
&offset) != 0)
|
||||
return NULL;
|
||||
(void)vmem_alloc(percpu_offset_arena, size, VM_SLEEP | VM_BESTFIT,
|
||||
&offset);
|
||||
pc = (percpu_t *)percpu_encrypt((uintptr_t)offset);
|
||||
percpu_zero(pc, size);
|
||||
return pc;
|
||||
|
Loading…
Reference in New Issue
Block a user