Lines Matching refs:zone
76 struct ttm_mem_zone *zone = in ttm_mem_zone_kobj_release() local
80 zone->name, (unsigned long long)zone->used_mem >> 10); in ttm_mem_zone_kobj_release()
81 kfree(zone); in ttm_mem_zone_kobj_release()
88 struct ttm_mem_zone *zone = in ttm_mem_zone_show() local
92 spin_lock(&zone->glob->lock); in ttm_mem_zone_show()
94 val = zone->zone_mem; in ttm_mem_zone_show()
96 val = zone->emer_mem; in ttm_mem_zone_show()
98 val = zone->max_mem; in ttm_mem_zone_show()
100 val = zone->swap_limit; in ttm_mem_zone_show()
102 val = zone->used_mem; in ttm_mem_zone_show()
103 spin_unlock(&zone->glob->lock); in ttm_mem_zone_show()
116 struct ttm_mem_zone *zone = in ttm_mem_zone_store() local
129 spin_lock(&zone->glob->lock); in ttm_mem_zone_store()
130 if (val64 > zone->zone_mem) in ttm_mem_zone_store()
131 val64 = zone->zone_mem; in ttm_mem_zone_store()
133 zone->emer_mem = val64; in ttm_mem_zone_store()
134 if (zone->max_mem > val64) in ttm_mem_zone_store()
135 zone->max_mem = val64; in ttm_mem_zone_store()
137 zone->max_mem = val64; in ttm_mem_zone_store()
138 if (zone->emer_mem < val64) in ttm_mem_zone_store()
139 zone->emer_mem = val64; in ttm_mem_zone_store()
141 zone->swap_limit = val64; in ttm_mem_zone_store()
142 spin_unlock(&zone->glob->lock); in ttm_mem_zone_store()
144 ttm_check_swapping(zone->glob); in ttm_mem_zone_store()
185 struct ttm_mem_zone *zone; in ttm_zones_above_swap_target() local
189 zone = glob->zones[i]; in ttm_zones_above_swap_target()
192 target = zone->swap_limit; in ttm_zones_above_swap_target()
194 target = zone->emer_mem; in ttm_zones_above_swap_target()
196 target = zone->max_mem; in ttm_zones_above_swap_target()
200 if (zone->used_mem > target) in ttm_zones_above_swap_target()
248 struct ttm_mem_zone *zone = kzalloc(sizeof(*zone), GFP_KERNEL); in ttm_mem_init_kernel_zone() local
252 if (unlikely(!zone)) in ttm_mem_init_kernel_zone()
258 zone->name = "kernel"; in ttm_mem_init_kernel_zone()
259 zone->zone_mem = mem; in ttm_mem_init_kernel_zone()
260 zone->max_mem = mem >> 1; in ttm_mem_init_kernel_zone()
261 zone->emer_mem = (mem >> 1) + (mem >> 2); in ttm_mem_init_kernel_zone()
262 zone->swap_limit = zone->max_mem - (mem >> 3); in ttm_mem_init_kernel_zone()
263 zone->used_mem = 0; in ttm_mem_init_kernel_zone()
264 zone->glob = glob; in ttm_mem_init_kernel_zone()
265 glob->zone_kernel = zone; in ttm_mem_init_kernel_zone()
267 &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name); in ttm_mem_init_kernel_zone()
269 kobject_put(&zone->kobj); in ttm_mem_init_kernel_zone()
272 glob->zones[glob->num_zones++] = zone; in ttm_mem_init_kernel_zone()
280 struct ttm_mem_zone *zone; in ttm_mem_init_highmem_zone() local
287 zone = kzalloc(sizeof(*zone), GFP_KERNEL); in ttm_mem_init_highmem_zone()
288 if (unlikely(!zone)) in ttm_mem_init_highmem_zone()
294 zone->name = "highmem"; in ttm_mem_init_highmem_zone()
295 zone->zone_mem = mem; in ttm_mem_init_highmem_zone()
296 zone->max_mem = mem >> 1; in ttm_mem_init_highmem_zone()
297 zone->emer_mem = (mem >> 1) + (mem >> 2); in ttm_mem_init_highmem_zone()
298 zone->swap_limit = zone->max_mem - (mem >> 3); in ttm_mem_init_highmem_zone()
299 zone->used_mem = 0; in ttm_mem_init_highmem_zone()
300 zone->glob = glob; in ttm_mem_init_highmem_zone()
301 glob->zone_highmem = zone; in ttm_mem_init_highmem_zone()
303 &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name); in ttm_mem_init_highmem_zone()
305 kobject_put(&zone->kobj); in ttm_mem_init_highmem_zone()
308 glob->zones[glob->num_zones++] = zone; in ttm_mem_init_highmem_zone()
315 struct ttm_mem_zone *zone = kzalloc(sizeof(*zone), GFP_KERNEL); in ttm_mem_init_dma32_zone() local
319 if (unlikely(!zone)) in ttm_mem_init_dma32_zone()
330 kfree(zone); in ttm_mem_init_dma32_zone()
341 zone->name = "dma32"; in ttm_mem_init_dma32_zone()
342 zone->zone_mem = mem; in ttm_mem_init_dma32_zone()
343 zone->max_mem = mem >> 1; in ttm_mem_init_dma32_zone()
344 zone->emer_mem = (mem >> 1) + (mem >> 2); in ttm_mem_init_dma32_zone()
345 zone->swap_limit = zone->max_mem - (mem >> 3); in ttm_mem_init_dma32_zone()
346 zone->used_mem = 0; in ttm_mem_init_dma32_zone()
347 zone->glob = glob; in ttm_mem_init_dma32_zone()
348 glob->zone_dma32 = zone; in ttm_mem_init_dma32_zone()
350 &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name); in ttm_mem_init_dma32_zone()
352 kobject_put(&zone->kobj); in ttm_mem_init_dma32_zone()
355 glob->zones[glob->num_zones++] = zone; in ttm_mem_init_dma32_zone()
365 struct ttm_mem_zone *zone; in ttm_mem_global_init() local
392 zone = glob->zones[i]; in ttm_mem_global_init()
394 zone->name, (unsigned long long)zone->max_mem >> 10); in ttm_mem_global_init()
408 struct ttm_mem_zone *zone; in ttm_mem_global_release() local
418 zone = glob->zones[i]; in ttm_mem_global_release()
419 kobject_del(&zone->kobj); in ttm_mem_global_release()
420 kobject_put(&zone->kobj); in ttm_mem_global_release()
431 struct ttm_mem_zone *zone; in ttm_check_swapping() local
435 zone = glob->zones[i]; in ttm_check_swapping()
436 if (zone->used_mem > zone->swap_limit) { in ttm_check_swapping()
454 struct ttm_mem_zone *zone; in ttm_mem_global_free_zone() local
458 zone = glob->zones[i]; in ttm_mem_global_free_zone()
459 if (single_zone && zone != single_zone) in ttm_mem_global_free_zone()
461 zone->used_mem -= amount; in ttm_mem_global_free_zone()
480 struct ttm_mem_zone *zone; in ttm_mem_global_reserve() local
484 zone = glob->zones[i]; in ttm_mem_global_reserve()
485 if (single_zone && zone != single_zone) in ttm_mem_global_reserve()
489 zone->emer_mem : zone->max_mem; in ttm_mem_global_reserve()
491 if (zone->used_mem > limit) in ttm_mem_global_reserve()
497 zone = glob->zones[i]; in ttm_mem_global_reserve()
498 if (single_zone && zone != single_zone) in ttm_mem_global_reserve()
500 zone->used_mem += amount; in ttm_mem_global_reserve()
552 struct ttm_mem_zone *zone = NULL; in ttm_mem_global_alloc_page() local
561 zone = glob->zone_highmem; in ttm_mem_global_alloc_page()
564 zone = glob->zone_kernel; in ttm_mem_global_alloc_page()
566 return ttm_mem_global_alloc_zone(glob, zone, PAGE_SIZE, no_wait, in ttm_mem_global_alloc_page()
572 struct ttm_mem_zone *zone = NULL; in ttm_mem_global_free_page() local
576 zone = glob->zone_highmem; in ttm_mem_global_free_page()
579 zone = glob->zone_kernel; in ttm_mem_global_free_page()
581 ttm_mem_global_free_zone(glob, zone, PAGE_SIZE); in ttm_mem_global_free_page()