Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src vmem_alloc() with VM_SLEEP cannot fail, so percpu_alloc() ca...
details: https://anonhg.NetBSD.org/src/rev/9117d3ba0523
branches: trunk
changeset: 354012:9117d3ba0523
user: chs <chs%NetBSD.org@localhost>
date: Wed May 31 23:54:17 2017 +0000
description:
vmem_alloc() with VM_SLEEP cannot fail, so percpu_alloc() cannot fail either.
diffstat:
share/man/man9/percpu.9 | 8 +++-----
sys/kern/subr_percpu.c | 9 ++++-----
2 files changed, 7 insertions(+), 10 deletions(-)
diffs (59 lines):
diff -r 67fa8a6c8734 -r 9117d3ba0523 share/man/man9/percpu.9
--- a/share/man/man9/percpu.9 Wed May 31 23:53:30 2017 +0000
+++ b/share/man/man9/percpu.9 Wed May 31 23:54:17 2017 +0000
@@ -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 @@
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 -r 67fa8a6c8734 -r 9117d3ba0523 sys/kern/subr_percpu.c
--- a/sys/kern/subr_percpu.c Wed May 31 23:53:30 2017 +0000
+++ b/sys/kern/subr_percpu.c Wed May 31 23:54:17 2017 +0000
@@ -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_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;
Home |
Main Index |
Thread Index |
Old Index