| 931 | } |
| 932 | |
| 933 | static void |
| 934 | shm_init(void *arg) |
| 935 | { |
| 936 | char name[32]; |
| 937 | int i; |
| 938 | |
| 939 | mtx_init(&shm_timestamp_lock, "shm timestamps", NULL, MTX_DEF); |
| 940 | sx_init(&shm_dict_lock, "shm dictionary"); |
| 941 | shm_dictionary = hashinit(1024, M_SHMFD, &shm_hash); |
| 942 | new_unrhdr64(&shm_ino_unr, 1); |
| 943 | shm_dev_ino = devfs_alloc_cdp_inode(); |
| 944 | KASSERT(shm_dev_ino > 0, ("shm dev inode not initialized")); |
| 945 | |
| 946 | for (i = 1; i < MAXPAGESIZES; i++) { |
| 947 | if (pagesizes[i] == 0) |
| 948 | break; |
| 949 | #define M (1024 * 1024) |
| 950 | #define G (1024 * M) |
| 951 | if (pagesizes[i] >= G) |
| 952 | snprintf(name, sizeof(name), "%luG", pagesizes[i] / G); |
| 953 | else if (pagesizes[i] >= M) |
| 954 | snprintf(name, sizeof(name), "%luM", pagesizes[i] / M); |
| 955 | else |
| 956 | snprintf(name, sizeof(name), "%lu", pagesizes[i]); |
| 957 | #undef G |
| 958 | #undef M |
| 959 | SYSCTL_ADD_ULONG(NULL, SYSCTL_STATIC_CHILDREN(_vm_largepages), |
| 960 | OID_AUTO, name, CTLFLAG_RD, &count_largepages[i], |
| 961 | "number of non-transient largepages allocated"); |
| 962 | } |
| 963 | } |
| 964 | SYSINIT(shm_init, SI_SUB_SYSV_SHM, SI_ORDER_ANY, shm_init, NULL); |
| 965 | |
| 966 | /* |
nothing calls this directly
no test coverage detected