Module Name: src Committed By: chs Date: Wed May 31 23:54:17 UTC 2017
Modified Files: src/share/man/man9: percpu.9 src/sys/kern: subr_percpu.c Log Message: vmem_alloc() with VM_SLEEP cannot fail, so percpu_alloc() cannot fail either. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/share/man/man9/percpu.9 cvs rdiff -u -r1.17 -r1.18 src/sys/kern/subr_percpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/share/man/man9/percpu.9 diff -u src/share/man/man9/percpu.9:1.11 src/share/man/man9/percpu.9:1.12 --- src/share/man/man9/percpu.9:1.11 Tue Mar 18 18:20:40 2014 +++ src/share/man/man9/percpu.9 Wed May 31 23:54:17 2017 @@ -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 Index: src/sys/kern/subr_percpu.c diff -u src/sys/kern/subr_percpu.c:1.17 src/sys/kern/subr_percpu.c:1.18 --- src/sys/kern/subr_percpu.c:1.17 Thu Nov 27 15:00:00 2014 +++ src/sys/kern/subr_percpu.c Wed May 31 23:54:17 2017 @@ -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;