Print this page
NEX-5184 backport illumos 6065 page hash: use a static inline instead of a macro
Reviewed by: Jean McCormack <jean.mccormack@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
6065 page hash: use a static inline instead of a macro
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Robert Mustacchi <rm@joyent.com>
NEX-5164 backport illumos 6514 AS_* lock macros simplification
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
6514 AS_* lock macros simplification
Reviewed by: Piotr Jasiukajtis <estibi@me.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Albert Lee <trisk@omniti.com>
Approved by: Dan McDonald <danmcd@omniti.com>
re #13613 rb4516 Tunables needs volatile keyword


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 1986, 2010, Oracle and/or its affiliates. All rights reserved.

  23  * Copyright (c) 2015, Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  24  * Copyright (c) 2015, 2016 by Delphix. All rights reserved.
  25  */
  26 
  27 /*      Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989  AT&T        */
  28 /*        All Rights Reserved   */
  29 
  30 /*
  31  * University Copyright- Copyright (c) 1982, 1986, 1988
  32  * The Regents of the University of California
  33  * All Rights Reserved
  34  *
  35  * University Acknowledgment- Portions of this document are derived from
  36  * software developed by the University of California, Berkeley, and its
  37  * contributors.
  38  */
  39 
  40 /*
  41  * VM - physical page management.
  42  */


6204  * possible.
6205  */
6206 typedef struct page_capture_hash_head {
6207         kmutex_t pchh_mutex;
6208         uint_t num_pages[PC_NUM_PRI];
6209         page_capture_hash_bucket_t lists[2]; /* sentinel nodes */
6210 } page_capture_hash_head_t;
6211 
6212 #ifdef DEBUG
6213 #define NUM_PAGE_CAPTURE_BUCKETS 4
6214 #else
6215 #define NUM_PAGE_CAPTURE_BUCKETS 64
6216 #endif
6217 
6218 page_capture_hash_head_t page_capture_hash[NUM_PAGE_CAPTURE_BUCKETS];
6219 
6220 /* for now use a very simple hash based upon the size of a page struct */
6221 #define PAGE_CAPTURE_HASH(pp)   \
6222         ((int)(((uintptr_t)pp >> 7) & (NUM_PAGE_CAPTURE_BUCKETS - 1)))
6223 
6224 extern pgcnt_t swapfs_minfree;
6225 
6226 int page_trycapture(page_t *pp, uint_t szc, uint_t flags, void *datap);
6227 
6228 /*
6229  * a callback function is required for page capture requests.
6230  */
6231 void
6232 page_capture_register_callback(uint_t index, clock_t duration,
6233     int (*cb_func)(page_t *, void *, uint_t))
6234 {
6235         ASSERT(pc_cb[index].cb_active == 0);
6236         ASSERT(cb_func != NULL);
6237         rw_enter(&pc_cb[index].cb_rwlock, RW_WRITER);
6238         pc_cb[index].duration = duration;
6239         pc_cb[index].cb_func = cb_func;
6240         pc_cb[index].cb_active = 1;
6241         rw_exit(&pc_cb[index].cb_rwlock);
6242 }
6243 
6244 void
6245 page_capture_unregister_callback(uint_t index)




   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 1986, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  24  * Copyright (c) 2015, Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  25  * Copyright (c) 2015, 2016 by Delphix. All rights reserved.
  26  */
  27 
  28 /*      Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989  AT&T        */
  29 /*        All Rights Reserved   */
  30 
  31 /*
  32  * University Copyright- Copyright (c) 1982, 1986, 1988
  33  * The Regents of the University of California
  34  * All Rights Reserved
  35  *
  36  * University Acknowledgment- Portions of this document are derived from
  37  * software developed by the University of California, Berkeley, and its
  38  * contributors.
  39  */
  40 
  41 /*
  42  * VM - physical page management.
  43  */


6205  * possible.
6206  */
6207 typedef struct page_capture_hash_head {
6208         kmutex_t pchh_mutex;
6209         uint_t num_pages[PC_NUM_PRI];
6210         page_capture_hash_bucket_t lists[2]; /* sentinel nodes */
6211 } page_capture_hash_head_t;
6212 
6213 #ifdef DEBUG
6214 #define NUM_PAGE_CAPTURE_BUCKETS 4
6215 #else
6216 #define NUM_PAGE_CAPTURE_BUCKETS 64
6217 #endif
6218 
6219 page_capture_hash_head_t page_capture_hash[NUM_PAGE_CAPTURE_BUCKETS];
6220 
6221 /* for now use a very simple hash based upon the size of a page struct */
6222 #define PAGE_CAPTURE_HASH(pp)   \
6223         ((int)(((uintptr_t)pp >> 7) & (NUM_PAGE_CAPTURE_BUCKETS - 1)))
6224 


6225 int page_trycapture(page_t *pp, uint_t szc, uint_t flags, void *datap);
6226 
6227 /*
6228  * a callback function is required for page capture requests.
6229  */
6230 void
6231 page_capture_register_callback(uint_t index, clock_t duration,
6232     int (*cb_func)(page_t *, void *, uint_t))
6233 {
6234         ASSERT(pc_cb[index].cb_active == 0);
6235         ASSERT(cb_func != NULL);
6236         rw_enter(&pc_cb[index].cb_rwlock, RW_WRITER);
6237         pc_cb[index].duration = duration;
6238         pc_cb[index].cb_func = cb_func;
6239         pc_cb[index].cb_active = 1;
6240         rw_exit(&pc_cb[index].cb_rwlock);
6241 }
6242 
6243 void
6244 page_capture_unregister_callback(uint_t index)