nxt_mem_zone.c (611:323e11065f83) nxt_mem_zone.c (2084:7d479274f334)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8

--- 73 unchanged lines hidden (view full) ---

82
83 u_char *start;
84 u_char *end;
85
86 nxt_mem_zone_slot_t slots[];
87};
88
89
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8

--- 73 unchanged lines hidden (view full) ---

82
83 u_char *start;
84 u_char *end;
85
86 nxt_mem_zone_slot_t slots[];
87};
88
89
90#define \
91nxt_mem_zone_page_addr(zone, page) \
90#define nxt_mem_zone_page_addr(zone, page) \
92 (void *) (zone->start + ((page - zone->pages) << zone->page_size_shift))
93
94
91 (void *) (zone->start + ((page - zone->pages) << zone->page_size_shift))
92
93
95#define \
96nxt_mem_zone_addr_page(zone, addr) \
94#define nxt_mem_zone_addr_page(zone, addr) \
97 &zone->pages[((u_char *) addr - zone->start) >> zone->page_size_shift]
98
99
95 &zone->pages[((u_char *) addr - zone->start) >> zone->page_size_shift]
96
97
100#define \
101nxt_mem_zone_page_is_free(page) \
98#define nxt_mem_zone_page_is_free(page) \
102 (page->size < NXT_MEM_ZONE_PAGE_USED)
103
104
99 (page->size < NXT_MEM_ZONE_PAGE_USED)
100
101
105#define \
106nxt_mem_zone_page_is_chunked(page) \
102#define nxt_mem_zone_page_is_chunked(page) \
107 (page->size >= 16)
108
109
103 (page->size >= 16)
104
105
110#define \
111nxt_mem_zone_page_bitmap(zone, slot) \
106#define nxt_mem_zone_page_bitmap(zone, slot) \
112 (slot->size < zone->small_bitmap_min_size)
113
114
107 (slot->size < zone->small_bitmap_min_size)
108
109
115#define \
116nxt_mem_zone_set_chunk_free(map, chunk) \
110#define nxt_mem_zone_set_chunk_free(map, chunk) \
117 map[chunk / 8] &= ~(0x80 >> (chunk & 7))
118
119
111 map[chunk / 8] &= ~(0x80 >> (chunk & 7))
112
113
120#define \
121nxt_mem_zone_chunk_is_free(map, chunk) \
114#define nxt_mem_zone_chunk_is_free(map, chunk) \
122 ((map[chunk / 8] & (0x80 >> (chunk & 7))) == 0)
123
124
115 ((map[chunk / 8] & (0x80 >> (chunk & 7))) == 0)
116
117
125#define \
126nxt_mem_zone_fresh_junk(p, size) \
118#define nxt_mem_zone_fresh_junk(p, size) \
127 nxt_memset((p), 0xA5, size)
128
129
119 nxt_memset((p), 0xA5, size)
120
121
130#define \
131nxt_mem_zone_free_junk(p, size) \
122#define nxt_mem_zone_free_junk(p, size) \
132 nxt_memset((p), 0x5A, size)
133
134
135static uint32_t nxt_mem_zone_pages(u_char *start, size_t zone_size,
136 nxt_uint_t page_size);
137static void *nxt_mem_zone_slots_init(nxt_mem_zone_t *zone,
138 nxt_uint_t page_size);
139static void nxt_mem_zone_slot_init(nxt_mem_zone_slot_t *slot,

--- 818 unchanged lines hidden ---
123 nxt_memset((p), 0x5A, size)
124
125
126static uint32_t nxt_mem_zone_pages(u_char *start, size_t zone_size,
127 nxt_uint_t page_size);
128static void *nxt_mem_zone_slots_init(nxt_mem_zone_t *zone,
129 nxt_uint_t page_size);
130static void nxt_mem_zone_slot_init(nxt_mem_zone_slot_t *slot,

--- 818 unchanged lines hidden ---