| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: subr_pool.c,v 1.251 2019/06/13 01:13:12 christos Exp $ */ | | 1 | /* $NetBSD: subr_pool.c,v 1.252 2019/06/29 11:13:23 maxv Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018 | | 4 | * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018 |
5 | * The NetBSD Foundation, Inc. | | 5 | * The NetBSD Foundation, Inc. |
6 | * All rights reserved. | | 6 | * All rights reserved. |
7 | * | | 7 | * |
8 | * This code is derived from software contributed to The NetBSD Foundation | | 8 | * This code is derived from software contributed to The NetBSD Foundation |
9 | * by Paul Kranenburg; by Jason R. Thorpe of the Numerical Aerospace | | 9 | * by Paul Kranenburg; by Jason R. Thorpe of the Numerical Aerospace |
10 | * Simulation Facility, NASA Ames Research Center; by Andrew Doran, and by | | 10 | * Simulation Facility, NASA Ames Research Center; by Andrew Doran, and by |
11 | * Maxime Villard. | | 11 | * Maxime Villard. |
12 | * | | 12 | * |
13 | * Redistribution and use in source and binary forms, with or without | | 13 | * Redistribution and use in source and binary forms, with or without |
14 | * modification, are permitted provided that the following conditions | | 14 | * modification, are permitted provided that the following conditions |
| @@ -23,27 +23,27 @@ | | | @@ -23,27 +23,27 @@ |
23 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 23 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
24 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 24 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
26 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 26 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
32 | * POSSIBILITY OF SUCH DAMAGE. | | 32 | * POSSIBILITY OF SUCH DAMAGE. |
33 | */ | | 33 | */ |
34 | | | 34 | |
35 | #include <sys/cdefs.h> | | 35 | #include <sys/cdefs.h> |
36 | __KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.251 2019/06/13 01:13:12 christos Exp $"); | | 36 | __KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.252 2019/06/29 11:13:23 maxv Exp $"); |
37 | | | 37 | |
38 | #ifdef _KERNEL_OPT | | 38 | #ifdef _KERNEL_OPT |
39 | #include "opt_ddb.h" | | 39 | #include "opt_ddb.h" |
40 | #include "opt_lockdebug.h" | | 40 | #include "opt_lockdebug.h" |
41 | #include "opt_pool.h" | | 41 | #include "opt_pool.h" |
42 | #include "opt_kleak.h" | | 42 | #include "opt_kleak.h" |
43 | #endif | | 43 | #endif |
44 | | | 44 | |
45 | #include <sys/param.h> | | 45 | #include <sys/param.h> |
46 | #include <sys/systm.h> | | 46 | #include <sys/systm.h> |
47 | #include <sys/sysctl.h> | | 47 | #include <sys/sysctl.h> |
48 | #include <sys/bitops.h> | | 48 | #include <sys/bitops.h> |
49 | #include <sys/proc.h> | | 49 | #include <sys/proc.h> |
| @@ -1949,26 +1949,27 @@ pool_cache_bootstrap(pool_cache_t pc, si | | | @@ -1949,26 +1949,27 @@ pool_cache_bootstrap(pool_cache_t pc, si |
1949 | void *arg) | | 1949 | void *arg) |
1950 | { | | 1950 | { |
1951 | CPU_INFO_ITERATOR cii; | | 1951 | CPU_INFO_ITERATOR cii; |
1952 | pool_cache_t pc1; | | 1952 | pool_cache_t pc1; |
1953 | struct cpu_info *ci; | | 1953 | struct cpu_info *ci; |
1954 | struct pool *pp; | | 1954 | struct pool *pp; |
1955 | | | 1955 | |
1956 | pp = &pc->pc_pool; | | 1956 | pp = &pc->pc_pool; |
1957 | if (palloc == NULL && ipl == IPL_NONE) { | | 1957 | if (palloc == NULL && ipl == IPL_NONE) { |
1958 | if (size > PAGE_SIZE) { | | 1958 | if (size > PAGE_SIZE) { |
1959 | int bigidx = pool_bigidx(size); | | 1959 | int bigidx = pool_bigidx(size); |
1960 | | | 1960 | |
1961 | palloc = &pool_allocator_big[bigidx]; | | 1961 | palloc = &pool_allocator_big[bigidx]; |
| | | 1962 | flags |= PR_NOALIGN; |
1962 | } else | | 1963 | } else |
1963 | palloc = &pool_allocator_nointr; | | 1964 | palloc = &pool_allocator_nointr; |
1964 | } | | 1965 | } |
1965 | pool_init(pp, size, align, align_offset, flags, wchan, palloc, ipl); | | 1966 | pool_init(pp, size, align, align_offset, flags, wchan, palloc, ipl); |
1966 | mutex_init(&pc->pc_lock, MUTEX_DEFAULT, ipl); | | 1967 | mutex_init(&pc->pc_lock, MUTEX_DEFAULT, ipl); |
1967 | | | 1968 | |
1968 | if (ctor == NULL) { | | 1969 | if (ctor == NULL) { |
1969 | ctor = (int (*)(void *, void *, int))nullop; | | 1970 | ctor = (int (*)(void *, void *, int))nullop; |
1970 | } | | 1971 | } |
1971 | if (dtor == NULL) { | | 1972 | if (dtor == NULL) { |
1972 | dtor = (void (*)(void *, void *))nullop; | | 1973 | dtor = (void (*)(void *, void *))nullop; |
1973 | } | | 1974 | } |
1974 | | | 1975 | |