Lines Matching full:zone
81 struct ttm_mem_zone *zone = in ttm_mem_zone_kobj_release() local
84 pr_info("Zone %7s: Used memory at exit: %llu KiB\n", in ttm_mem_zone_kobj_release()
85 zone->name, (unsigned long long)zone->used_mem >> 10); in ttm_mem_zone_kobj_release()
86 kfree(zone); in ttm_mem_zone_kobj_release()
93 struct ttm_mem_zone *zone = in ttm_mem_zone_show() local
97 spin_lock(&zone->glob->lock); in ttm_mem_zone_show()
99 val = zone->zone_mem; in ttm_mem_zone_show()
101 val = zone->emer_mem; in ttm_mem_zone_show()
103 val = zone->max_mem; in ttm_mem_zone_show()
105 val = zone->swap_limit; in ttm_mem_zone_show()
107 val = zone->used_mem; in ttm_mem_zone_show()
108 spin_unlock(&zone->glob->lock); in ttm_mem_zone_show()
121 struct ttm_mem_zone *zone = in ttm_mem_zone_store() local
134 spin_lock(&zone->glob->lock); in ttm_mem_zone_store()
135 if (val64 > zone->zone_mem) in ttm_mem_zone_store()
136 val64 = zone->zone_mem; in ttm_mem_zone_store()
138 zone->emer_mem = val64; in ttm_mem_zone_store()
139 if (zone->max_mem > val64) in ttm_mem_zone_store()
140 zone->max_mem = val64; in ttm_mem_zone_store()
142 zone->max_mem = val64; in ttm_mem_zone_store()
143 if (zone->emer_mem < val64) in ttm_mem_zone_store()
144 zone->emer_mem = val64; in ttm_mem_zone_store()
146 zone->swap_limit = val64; in ttm_mem_zone_store()
147 spin_unlock(&zone->glob->lock); in ttm_mem_zone_store()
149 ttm_check_swapping(zone->glob); in ttm_mem_zone_store()
241 struct ttm_mem_zone *zone; in ttm_zones_above_swap_target() local
245 zone = glob->zones[i]; in ttm_zones_above_swap_target()
248 target = zone->swap_limit; in ttm_zones_above_swap_target()
250 target = zone->emer_mem; in ttm_zones_above_swap_target()
252 target = zone->max_mem; in ttm_zones_above_swap_target()
256 if (zone->used_mem > target) in ttm_zones_above_swap_target()
302 struct ttm_mem_zone *zone = kzalloc(sizeof(*zone), GFP_KERNEL); in ttm_mem_init_kernel_zone() local
306 if (unlikely(!zone)) in ttm_mem_init_kernel_zone()
312 zone->name = "kernel"; in ttm_mem_init_kernel_zone()
313 zone->zone_mem = mem; in ttm_mem_init_kernel_zone()
314 zone->max_mem = mem >> 1; in ttm_mem_init_kernel_zone()
315 zone->emer_mem = (mem >> 1) + (mem >> 2); in ttm_mem_init_kernel_zone()
316 zone->swap_limit = zone->max_mem - (mem >> 3); in ttm_mem_init_kernel_zone()
317 zone->used_mem = 0; in ttm_mem_init_kernel_zone()
318 zone->glob = glob; in ttm_mem_init_kernel_zone()
319 glob->zone_kernel = zone; in ttm_mem_init_kernel_zone()
321 &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name); in ttm_mem_init_kernel_zone()
323 kobject_put(&zone->kobj); in ttm_mem_init_kernel_zone()
326 glob->zones[glob->num_zones++] = zone; in ttm_mem_init_kernel_zone()
334 struct ttm_mem_zone *zone; in ttm_mem_init_highmem_zone() local
341 zone = kzalloc(sizeof(*zone), GFP_KERNEL); in ttm_mem_init_highmem_zone()
342 if (unlikely(!zone)) in ttm_mem_init_highmem_zone()
348 zone->name = "highmem"; in ttm_mem_init_highmem_zone()
349 zone->zone_mem = mem; in ttm_mem_init_highmem_zone()
350 zone->max_mem = mem >> 1; in ttm_mem_init_highmem_zone()
351 zone->emer_mem = (mem >> 1) + (mem >> 2); in ttm_mem_init_highmem_zone()
352 zone->swap_limit = zone->max_mem - (mem >> 3); in ttm_mem_init_highmem_zone()
353 zone->used_mem = 0; in ttm_mem_init_highmem_zone()
354 zone->glob = glob; in ttm_mem_init_highmem_zone()
355 glob->zone_highmem = zone; in ttm_mem_init_highmem_zone()
357 &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, "%s", in ttm_mem_init_highmem_zone()
358 zone->name); in ttm_mem_init_highmem_zone()
360 kobject_put(&zone->kobj); in ttm_mem_init_highmem_zone()
363 glob->zones[glob->num_zones++] = zone; in ttm_mem_init_highmem_zone()
370 struct ttm_mem_zone *zone = kzalloc(sizeof(*zone), GFP_KERNEL); in ttm_mem_init_dma32_zone() local
374 if (unlikely(!zone)) in ttm_mem_init_dma32_zone()
381 * No special dma32 zone needed. in ttm_mem_init_dma32_zone()
385 kfree(zone); in ttm_mem_init_dma32_zone()
392 * zone really is. in ttm_mem_init_dma32_zone()
396 zone->name = "dma32"; in ttm_mem_init_dma32_zone()
397 zone->zone_mem = mem; in ttm_mem_init_dma32_zone()
398 zone->max_mem = mem >> 1; in ttm_mem_init_dma32_zone()
399 zone->emer_mem = (mem >> 1) + (mem >> 2); in ttm_mem_init_dma32_zone()
400 zone->swap_limit = zone->max_mem - (mem >> 3); in ttm_mem_init_dma32_zone()
401 zone->used_mem = 0; in ttm_mem_init_dma32_zone()
402 zone->glob = glob; in ttm_mem_init_dma32_zone()
403 glob->zone_dma32 = zone; in ttm_mem_init_dma32_zone()
405 &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name); in ttm_mem_init_dma32_zone()
407 kobject_put(&zone->kobj); in ttm_mem_init_dma32_zone()
410 glob->zones[glob->num_zones++] = zone; in ttm_mem_init_dma32_zone()
420 struct ttm_mem_zone *zone; in ttm_mem_global_init() local
450 zone = glob->zones[i]; in ttm_mem_global_init()
451 pr_info("Zone %7s: Available graphics memory: %llu KiB\n", in ttm_mem_global_init()
452 zone->name, (unsigned long long)zone->max_mem >> 10); in ttm_mem_global_init()
464 struct ttm_mem_zone *zone; in ttm_mem_global_release() local
475 zone = glob->zones[i]; in ttm_mem_global_release()
476 kobject_del(&zone->kobj); in ttm_mem_global_release()
477 kobject_put(&zone->kobj); in ttm_mem_global_release()
488 struct ttm_mem_zone *zone; in ttm_check_swapping() local
492 zone = glob->zones[i]; in ttm_check_swapping()
493 if (zone->used_mem > zone->swap_limit) { in ttm_check_swapping()
511 struct ttm_mem_zone *zone; in ttm_mem_global_free_zone() local
515 zone = glob->zones[i]; in ttm_mem_global_free_zone()
516 if (single_zone && zone != single_zone) in ttm_mem_global_free_zone()
518 zone->used_mem -= amount; in ttm_mem_global_free_zone()
565 struct ttm_mem_zone *zone; in ttm_mem_global_reserve() local
569 zone = glob->zones[i]; in ttm_mem_global_reserve()
570 if (single_zone && zone != single_zone) in ttm_mem_global_reserve()
574 zone->emer_mem : zone->max_mem; in ttm_mem_global_reserve()
576 if (zone->used_mem > limit) in ttm_mem_global_reserve()
582 zone = glob->zones[i]; in ttm_mem_global_reserve()
583 if (single_zone && zone != single_zone) in ttm_mem_global_reserve()
585 zone->used_mem += amount; in ttm_mem_global_reserve()
624 * the kernel zone. in ttm_mem_global_alloc()
635 struct ttm_mem_zone *zone = NULL; in ttm_mem_global_alloc_page() local
638 * Page allocations may be registed in a single zone in ttm_mem_global_alloc_page()
644 zone = glob->zone_highmem; in ttm_mem_global_alloc_page()
647 zone = glob->zone_kernel; in ttm_mem_global_alloc_page()
649 return ttm_mem_global_alloc_zone(glob, zone, size, ctx); in ttm_mem_global_alloc_page()
655 struct ttm_mem_zone *zone = NULL; in ttm_mem_global_free_page() local
659 zone = glob->zone_highmem; in ttm_mem_global_free_page()
662 zone = glob->zone_kernel; in ttm_mem_global_free_page()
664 ttm_mem_global_free_zone(glob, zone, size); in ttm_mem_global_free_page()