~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/drm/ttm/ttm_memory.h

Version: ~ [ linux-4.19-rc7 ] ~ [ linux-4.18.12 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.74 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.131 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.159 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.123 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.59 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.31.14 ] ~ [ linux-2.6.30.10 ] ~ [ linux-2.6.29.6 ] ~ [ linux-2.6.28.10 ] ~ [ linux-2.6.27.62 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**************************************************************************
  2  *
  3  * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
  4  * All Rights Reserved.
  5  *
  6  * Permission is hereby granted, free of charge, to any person obtaining a
  7  * copy of this software and associated documentation files (the
  8  * "Software"), to deal in the Software without restriction, including
  9  * without limitation the rights to use, copy, modify, merge, publish,
 10  * distribute, sub license, and/or sell copies of the Software, and to
 11  * permit persons to whom the Software is furnished to do so, subject to
 12  * the following conditions:
 13  *
 14  * The above copyright notice and this permission notice (including the
 15  * next paragraph) shall be included in all copies or substantial portions
 16  * of the Software.
 17  *
 18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 20  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
 21  * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
 22  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 23  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
 24  * USE OR OTHER DEALINGS IN THE SOFTWARE.
 25  *
 26  **************************************************************************/
 27 
 28 #ifndef TTM_MEMORY_H
 29 #define TTM_MEMORY_H
 30 
 31 #include <linux/workqueue.h>
 32 #include <linux/spinlock.h>
 33 #include <linux/bug.h>
 34 #include <linux/wait.h>
 35 #include <linux/errno.h>
 36 #include <linux/kobject.h>
 37 #include <linux/mm.h>
 38 #include "ttm_bo_api.h"
 39 
 40 /**
 41  * struct ttm_mem_global - Global memory accounting structure.
 42  *
 43  * @shrink: A single callback to shrink TTM memory usage. Extend this
 44  * to a linked list to be able to handle multiple callbacks when needed.
 45  * @swap_queue: A workqueue to handle shrinking in low memory situations. We
 46  * need a separate workqueue since it will spend a lot of time waiting
 47  * for the GPU, and this will otherwise block other workqueue tasks(?)
 48  * At this point we use only a single-threaded workqueue.
 49  * @work: The workqueue callback for the shrink queue.
 50  * @lock: Lock to protect the @shrink - and the memory accounting members,
 51  * that is, essentially the whole structure with some exceptions.
 52  * @lower_mem_limit: include lower limit of swap space and lower limit of
 53  * system memory.
 54  * @zones: Array of pointers to accounting zones.
 55  * @num_zones: Number of populated entries in the @zones array.
 56  * @zone_kernel: Pointer to the kernel zone.
 57  * @zone_highmem: Pointer to the highmem zone if there is one.
 58  * @zone_dma32: Pointer to the dma32 zone if there is one.
 59  *
 60  * Note that this structure is not per device. It should be global for all
 61  * graphics devices.
 62  */
 63 
 64 #define TTM_MEM_MAX_ZONES 2
 65 struct ttm_mem_zone;
 66 struct ttm_mem_global {
 67         struct kobject kobj;
 68         struct ttm_bo_global *bo_glob;
 69         struct workqueue_struct *swap_queue;
 70         struct work_struct work;
 71         spinlock_t lock;
 72         uint64_t lower_mem_limit;
 73         struct ttm_mem_zone *zones[TTM_MEM_MAX_ZONES];
 74         unsigned int num_zones;
 75         struct ttm_mem_zone *zone_kernel;
 76 #ifdef CONFIG_HIGHMEM
 77         struct ttm_mem_zone *zone_highmem;
 78 #else
 79         struct ttm_mem_zone *zone_dma32;
 80 #endif
 81 };
 82 
 83 extern int ttm_mem_global_init(struct ttm_mem_global *glob);
 84 extern void ttm_mem_global_release(struct ttm_mem_global *glob);
 85 extern int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory,
 86                                 struct ttm_operation_ctx *ctx);
 87 extern void ttm_mem_global_free(struct ttm_mem_global *glob,
 88                                 uint64_t amount);
 89 extern int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,
 90                                      struct page *page, uint64_t size,
 91                                      struct ttm_operation_ctx *ctx);
 92 extern void ttm_mem_global_free_page(struct ttm_mem_global *glob,
 93                                      struct page *page, uint64_t size);
 94 extern size_t ttm_round_pot(size_t size);
 95 extern uint64_t ttm_get_kernel_zone_memory_size(struct ttm_mem_global *glob);
 96 extern bool ttm_check_under_lowerlimit(struct ttm_mem_global *glob,
 97                         uint64_t num_pages, struct ttm_operation_ctx *ctx);
 98 #endif
 99 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp