Lines Matching full:zone

84 	struct ttm_mem_zone *zone =  in ttm_mem_zone_kobj_release()  local
87 pr_info("Zone %7s: Used memory at exit: %llu KiB\n", in ttm_mem_zone_kobj_release()
88 zone->name, (unsigned long long)zone->used_mem >> 10); in ttm_mem_zone_kobj_release()
89 kfree(zone); in ttm_mem_zone_kobj_release()
96 struct ttm_mem_zone *zone = in ttm_mem_zone_show() local
100 spin_lock(&zone->glob->lock); in ttm_mem_zone_show()
102 val = zone->zone_mem; in ttm_mem_zone_show()
104 val = zone->emer_mem; in ttm_mem_zone_show()
106 val = zone->max_mem; in ttm_mem_zone_show()
108 val = zone->swap_limit; in ttm_mem_zone_show()
110 val = zone->used_mem; in ttm_mem_zone_show()
111 spin_unlock(&zone->glob->lock); in ttm_mem_zone_show()
124 struct ttm_mem_zone *zone = in ttm_mem_zone_store() local
137 spin_lock(&zone->glob->lock); in ttm_mem_zone_store()
138 if (val64 > zone->zone_mem) in ttm_mem_zone_store()
139 val64 = zone->zone_mem; in ttm_mem_zone_store()
141 zone->emer_mem = val64; in ttm_mem_zone_store()
142 if (zone->max_mem > val64) in ttm_mem_zone_store()
143 zone->max_mem = val64; in ttm_mem_zone_store()
145 zone->max_mem = val64; in ttm_mem_zone_store()
146 if (zone->emer_mem < val64) in ttm_mem_zone_store()
147 zone->emer_mem = val64; in ttm_mem_zone_store()
149 zone->swap_limit = val64; in ttm_mem_zone_store()
150 spin_unlock(&zone->glob->lock); in ttm_mem_zone_store()
152 ttm_check_swapping(zone->glob); in ttm_mem_zone_store()
244 struct ttm_mem_zone *zone; in ttm_zones_above_swap_target() local
248 zone = glob->zones[i]; in ttm_zones_above_swap_target()
251 target = zone->swap_limit; in ttm_zones_above_swap_target()
253 target = zone->emer_mem; in ttm_zones_above_swap_target()
255 target = zone->max_mem; in ttm_zones_above_swap_target()
259 if (zone->used_mem > target) in ttm_zones_above_swap_target()
305 struct ttm_mem_zone *zone = kzalloc(sizeof(*zone), GFP_KERNEL); in ttm_mem_init_kernel_zone() local
309 if (unlikely(!zone)) in ttm_mem_init_kernel_zone()
315 zone->name = "kernel"; in ttm_mem_init_kernel_zone()
316 zone->zone_mem = mem; in ttm_mem_init_kernel_zone()
317 zone->max_mem = mem >> 1; in ttm_mem_init_kernel_zone()
318 zone->emer_mem = (mem >> 1) + (mem >> 2); in ttm_mem_init_kernel_zone()
319 zone->swap_limit = zone->max_mem - (mem >> 3); in ttm_mem_init_kernel_zone()
320 zone->used_mem = 0; in ttm_mem_init_kernel_zone()
321 zone->glob = glob; in ttm_mem_init_kernel_zone()
322 glob->zone_kernel = zone; in ttm_mem_init_kernel_zone()
324 &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name); in ttm_mem_init_kernel_zone()
326 kobject_put(&zone->kobj); in ttm_mem_init_kernel_zone()
329 glob->zones[glob->num_zones++] = zone; in ttm_mem_init_kernel_zone()
337 struct ttm_mem_zone *zone; in ttm_mem_init_highmem_zone() local
344 zone = kzalloc(sizeof(*zone), GFP_KERNEL); in ttm_mem_init_highmem_zone()
345 if (unlikely(!zone)) in ttm_mem_init_highmem_zone()
351 zone->name = "highmem"; in ttm_mem_init_highmem_zone()
352 zone->zone_mem = mem; in ttm_mem_init_highmem_zone()
353 zone->max_mem = mem >> 1; in ttm_mem_init_highmem_zone()
354 zone->emer_mem = (mem >> 1) + (mem >> 2); in ttm_mem_init_highmem_zone()
355 zone->swap_limit = zone->max_mem - (mem >> 3); in ttm_mem_init_highmem_zone()
356 zone->used_mem = 0; in ttm_mem_init_highmem_zone()
357 zone->glob = glob; in ttm_mem_init_highmem_zone()
358 glob->zone_highmem = zone; in ttm_mem_init_highmem_zone()
360 &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, "%s", in ttm_mem_init_highmem_zone()
361 zone->name); in ttm_mem_init_highmem_zone()
363 kobject_put(&zone->kobj); in ttm_mem_init_highmem_zone()
366 glob->zones[glob->num_zones++] = zone; in ttm_mem_init_highmem_zone()
373 struct ttm_mem_zone *zone = kzalloc(sizeof(*zone), GFP_KERNEL); in ttm_mem_init_dma32_zone() local
377 if (unlikely(!zone)) in ttm_mem_init_dma32_zone()
384 * No special dma32 zone needed. in ttm_mem_init_dma32_zone()
388 kfree(zone); in ttm_mem_init_dma32_zone()
395 * zone really is. in ttm_mem_init_dma32_zone()
399 zone->name = "dma32"; in ttm_mem_init_dma32_zone()
400 zone->zone_mem = mem; in ttm_mem_init_dma32_zone()
401 zone->max_mem = mem >> 1; in ttm_mem_init_dma32_zone()
402 zone->emer_mem = (mem >> 1) + (mem >> 2); in ttm_mem_init_dma32_zone()
403 zone->swap_limit = zone->max_mem - (mem >> 3); in ttm_mem_init_dma32_zone()
404 zone->used_mem = 0; in ttm_mem_init_dma32_zone()
405 zone->glob = glob; in ttm_mem_init_dma32_zone()
406 glob->zone_dma32 = zone; in ttm_mem_init_dma32_zone()
408 &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name); in ttm_mem_init_dma32_zone()
410 kobject_put(&zone->kobj); in ttm_mem_init_dma32_zone()
413 glob->zones[glob->num_zones++] = zone; in ttm_mem_init_dma32_zone()
423 struct ttm_mem_zone *zone; in ttm_mem_global_init() local
456 zone = glob->zones[i]; in ttm_mem_global_init()
457 pr_info("Zone %7s: Available graphics memory: %llu KiB\n", in ttm_mem_global_init()
458 zone->name, (unsigned long long)zone->max_mem >> 10); in ttm_mem_global_init()
468 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()
566 struct ttm_mem_zone *zone; in ttm_mem_global_reserve() local
570 zone = glob->zones[i]; in ttm_mem_global_reserve()
571 if (single_zone && zone != single_zone) in ttm_mem_global_reserve()
575 zone->emer_mem : zone->max_mem; in ttm_mem_global_reserve()
577 if (zone->used_mem > limit) in ttm_mem_global_reserve()
583 zone = glob->zones[i]; in ttm_mem_global_reserve()
584 if (single_zone && zone != single_zone) in ttm_mem_global_reserve()
586 zone->used_mem += amount; in ttm_mem_global_reserve()
625 * the kernel zone. in ttm_mem_global_alloc()
636 struct ttm_mem_zone *zone = NULL; in ttm_mem_global_alloc_page() local
639 * Page allocations may be registed in a single zone in ttm_mem_global_alloc_page()
645 zone = glob->zone_highmem; in ttm_mem_global_alloc_page()
648 zone = glob->zone_kernel; in ttm_mem_global_alloc_page()
650 return ttm_mem_global_alloc_zone(glob, zone, size, ctx); in ttm_mem_global_alloc_page()
656 struct ttm_mem_zone *zone = NULL; in ttm_mem_global_free_page() local
660 zone = glob->zone_highmem; in ttm_mem_global_free_page()
663 zone = glob->zone_kernel; in ttm_mem_global_free_page()
665 ttm_mem_global_free_zone(glob, zone, size); in ttm_mem_global_free_page()