From 1f0e1671784d22468cd6fe951716b88d139254a2 Mon Sep 17 00:00:00 2001 From: chs Date: Wed, 31 May 2017 23:54:17 +0000 Subject: [PATCH] vmem_alloc() with VM_SLEEP cannot fail, so percpu_alloc() cannot fail either. --- share/man/man9/percpu.9 | 8 +++----- sys/kern/subr_percpu.c | 9 ++++----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/share/man/man9/percpu.9 b/share/man/man9/percpu.9 index a01bfdd4f799..79ce894fd732 100644 --- a/share/man/man9/percpu.9 +++ b/share/man/man9/percpu.9 @@ -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 diff --git a/sys/kern/subr_percpu.c b/sys/kern/subr_percpu.c index ef11f565c603..887d24379a4f 100644 --- a/sys/kern/subr_percpu.c +++ b/sys/kern/subr_percpu.c @@ -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 -__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 #include @@ -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;