33
33
#include <sys/zio_crypt.h>
34
34
#include <sys/zthr.h>
35
35
#include <sys/aggsum.h>
36
+ #include <sys/wmsum.h>
36
37
37
38
#ifdef __cplusplus
38
39
extern "C" {
@@ -563,7 +564,6 @@ typedef struct arc_stats {
563
564
kstat_named_t arcstat_c ;
564
565
kstat_named_t arcstat_c_min ;
565
566
kstat_named_t arcstat_c_max ;
566
- /* Not updated directly; only synced in arc_kstat_update. */
567
567
kstat_named_t arcstat_size ;
568
568
/*
569
569
* Number of compressed bytes stored in the arc_buf_hdr_t's b_pabd.
@@ -592,37 +592,31 @@ typedef struct arc_stats {
592
592
* (allocated via arc_buf_hdr_t_full and arc_buf_hdr_t_l2only
593
593
* caches), and arc_buf_t structures (allocated via arc_buf_t
594
594
* cache).
595
- * Not updated directly; only synced in arc_kstat_update.
596
595
*/
597
596
kstat_named_t arcstat_hdr_size ;
598
597
/*
599
598
* Number of bytes consumed by ARC buffers of type equal to
600
599
* ARC_BUFC_DATA. This is generally consumed by buffers backing
601
600
* on disk user data (e.g. plain file contents).
602
- * Not updated directly; only synced in arc_kstat_update.
603
601
*/
604
602
kstat_named_t arcstat_data_size ;
605
603
/*
606
604
* Number of bytes consumed by ARC buffers of type equal to
607
605
* ARC_BUFC_METADATA. This is generally consumed by buffers
608
606
* backing on disk data that is used for internal ZFS
609
607
* structures (e.g. ZAP, dnode, indirect blocks, etc).
610
- * Not updated directly; only synced in arc_kstat_update.
611
608
*/
612
609
kstat_named_t arcstat_metadata_size ;
613
610
/*
614
611
* Number of bytes consumed by dmu_buf_impl_t objects.
615
- * Not updated directly; only synced in arc_kstat_update.
616
612
*/
617
613
kstat_named_t arcstat_dbuf_size ;
618
614
/*
619
615
* Number of bytes consumed by dnode_t objects.
620
- * Not updated directly; only synced in arc_kstat_update.
621
616
*/
622
617
kstat_named_t arcstat_dnode_size ;
623
618
/*
624
619
* Number of bytes consumed by bonus buffers.
625
- * Not updated directly; only synced in arc_kstat_update.
626
620
*/
627
621
kstat_named_t arcstat_bonus_size ;
628
622
#if defined(COMPAT_FREEBSD11 )
@@ -637,47 +631,41 @@ typedef struct arc_stats {
637
631
* arc_anon state. This includes *all* buffers in the arc_anon
638
632
* state; e.g. data, metadata, evictable, and unevictable buffers
639
633
* are all included in this value.
640
- * Not updated directly; only synced in arc_kstat_update.
641
634
*/
642
635
kstat_named_t arcstat_anon_size ;
643
636
/*
644
637
* Number of bytes consumed by ARC buffers that meet the
645
638
* following criteria: backing buffers of type ARC_BUFC_DATA,
646
639
* residing in the arc_anon state, and are eligible for eviction
647
640
* (e.g. have no outstanding holds on the buffer).
648
- * Not updated directly; only synced in arc_kstat_update.
649
641
*/
650
642
kstat_named_t arcstat_anon_evictable_data ;
651
643
/*
652
644
* Number of bytes consumed by ARC buffers that meet the
653
645
* following criteria: backing buffers of type ARC_BUFC_METADATA,
654
646
* residing in the arc_anon state, and are eligible for eviction
655
647
* (e.g. have no outstanding holds on the buffer).
656
- * Not updated directly; only synced in arc_kstat_update.
657
648
*/
658
649
kstat_named_t arcstat_anon_evictable_metadata ;
659
650
/*
660
651
* Total number of bytes consumed by ARC buffers residing in the
661
652
* arc_mru state. This includes *all* buffers in the arc_mru
662
653
* state; e.g. data, metadata, evictable, and unevictable buffers
663
654
* are all included in this value.
664
- * Not updated directly; only synced in arc_kstat_update.
665
655
*/
666
656
kstat_named_t arcstat_mru_size ;
667
657
/*
668
658
* Number of bytes consumed by ARC buffers that meet the
669
659
* following criteria: backing buffers of type ARC_BUFC_DATA,
670
660
* residing in the arc_mru state, and are eligible for eviction
671
661
* (e.g. have no outstanding holds on the buffer).
672
- * Not updated directly; only synced in arc_kstat_update.
673
662
*/
674
663
kstat_named_t arcstat_mru_evictable_data ;
675
664
/*
676
665
* Number of bytes consumed by ARC buffers that meet the
677
666
* following criteria: backing buffers of type ARC_BUFC_METADATA,
678
667
* residing in the arc_mru state, and are eligible for eviction
679
668
* (e.g. have no outstanding holds on the buffer).
680
- * Not updated directly; only synced in arc_kstat_update.
681
669
*/
682
670
kstat_named_t arcstat_mru_evictable_metadata ;
683
671
/*
@@ -688,64 +676,55 @@ typedef struct arc_stats {
688
676
* don't actually have ARC buffers linked off of these headers.
689
677
* Thus, *if* the headers had associated ARC buffers, these
690
678
* buffers *would have* consumed this number of bytes.
691
- * Not updated directly; only synced in arc_kstat_update.
692
679
*/
693
680
kstat_named_t arcstat_mru_ghost_size ;
694
681
/*
695
682
* Number of bytes that *would have been* consumed by ARC
696
683
* buffers that are eligible for eviction, of type
697
684
* ARC_BUFC_DATA, and linked off the arc_mru_ghost state.
698
- * Not updated directly; only synced in arc_kstat_update.
699
685
*/
700
686
kstat_named_t arcstat_mru_ghost_evictable_data ;
701
687
/*
702
688
* Number of bytes that *would have been* consumed by ARC
703
689
* buffers that are eligible for eviction, of type
704
690
* ARC_BUFC_METADATA, and linked off the arc_mru_ghost state.
705
- * Not updated directly; only synced in arc_kstat_update.
706
691
*/
707
692
kstat_named_t arcstat_mru_ghost_evictable_metadata ;
708
693
/*
709
694
* Total number of bytes consumed by ARC buffers residing in the
710
695
* arc_mfu state. This includes *all* buffers in the arc_mfu
711
696
* state; e.g. data, metadata, evictable, and unevictable buffers
712
697
* are all included in this value.
713
- * Not updated directly; only synced in arc_kstat_update.
714
698
*/
715
699
kstat_named_t arcstat_mfu_size ;
716
700
/*
717
701
* Number of bytes consumed by ARC buffers that are eligible for
718
702
* eviction, of type ARC_BUFC_DATA, and reside in the arc_mfu
719
703
* state.
720
- * Not updated directly; only synced in arc_kstat_update.
721
704
*/
722
705
kstat_named_t arcstat_mfu_evictable_data ;
723
706
/*
724
707
* Number of bytes consumed by ARC buffers that are eligible for
725
708
* eviction, of type ARC_BUFC_METADATA, and reside in the
726
709
* arc_mfu state.
727
- * Not updated directly; only synced in arc_kstat_update.
728
710
*/
729
711
kstat_named_t arcstat_mfu_evictable_metadata ;
730
712
/*
731
713
* Total number of bytes that *would have been* consumed by ARC
732
714
* buffers in the arc_mfu_ghost state. See the comment above
733
715
* arcstat_mru_ghost_size for more details.
734
- * Not updated directly; only synced in arc_kstat_update.
735
716
*/
736
717
kstat_named_t arcstat_mfu_ghost_size ;
737
718
/*
738
719
* Number of bytes that *would have been* consumed by ARC
739
720
* buffers that are eligible for eviction, of type
740
721
* ARC_BUFC_DATA, and linked off the arc_mfu_ghost state.
741
- * Not updated directly; only synced in arc_kstat_update.
742
722
*/
743
723
kstat_named_t arcstat_mfu_ghost_evictable_data ;
744
724
/*
745
725
* Number of bytes that *would have been* consumed by ARC
746
726
* buffers that are eligible for eviction, of type
747
727
* ARC_BUFC_METADATA, and linked off the arc_mru_ghost state.
748
- * Not updated directly; only synced in arc_kstat_update.
749
728
*/
750
729
kstat_named_t arcstat_mfu_ghost_evictable_metadata ;
751
730
kstat_named_t arcstat_l2_hits ;
@@ -779,7 +758,6 @@ typedef struct arc_stats {
779
758
kstat_named_t arcstat_l2_io_error ;
780
759
kstat_named_t arcstat_l2_lsize ;
781
760
kstat_named_t arcstat_l2_psize ;
782
- /* Not updated directly; only synced in arc_kstat_update. */
783
761
kstat_named_t arcstat_l2_hdr_size ;
784
762
/*
785
763
* Number of L2ARC log blocks written. These are used for restoring the
@@ -860,7 +838,6 @@ typedef struct arc_stats {
860
838
kstat_named_t arcstat_tempreserve ;
861
839
kstat_named_t arcstat_loaned_bytes ;
862
840
kstat_named_t arcstat_prune ;
863
- /* Not updated directly; only synced in arc_kstat_update. */
864
841
kstat_named_t arcstat_meta_used ;
865
842
kstat_named_t arcstat_meta_limit ;
866
843
kstat_named_t arcstat_dnode_limit ;
@@ -876,6 +853,96 @@ typedef struct arc_stats {
876
853
kstat_named_t arcstat_abd_chunk_waste_size ;
877
854
} arc_stats_t ;
878
855
856
+ typedef struct arc_sums {
857
+ wmsum_t arcstat_hits ;
858
+ wmsum_t arcstat_misses ;
859
+ wmsum_t arcstat_demand_data_hits ;
860
+ wmsum_t arcstat_demand_data_misses ;
861
+ wmsum_t arcstat_demand_metadata_hits ;
862
+ wmsum_t arcstat_demand_metadata_misses ;
863
+ wmsum_t arcstat_prefetch_data_hits ;
864
+ wmsum_t arcstat_prefetch_data_misses ;
865
+ wmsum_t arcstat_prefetch_metadata_hits ;
866
+ wmsum_t arcstat_prefetch_metadata_misses ;
867
+ wmsum_t arcstat_mru_hits ;
868
+ wmsum_t arcstat_mru_ghost_hits ;
869
+ wmsum_t arcstat_mfu_hits ;
870
+ wmsum_t arcstat_mfu_ghost_hits ;
871
+ wmsum_t arcstat_deleted ;
872
+ wmsum_t arcstat_mutex_miss ;
873
+ wmsum_t arcstat_access_skip ;
874
+ wmsum_t arcstat_evict_skip ;
875
+ wmsum_t arcstat_evict_not_enough ;
876
+ wmsum_t arcstat_evict_l2_cached ;
877
+ wmsum_t arcstat_evict_l2_eligible ;
878
+ wmsum_t arcstat_evict_l2_eligible_mfu ;
879
+ wmsum_t arcstat_evict_l2_eligible_mru ;
880
+ wmsum_t arcstat_evict_l2_ineligible ;
881
+ wmsum_t arcstat_evict_l2_skip ;
882
+ wmsum_t arcstat_hash_collisions ;
883
+ wmsum_t arcstat_hash_chains ;
884
+ aggsum_t arcstat_size ;
885
+ wmsum_t arcstat_compressed_size ;
886
+ wmsum_t arcstat_uncompressed_size ;
887
+ wmsum_t arcstat_overhead_size ;
888
+ wmsum_t arcstat_hdr_size ;
889
+ wmsum_t arcstat_data_size ;
890
+ wmsum_t arcstat_metadata_size ;
891
+ wmsum_t arcstat_dbuf_size ;
892
+ aggsum_t arcstat_dnode_size ;
893
+ wmsum_t arcstat_bonus_size ;
894
+ wmsum_t arcstat_l2_hits ;
895
+ wmsum_t arcstat_l2_misses ;
896
+ wmsum_t arcstat_l2_prefetch_asize ;
897
+ wmsum_t arcstat_l2_mru_asize ;
898
+ wmsum_t arcstat_l2_mfu_asize ;
899
+ wmsum_t arcstat_l2_bufc_data_asize ;
900
+ wmsum_t arcstat_l2_bufc_metadata_asize ;
901
+ wmsum_t arcstat_l2_feeds ;
902
+ wmsum_t arcstat_l2_rw_clash ;
903
+ wmsum_t arcstat_l2_read_bytes ;
904
+ wmsum_t arcstat_l2_write_bytes ;
905
+ wmsum_t arcstat_l2_writes_sent ;
906
+ wmsum_t arcstat_l2_writes_done ;
907
+ wmsum_t arcstat_l2_writes_error ;
908
+ wmsum_t arcstat_l2_writes_lock_retry ;
909
+ wmsum_t arcstat_l2_evict_lock_retry ;
910
+ wmsum_t arcstat_l2_evict_reading ;
911
+ wmsum_t arcstat_l2_evict_l1cached ;
912
+ wmsum_t arcstat_l2_free_on_write ;
913
+ wmsum_t arcstat_l2_abort_lowmem ;
914
+ wmsum_t arcstat_l2_cksum_bad ;
915
+ wmsum_t arcstat_l2_io_error ;
916
+ wmsum_t arcstat_l2_lsize ;
917
+ wmsum_t arcstat_l2_psize ;
918
+ aggsum_t arcstat_l2_hdr_size ;
919
+ wmsum_t arcstat_l2_log_blk_writes ;
920
+ wmsum_t arcstat_l2_log_blk_asize ;
921
+ wmsum_t arcstat_l2_log_blk_count ;
922
+ wmsum_t arcstat_l2_rebuild_success ;
923
+ wmsum_t arcstat_l2_rebuild_abort_unsupported ;
924
+ wmsum_t arcstat_l2_rebuild_abort_io_errors ;
925
+ wmsum_t arcstat_l2_rebuild_abort_dh_errors ;
926
+ wmsum_t arcstat_l2_rebuild_abort_cksum_lb_errors ;
927
+ wmsum_t arcstat_l2_rebuild_abort_lowmem ;
928
+ wmsum_t arcstat_l2_rebuild_size ;
929
+ wmsum_t arcstat_l2_rebuild_asize ;
930
+ wmsum_t arcstat_l2_rebuild_bufs ;
931
+ wmsum_t arcstat_l2_rebuild_bufs_precached ;
932
+ wmsum_t arcstat_l2_rebuild_log_blks ;
933
+ wmsum_t arcstat_memory_throttle_count ;
934
+ wmsum_t arcstat_memory_direct_count ;
935
+ wmsum_t arcstat_memory_indirect_count ;
936
+ wmsum_t arcstat_prune ;
937
+ aggsum_t arcstat_meta_used ;
938
+ wmsum_t arcstat_async_upgrade_sync ;
939
+ wmsum_t arcstat_demand_hit_predictive_prefetch ;
940
+ wmsum_t arcstat_demand_hit_prescient_prefetch ;
941
+ wmsum_t arcstat_raw_size ;
942
+ wmsum_t arcstat_cached_only_in_progress ;
943
+ wmsum_t arcstat_abd_chunk_waste_size ;
944
+ } arc_sums_t ;
945
+
879
946
typedef struct arc_evict_waiter {
880
947
list_node_t aew_node ;
881
948
kcondvar_t aew_cv ;
@@ -885,7 +952,7 @@ typedef struct arc_evict_waiter {
885
952
#define ARCSTAT (stat ) (arc_stats.stat.value.ui64)
886
953
887
954
#define ARCSTAT_INCR (stat , val ) \
888
- atomic_add_64(&arc_stats .stat.value.ui64 , (val))
955
+ wmsum_add(&arc_sums .stat, (val))
889
956
890
957
#define ARCSTAT_BUMP (stat ) ARCSTAT_INCR(stat, 1)
891
958
#define ARCSTAT_BUMPDOWN (stat ) ARCSTAT_INCR(stat, -1)
@@ -899,14 +966,14 @@ typedef struct arc_evict_waiter {
899
966
900
967
extern taskq_t * arc_prune_taskq ;
901
968
extern arc_stats_t arc_stats ;
969
+ extern arc_sums_t arc_sums ;
902
970
extern hrtime_t arc_growtime ;
903
971
extern boolean_t arc_warm ;
904
972
extern int arc_grow_retry ;
905
973
extern int arc_no_grow_shift ;
906
974
extern int arc_shrink_shift ;
907
975
extern kmutex_t arc_prune_mtx ;
908
976
extern list_t arc_prune_list ;
909
- extern aggsum_t arc_size ;
910
977
extern arc_state_t * arc_mfu ;
911
978
extern arc_state_t * arc_mru ;
912
979
extern uint_t zfs_arc_pc_percent ;
0 commit comments