Lines Matching refs:zone
84 struct ttm_mem_zone *zone = in ttm_mem_zone_kobj_release() local
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()
388 kfree(zone); 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()
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
474 zone = glob->zones[i]; in ttm_mem_global_release()
475 kobject_del(&zone->kobj); in ttm_mem_global_release()
476 kobject_put(&zone->kobj); in ttm_mem_global_release()
487 struct ttm_mem_zone *zone; in ttm_check_swapping() local
491 zone = glob->zones[i]; in ttm_check_swapping()
492 if (zone->used_mem > zone->swap_limit) { in ttm_check_swapping()
510 struct ttm_mem_zone *zone; in ttm_mem_global_free_zone() local
514 zone = glob->zones[i]; in ttm_mem_global_free_zone()
515 if (single_zone && zone != single_zone) in ttm_mem_global_free_zone()
517 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()
635 struct ttm_mem_zone *zone = NULL; in ttm_mem_global_alloc_page() local
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()