arc.c (332551) | arc.c (332785) |
---|---|
1/* 2 * CDDL HEADER START 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 --- 526 unchanged lines hidden (view full) --- 535 /* 536 * Number of buffers that could not be evicted because the hash lock 537 * was held by another thread. The lock may not necessarily be held 538 * by something using the same buffer, since hash locks are shared 539 * by multiple buffers. 540 */ 541 kstat_named_t arcstat_mutex_miss; 542 /* | 1/* 2 * CDDL HEADER START 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 --- 526 unchanged lines hidden (view full) --- 535 /* 536 * Number of buffers that could not be evicted because the hash lock 537 * was held by another thread. The lock may not necessarily be held 538 * by something using the same buffer, since hash locks are shared 539 * by multiple buffers. 540 */ 541 kstat_named_t arcstat_mutex_miss; 542 /* |
543 * Number of buffers skipped when updating the access state due to the 544 * header having already been released after acquiring the hash lock. 545 */ 546 kstat_named_t arcstat_access_skip; 547 /* |
|
543 * Number of buffers skipped because they have I/O in progress, are | 548 * Number of buffers skipped because they have I/O in progress, are |
544 * indrect prefetch buffers that have not lived long enough, or are | 549 * indirect prefetch buffers that have not lived long enough, or are |
545 * not from the spa we're trying to evict from. 546 */ 547 kstat_named_t arcstat_evict_skip; 548 /* 549 * Number of times arc_evict_state() was unable to evict enough 550 * buffers to reach it's target amount. 551 */ 552 kstat_named_t arcstat_evict_not_enough; --- 238 unchanged lines hidden (view full) --- 791 { "prefetch_metadata_misses", KSTAT_DATA_UINT64 }, 792 { "mru_hits", KSTAT_DATA_UINT64 }, 793 { "mru_ghost_hits", KSTAT_DATA_UINT64 }, 794 { "mfu_hits", KSTAT_DATA_UINT64 }, 795 { "mfu_ghost_hits", KSTAT_DATA_UINT64 }, 796 { "allocated", KSTAT_DATA_UINT64 }, 797 { "deleted", KSTAT_DATA_UINT64 }, 798 { "mutex_miss", KSTAT_DATA_UINT64 }, | 550 * not from the spa we're trying to evict from. 551 */ 552 kstat_named_t arcstat_evict_skip; 553 /* 554 * Number of times arc_evict_state() was unable to evict enough 555 * buffers to reach it's target amount. 556 */ 557 kstat_named_t arcstat_evict_not_enough; --- 238 unchanged lines hidden (view full) --- 796 { "prefetch_metadata_misses", KSTAT_DATA_UINT64 }, 797 { "mru_hits", KSTAT_DATA_UINT64 }, 798 { "mru_ghost_hits", KSTAT_DATA_UINT64 }, 799 { "mfu_hits", KSTAT_DATA_UINT64 }, 800 { "mfu_ghost_hits", KSTAT_DATA_UINT64 }, 801 { "allocated", KSTAT_DATA_UINT64 }, 802 { "deleted", KSTAT_DATA_UINT64 }, 803 { "mutex_miss", KSTAT_DATA_UINT64 }, |
804 { "access_skip", KSTAT_DATA_UINT64 }, |
|
799 { "evict_skip", KSTAT_DATA_UINT64 }, 800 { "evict_not_enough", KSTAT_DATA_UINT64 }, 801 { "evict_l2_cached", KSTAT_DATA_UINT64 }, 802 { "evict_l2_eligible", KSTAT_DATA_UINT64 }, 803 { "evict_l2_ineligible", KSTAT_DATA_UINT64 }, 804 { "evict_l2_skip", KSTAT_DATA_UINT64 }, 805 { "hash_elements", KSTAT_DATA_UINT64 }, 806 { "hash_elements_max", KSTAT_DATA_UINT64 }, --- 4272 unchanged lines hidden (view full) --- 5079 hdr->b_l1hdr.b_arc_access = ddi_get_lbolt(); 5080 DTRACE_PROBE1(new_state__mfu, arc_buf_hdr_t *, hdr); 5081 arc_change_state(arc_mfu, hdr, hash_lock); 5082 } else { 5083 ASSERT(!"invalid arc state"); 5084 } 5085} 5086 | 805 { "evict_skip", KSTAT_DATA_UINT64 }, 806 { "evict_not_enough", KSTAT_DATA_UINT64 }, 807 { "evict_l2_cached", KSTAT_DATA_UINT64 }, 808 { "evict_l2_eligible", KSTAT_DATA_UINT64 }, 809 { "evict_l2_ineligible", KSTAT_DATA_UINT64 }, 810 { "evict_l2_skip", KSTAT_DATA_UINT64 }, 811 { "hash_elements", KSTAT_DATA_UINT64 }, 812 { "hash_elements_max", KSTAT_DATA_UINT64 }, --- 4272 unchanged lines hidden (view full) --- 5085 hdr->b_l1hdr.b_arc_access = ddi_get_lbolt(); 5086 DTRACE_PROBE1(new_state__mfu, arc_buf_hdr_t *, hdr); 5087 arc_change_state(arc_mfu, hdr, hash_lock); 5088 } else { 5089 ASSERT(!"invalid arc state"); 5090 } 5091} 5092 |
5093/* 5094 * This routine is called by dbuf_hold() to update the arc_access() state 5095 * which otherwise would be skipped for entries in the dbuf cache. 5096 */ 5097void 5098arc_buf_access(arc_buf_t *buf) 5099{ 5100 mutex_enter(&buf->b_evict_lock); 5101 arc_buf_hdr_t *hdr = buf->b_hdr; 5102 5103 /* 5104 * Avoid taking the hash_lock when possible as an optimization. 5105 * The header must be checked again under the hash_lock in order 5106 * to handle the case where it is concurrently being released. 5107 */ 5108 if (hdr->b_l1hdr.b_state == arc_anon || HDR_EMPTY(hdr)) { 5109 mutex_exit(&buf->b_evict_lock); 5110 ARCSTAT_BUMP(arcstat_access_skip); 5111 return; 5112 } 5113 5114 kmutex_t *hash_lock = HDR_LOCK(hdr); 5115 mutex_enter(hash_lock); 5116 5117 if (hdr->b_l1hdr.b_state == arc_anon || HDR_EMPTY(hdr)) { 5118 mutex_exit(hash_lock); 5119 mutex_exit(&buf->b_evict_lock); 5120 ARCSTAT_BUMP(arcstat_access_skip); 5121 return; 5122 } 5123 5124 mutex_exit(&buf->b_evict_lock); 5125 5126 ASSERT(hdr->b_l1hdr.b_state == arc_mru || 5127 hdr->b_l1hdr.b_state == arc_mfu); 5128 5129 DTRACE_PROBE1(arc__hit, arc_buf_hdr_t *, hdr); 5130 arc_access(hdr, hash_lock); 5131 mutex_exit(hash_lock); 5132 5133 ARCSTAT_BUMP(arcstat_hits); 5134 ARCSTAT_CONDSTAT(!HDR_PREFETCH(hdr), 5135 demand, prefetch, !HDR_ISTYPE_METADATA(hdr), data, metadata, hits); 5136} 5137 |
|
5087/* a generic arc_done_func_t which you can use */ 5088/* ARGSUSED */ 5089void 5090arc_bcopy_func(zio_t *zio, arc_buf_t *buf, void *arg) 5091{ 5092 if (zio == NULL || zio->io_error == 0) 5093 bcopy(buf->b_data, arg, arc_buf_size(buf)); 5094 arc_buf_destroy(buf, arg); --- 2855 unchanged lines hidden --- | 5138/* a generic arc_done_func_t which you can use */ 5139/* ARGSUSED */ 5140void 5141arc_bcopy_func(zio_t *zio, arc_buf_t *buf, void *arg) 5142{ 5143 if (zio == NULL || zio->io_error == 0) 5144 bcopy(buf->b_data, arg, arc_buf_size(buf)); 5145 arc_buf_destroy(buf, arg); --- 2855 unchanged lines hidden --- |