Lines Matching refs:zone
78 struct ttm_mem_zone *zone = in ttm_mem_zone_kobj_release() local
82 zone->name, (unsigned long long)zone->used_mem >> 10); in ttm_mem_zone_kobj_release()
83 kfree(zone); in ttm_mem_zone_kobj_release()
90 struct ttm_mem_zone *zone = in ttm_mem_zone_show() local
94 spin_lock(&zone->glob->lock); in ttm_mem_zone_show()
96 val = zone->zone_mem; in ttm_mem_zone_show()
98 val = zone->emer_mem; in ttm_mem_zone_show()
100 val = zone->max_mem; in ttm_mem_zone_show()
102 val = zone->swap_limit; in ttm_mem_zone_show()
104 val = zone->used_mem; in ttm_mem_zone_show()
105 spin_unlock(&zone->glob->lock); in ttm_mem_zone_show()
118 struct ttm_mem_zone *zone = in ttm_mem_zone_store() local
131 spin_lock(&zone->glob->lock); in ttm_mem_zone_store()
132 if (val64 > zone->zone_mem) in ttm_mem_zone_store()
133 val64 = zone->zone_mem; in ttm_mem_zone_store()
135 zone->emer_mem = val64; in ttm_mem_zone_store()
136 if (zone->max_mem > val64) in ttm_mem_zone_store()
137 zone->max_mem = val64; in ttm_mem_zone_store()
139 zone->max_mem = val64; in ttm_mem_zone_store()
140 if (zone->emer_mem < val64) in ttm_mem_zone_store()
141 zone->emer_mem = val64; in ttm_mem_zone_store()
143 zone->swap_limit = val64; in ttm_mem_zone_store()
144 spin_unlock(&zone->glob->lock); in ttm_mem_zone_store()
146 ttm_check_swapping(zone->glob); in ttm_mem_zone_store()
247 struct ttm_mem_zone *zone; in ttm_zones_above_swap_target() local
251 zone = glob->zones[i]; in ttm_zones_above_swap_target()
254 target = zone->swap_limit; in ttm_zones_above_swap_target()
256 target = zone->emer_mem; in ttm_zones_above_swap_target()
258 target = zone->max_mem; in ttm_zones_above_swap_target()
262 if (zone->used_mem > target) in ttm_zones_above_swap_target()
308 struct ttm_mem_zone *zone = kzalloc(sizeof(*zone), GFP_KERNEL); in ttm_mem_init_kernel_zone() local
312 if (unlikely(!zone)) in ttm_mem_init_kernel_zone()
318 zone->name = "kernel"; in ttm_mem_init_kernel_zone()
319 zone->zone_mem = mem; in ttm_mem_init_kernel_zone()
320 zone->max_mem = mem >> 1; in ttm_mem_init_kernel_zone()
321 zone->emer_mem = (mem >> 1) + (mem >> 2); in ttm_mem_init_kernel_zone()
322 zone->swap_limit = zone->max_mem - (mem >> 3); in ttm_mem_init_kernel_zone()
323 zone->used_mem = 0; in ttm_mem_init_kernel_zone()
324 zone->glob = glob; in ttm_mem_init_kernel_zone()
325 glob->zone_kernel = zone; in ttm_mem_init_kernel_zone()
327 &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name); in ttm_mem_init_kernel_zone()
329 kobject_put(&zone->kobj); in ttm_mem_init_kernel_zone()
332 glob->zones[glob->num_zones++] = zone; in ttm_mem_init_kernel_zone()
340 struct ttm_mem_zone *zone; in ttm_mem_init_highmem_zone() local
347 zone = kzalloc(sizeof(*zone), GFP_KERNEL); in ttm_mem_init_highmem_zone()
348 if (unlikely(!zone)) in ttm_mem_init_highmem_zone()
354 zone->name = "highmem"; in ttm_mem_init_highmem_zone()
355 zone->zone_mem = mem; in ttm_mem_init_highmem_zone()
356 zone->max_mem = mem >> 1; in ttm_mem_init_highmem_zone()
357 zone->emer_mem = (mem >> 1) + (mem >> 2); in ttm_mem_init_highmem_zone()
358 zone->swap_limit = zone->max_mem - (mem >> 3); in ttm_mem_init_highmem_zone()
359 zone->used_mem = 0; in ttm_mem_init_highmem_zone()
360 zone->glob = glob; in ttm_mem_init_highmem_zone()
361 glob->zone_highmem = zone; in ttm_mem_init_highmem_zone()
363 &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, "%s", in ttm_mem_init_highmem_zone()
364 zone->name); in ttm_mem_init_highmem_zone()
366 kobject_put(&zone->kobj); in ttm_mem_init_highmem_zone()
369 glob->zones[glob->num_zones++] = zone; in ttm_mem_init_highmem_zone()
376 struct ttm_mem_zone *zone = kzalloc(sizeof(*zone), GFP_KERNEL); in ttm_mem_init_dma32_zone() local
380 if (unlikely(!zone)) in ttm_mem_init_dma32_zone()
391 kfree(zone); in ttm_mem_init_dma32_zone()
402 zone->name = "dma32"; in ttm_mem_init_dma32_zone()
403 zone->zone_mem = mem; in ttm_mem_init_dma32_zone()
404 zone->max_mem = mem >> 1; in ttm_mem_init_dma32_zone()
405 zone->emer_mem = (mem >> 1) + (mem >> 2); in ttm_mem_init_dma32_zone()
406 zone->swap_limit = zone->max_mem - (mem >> 3); in ttm_mem_init_dma32_zone()
407 zone->used_mem = 0; in ttm_mem_init_dma32_zone()
408 zone->glob = glob; in ttm_mem_init_dma32_zone()
409 glob->zone_dma32 = zone; in ttm_mem_init_dma32_zone()
411 &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name); in ttm_mem_init_dma32_zone()
413 kobject_put(&zone->kobj); in ttm_mem_init_dma32_zone()
416 glob->zones[glob->num_zones++] = zone; in ttm_mem_init_dma32_zone()
426 struct ttm_mem_zone *zone; in ttm_mem_global_init() local
456 zone = glob->zones[i]; in ttm_mem_global_init()
458 zone->name, (unsigned long long)zone->max_mem >> 10); in ttm_mem_global_init()
472 struct ttm_mem_zone *zone; in ttm_mem_global_release() local
482 zone = glob->zones[i]; in ttm_mem_global_release()
483 kobject_del(&zone->kobj); in ttm_mem_global_release()
484 kobject_put(&zone->kobj); in ttm_mem_global_release()
495 struct ttm_mem_zone *zone; in ttm_check_swapping() local
499 zone = glob->zones[i]; in ttm_check_swapping()
500 if (zone->used_mem > zone->swap_limit) { in ttm_check_swapping()
518 struct ttm_mem_zone *zone; in ttm_mem_global_free_zone() local
522 zone = glob->zones[i]; in ttm_mem_global_free_zone()
523 if (single_zone && zone != single_zone) in ttm_mem_global_free_zone()
525 zone->used_mem -= amount; in ttm_mem_global_free_zone()
573 struct ttm_mem_zone *zone; in ttm_mem_global_reserve() local
577 zone = glob->zones[i]; in ttm_mem_global_reserve()
578 if (single_zone && zone != single_zone) in ttm_mem_global_reserve()
582 zone->emer_mem : zone->max_mem; in ttm_mem_global_reserve()
584 if (zone->used_mem > limit) in ttm_mem_global_reserve()
590 zone = glob->zones[i]; in ttm_mem_global_reserve()
591 if (single_zone && zone != single_zone) in ttm_mem_global_reserve()
593 zone->used_mem += amount; in ttm_mem_global_reserve()
643 struct ttm_mem_zone *zone = NULL; in ttm_mem_global_alloc_page() local
652 zone = glob->zone_highmem; in ttm_mem_global_alloc_page()
655 zone = glob->zone_kernel; in ttm_mem_global_alloc_page()
657 return ttm_mem_global_alloc_zone(glob, zone, size, ctx); in ttm_mem_global_alloc_page()
663 struct ttm_mem_zone *zone = NULL; in ttm_mem_global_free_page() local
667 zone = glob->zone_highmem; in ttm_mem_global_free_page()
670 zone = glob->zone_kernel; in ttm_mem_global_free_page()
672 ttm_mem_global_free_zone(glob, zone, size); in ttm_mem_global_free_page()