drm_mm.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. /**************************************************************************
  2. *
  3. * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., 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. /*
  29. * Generic simple memory manager implementation. Intended to be used as a base
  30. * class implementation for more advanced memory managers.
  31. *
  32. * Note that the algorithm used is quite simple and there might be substantial
  33. * performance gains if a smarter free list is implemented. Currently it is just an
  34. * unordered stack of free regions. This could easily be improved if an RB-tree
  35. * is used instead. At least if we expect heavy fragmentation.
  36. *
  37. * Aligned allocations can also see improvement.
  38. *
  39. * Authors:
  40. * Thomas Hellström <thomas-at-tungstengraphics-dot-com>
  41. */
  42. #include <drm/drmP.h>
  43. #include <drm/drm_mm.h>
  44. #include <linux/slab.h>
  45. #include <linux/seq_file.h>
  46. #include <linux/export.h>
  47. #define MM_UNUSED_TARGET 4
  48. static struct drm_mm_node *drm_mm_search_free_generic(const struct drm_mm *mm,
  49. unsigned long size,
  50. unsigned alignment,
  51. unsigned long color,
  52. enum drm_mm_search_flags flags);
  53. static struct drm_mm_node *drm_mm_search_free_in_range_generic(const struct drm_mm *mm,
  54. unsigned long size,
  55. unsigned alignment,
  56. unsigned long color,
  57. unsigned long start,
  58. unsigned long end,
  59. enum drm_mm_search_flags flags);
  60. static void drm_mm_insert_helper(struct drm_mm_node *hole_node,
  61. struct drm_mm_node *node,
  62. unsigned long size, unsigned alignment,
  63. unsigned long color)
  64. {
  65. struct drm_mm *mm = hole_node->mm;
  66. unsigned long hole_start = drm_mm_hole_node_start(hole_node);
  67. unsigned long hole_end = drm_mm_hole_node_end(hole_node);
  68. unsigned long adj_start = hole_start;
  69. unsigned long adj_end = hole_end;
  70. BUG_ON(node->allocated);
  71. if (mm->color_adjust)
  72. mm->color_adjust(hole_node, color, &adj_start, &adj_end);
  73. if (alignment) {
  74. unsigned tmp = adj_start % alignment;
  75. if (tmp)
  76. adj_start += alignment - tmp;
  77. }
  78. if (adj_start == hole_start) {
  79. hole_node->hole_follows = 0;
  80. list_del(&hole_node->hole_stack);
  81. }
  82. node->start = adj_start;
  83. node->size = size;
  84. node->mm = mm;
  85. node->color = color;
  86. node->allocated = 1;
  87. INIT_LIST_HEAD(&node->hole_stack);
  88. list_add(&node->node_list, &hole_node->node_list);
  89. BUG_ON(node->start + node->size > adj_end);
  90. node->hole_follows = 0;
  91. if (__drm_mm_hole_node_start(node) < hole_end) {
  92. list_add(&node->hole_stack, &mm->hole_stack);
  93. node->hole_follows = 1;
  94. }
  95. }
  96. int drm_mm_reserve_node(struct drm_mm *mm, struct drm_mm_node *node)
  97. {
  98. struct drm_mm_node *hole;
  99. unsigned long end = node->start + node->size;
  100. unsigned long hole_start;
  101. unsigned long hole_end;
  102. BUG_ON(node == NULL);
  103. /* Find the relevant hole to add our node to */
  104. drm_mm_for_each_hole(hole, mm, hole_start, hole_end) {
  105. if (hole_start > node->start || hole_end < end)
  106. continue;
  107. node->mm = mm;
  108. node->allocated = 1;
  109. INIT_LIST_HEAD(&node->hole_stack);
  110. list_add(&node->node_list, &hole->node_list);
  111. if (node->start == hole_start) {
  112. hole->hole_follows = 0;
  113. list_del_init(&hole->hole_stack);
  114. }
  115. node->hole_follows = 0;
  116. if (end != hole_end) {
  117. list_add(&node->hole_stack, &mm->hole_stack);
  118. node->hole_follows = 1;
  119. }
  120. return 0;
  121. }
  122. WARN(1, "no hole found for node 0x%lx + 0x%lx\n",
  123. node->start, node->size);
  124. return -ENOSPC;
  125. }
  126. EXPORT_SYMBOL(drm_mm_reserve_node);
  127. /**
  128. * Search for free space and insert a preallocated memory node. Returns
  129. * -ENOSPC if no suitable free area is available. The preallocated memory node
  130. * must be cleared.
  131. */
  132. int drm_mm_insert_node_generic(struct drm_mm *mm, struct drm_mm_node *node,
  133. unsigned long size, unsigned alignment,
  134. unsigned long color,
  135. enum drm_mm_search_flags flags)
  136. {
  137. struct drm_mm_node *hole_node;
  138. hole_node = drm_mm_search_free_generic(mm, size, alignment,
  139. color, flags);
  140. if (!hole_node)
  141. return -ENOSPC;
  142. drm_mm_insert_helper(hole_node, node, size, alignment, color);
  143. return 0;
  144. }
  145. EXPORT_SYMBOL(drm_mm_insert_node_generic);
  146. static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node,
  147. struct drm_mm_node *node,
  148. unsigned long size, unsigned alignment,
  149. unsigned long color,
  150. unsigned long start, unsigned long end)
  151. {
  152. struct drm_mm *mm = hole_node->mm;
  153. unsigned long hole_start = drm_mm_hole_node_start(hole_node);
  154. unsigned long hole_end = drm_mm_hole_node_end(hole_node);
  155. unsigned long adj_start = hole_start;
  156. unsigned long adj_end = hole_end;
  157. BUG_ON(!hole_node->hole_follows || node->allocated);
  158. if (adj_start < start)
  159. adj_start = start;
  160. if (adj_end > end)
  161. adj_end = end;
  162. if (mm->color_adjust)
  163. mm->color_adjust(hole_node, color, &adj_start, &adj_end);
  164. if (alignment) {
  165. unsigned tmp = adj_start % alignment;
  166. if (tmp)
  167. adj_start += alignment - tmp;
  168. }
  169. if (adj_start == hole_start) {
  170. hole_node->hole_follows = 0;
  171. list_del(&hole_node->hole_stack);
  172. }
  173. node->start = adj_start;
  174. node->size = size;
  175. node->mm = mm;
  176. node->color = color;
  177. node->allocated = 1;
  178. INIT_LIST_HEAD(&node->hole_stack);
  179. list_add(&node->node_list, &hole_node->node_list);
  180. BUG_ON(node->start + node->size > adj_end);
  181. BUG_ON(node->start + node->size > end);
  182. node->hole_follows = 0;
  183. if (__drm_mm_hole_node_start(node) < hole_end) {
  184. list_add(&node->hole_stack, &mm->hole_stack);
  185. node->hole_follows = 1;
  186. }
  187. }
  188. /**
  189. * Search for free space and insert a preallocated memory node. Returns
  190. * -ENOSPC if no suitable free area is available. This is for range
  191. * restricted allocations. The preallocated memory node must be cleared.
  192. */
  193. int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, struct drm_mm_node *node,
  194. unsigned long size, unsigned alignment, unsigned long color,
  195. unsigned long start, unsigned long end,
  196. enum drm_mm_search_flags flags)
  197. {
  198. struct drm_mm_node *hole_node;
  199. hole_node = drm_mm_search_free_in_range_generic(mm,
  200. size, alignment, color,
  201. start, end, flags);
  202. if (!hole_node)
  203. return -ENOSPC;
  204. drm_mm_insert_helper_range(hole_node, node,
  205. size, alignment, color,
  206. start, end);
  207. return 0;
  208. }
  209. EXPORT_SYMBOL(drm_mm_insert_node_in_range_generic);
  210. /**
  211. * Remove a memory node from the allocator.
  212. */
  213. void drm_mm_remove_node(struct drm_mm_node *node)
  214. {
  215. struct drm_mm *mm = node->mm;
  216. struct drm_mm_node *prev_node;
  217. BUG_ON(node->scanned_block || node->scanned_prev_free
  218. || node->scanned_next_free);
  219. prev_node =
  220. list_entry(node->node_list.prev, struct drm_mm_node, node_list);
  221. if (node->hole_follows) {
  222. BUG_ON(__drm_mm_hole_node_start(node) ==
  223. __drm_mm_hole_node_end(node));
  224. list_del(&node->hole_stack);
  225. } else
  226. BUG_ON(__drm_mm_hole_node_start(node) !=
  227. __drm_mm_hole_node_end(node));
  228. if (!prev_node->hole_follows) {
  229. prev_node->hole_follows = 1;
  230. list_add(&prev_node->hole_stack, &mm->hole_stack);
  231. } else
  232. list_move(&prev_node->hole_stack, &mm->hole_stack);
  233. list_del(&node->node_list);
  234. node->allocated = 0;
  235. }
  236. EXPORT_SYMBOL(drm_mm_remove_node);
  237. static int check_free_hole(unsigned long start, unsigned long end,
  238. unsigned long size, unsigned alignment)
  239. {
  240. if (end - start < size)
  241. return 0;
  242. if (alignment) {
  243. unsigned tmp = start % alignment;
  244. if (tmp)
  245. start += alignment - tmp;
  246. }
  247. return end >= start + size;
  248. }
  249. static struct drm_mm_node *drm_mm_search_free_generic(const struct drm_mm *mm,
  250. unsigned long size,
  251. unsigned alignment,
  252. unsigned long color,
  253. enum drm_mm_search_flags flags)
  254. {
  255. struct drm_mm_node *entry;
  256. struct drm_mm_node *best;
  257. unsigned long adj_start;
  258. unsigned long adj_end;
  259. unsigned long best_size;
  260. BUG_ON(mm->scanned_blocks);
  261. best = NULL;
  262. best_size = ~0UL;
  263. drm_mm_for_each_hole(entry, mm, adj_start, adj_end) {
  264. if (mm->color_adjust) {
  265. mm->color_adjust(entry, color, &adj_start, &adj_end);
  266. if (adj_end <= adj_start)
  267. continue;
  268. }
  269. if (!check_free_hole(adj_start, adj_end, size, alignment))
  270. continue;
  271. if (!(flags & DRM_MM_SEARCH_BEST))
  272. return entry;
  273. if (entry->size < best_size) {
  274. best = entry;
  275. best_size = entry->size;
  276. }
  277. }
  278. return best;
  279. }
  280. static struct drm_mm_node *drm_mm_search_free_in_range_generic(const struct drm_mm *mm,
  281. unsigned long size,
  282. unsigned alignment,
  283. unsigned long color,
  284. unsigned long start,
  285. unsigned long end,
  286. enum drm_mm_search_flags flags)
  287. {
  288. struct drm_mm_node *entry;
  289. struct drm_mm_node *best;
  290. unsigned long adj_start;
  291. unsigned long adj_end;
  292. unsigned long best_size;
  293. BUG_ON(mm->scanned_blocks);
  294. best = NULL;
  295. best_size = ~0UL;
  296. drm_mm_for_each_hole(entry, mm, adj_start, adj_end) {
  297. if (adj_start < start)
  298. adj_start = start;
  299. if (adj_end > end)
  300. adj_end = end;
  301. if (mm->color_adjust) {
  302. mm->color_adjust(entry, color, &adj_start, &adj_end);
  303. if (adj_end <= adj_start)
  304. continue;
  305. }
  306. if (!check_free_hole(adj_start, adj_end, size, alignment))
  307. continue;
  308. if (!(flags & DRM_MM_SEARCH_BEST))
  309. return entry;
  310. if (entry->size < best_size) {
  311. best = entry;
  312. best_size = entry->size;
  313. }
  314. }
  315. return best;
  316. }
  317. /**
  318. * Moves an allocation. To be used with embedded struct drm_mm_node.
  319. */
  320. void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new)
  321. {
  322. list_replace(&old->node_list, &new->node_list);
  323. list_replace(&old->hole_stack, &new->hole_stack);
  324. new->hole_follows = old->hole_follows;
  325. new->mm = old->mm;
  326. new->start = old->start;
  327. new->size = old->size;
  328. new->color = old->color;
  329. old->allocated = 0;
  330. new->allocated = 1;
  331. }
  332. EXPORT_SYMBOL(drm_mm_replace_node);
  333. /**
  334. * Initializa lru scanning.
  335. *
  336. * This simply sets up the scanning routines with the parameters for the desired
  337. * hole.
  338. *
  339. * Warning: As long as the scan list is non-empty, no other operations than
  340. * adding/removing nodes to/from the scan list are allowed.
  341. */
  342. void drm_mm_init_scan(struct drm_mm *mm,
  343. unsigned long size,
  344. unsigned alignment,
  345. unsigned long color)
  346. {
  347. mm->scan_color = color;
  348. mm->scan_alignment = alignment;
  349. mm->scan_size = size;
  350. mm->scanned_blocks = 0;
  351. mm->scan_hit_start = 0;
  352. mm->scan_hit_end = 0;
  353. mm->scan_check_range = 0;
  354. mm->prev_scanned_node = NULL;
  355. }
  356. EXPORT_SYMBOL(drm_mm_init_scan);
  357. /**
  358. * Initializa lru scanning.
  359. *
  360. * This simply sets up the scanning routines with the parameters for the desired
  361. * hole. This version is for range-restricted scans.
  362. *
  363. * Warning: As long as the scan list is non-empty, no other operations than
  364. * adding/removing nodes to/from the scan list are allowed.
  365. */
  366. void drm_mm_init_scan_with_range(struct drm_mm *mm,
  367. unsigned long size,
  368. unsigned alignment,
  369. unsigned long color,
  370. unsigned long start,
  371. unsigned long end)
  372. {
  373. mm->scan_color = color;
  374. mm->scan_alignment = alignment;
  375. mm->scan_size = size;
  376. mm->scanned_blocks = 0;
  377. mm->scan_hit_start = 0;
  378. mm->scan_hit_end = 0;
  379. mm->scan_start = start;
  380. mm->scan_end = end;
  381. mm->scan_check_range = 1;
  382. mm->prev_scanned_node = NULL;
  383. }
  384. EXPORT_SYMBOL(drm_mm_init_scan_with_range);
  385. /**
  386. * Add a node to the scan list that might be freed to make space for the desired
  387. * hole.
  388. *
  389. * Returns non-zero, if a hole has been found, zero otherwise.
  390. */
  391. int drm_mm_scan_add_block(struct drm_mm_node *node)
  392. {
  393. struct drm_mm *mm = node->mm;
  394. struct drm_mm_node *prev_node;
  395. unsigned long hole_start, hole_end;
  396. unsigned long adj_start, adj_end;
  397. mm->scanned_blocks++;
  398. BUG_ON(node->scanned_block);
  399. node->scanned_block = 1;
  400. prev_node = list_entry(node->node_list.prev, struct drm_mm_node,
  401. node_list);
  402. node->scanned_preceeds_hole = prev_node->hole_follows;
  403. prev_node->hole_follows = 1;
  404. list_del(&node->node_list);
  405. node->node_list.prev = &prev_node->node_list;
  406. node->node_list.next = &mm->prev_scanned_node->node_list;
  407. mm->prev_scanned_node = node;
  408. adj_start = hole_start = drm_mm_hole_node_start(prev_node);
  409. adj_end = hole_end = drm_mm_hole_node_end(prev_node);
  410. if (mm->scan_check_range) {
  411. if (adj_start < mm->scan_start)
  412. adj_start = mm->scan_start;
  413. if (adj_end > mm->scan_end)
  414. adj_end = mm->scan_end;
  415. }
  416. if (mm->color_adjust)
  417. mm->color_adjust(prev_node, mm->scan_color,
  418. &adj_start, &adj_end);
  419. if (check_free_hole(adj_start, adj_end,
  420. mm->scan_size, mm->scan_alignment)) {
  421. mm->scan_hit_start = hole_start;
  422. mm->scan_hit_end = hole_end;
  423. return 1;
  424. }
  425. return 0;
  426. }
  427. EXPORT_SYMBOL(drm_mm_scan_add_block);
  428. /**
  429. * Remove a node from the scan list.
  430. *
  431. * Nodes _must_ be removed in the exact same order from the scan list as they
  432. * have been added, otherwise the internal state of the memory manager will be
  433. * corrupted.
  434. *
  435. * When the scan list is empty, the selected memory nodes can be freed. An
  436. * immediately following drm_mm_search_free with !DRM_MM_SEARCH_BEST will then
  437. * return the just freed block (because its at the top of the free_stack list).
  438. *
  439. * Returns one if this block should be evicted, zero otherwise. Will always
  440. * return zero when no hole has been found.
  441. */
  442. int drm_mm_scan_remove_block(struct drm_mm_node *node)
  443. {
  444. struct drm_mm *mm = node->mm;
  445. struct drm_mm_node *prev_node;
  446. mm->scanned_blocks--;
  447. BUG_ON(!node->scanned_block);
  448. node->scanned_block = 0;
  449. prev_node = list_entry(node->node_list.prev, struct drm_mm_node,
  450. node_list);
  451. prev_node->hole_follows = node->scanned_preceeds_hole;
  452. list_add(&node->node_list, &prev_node->node_list);
  453. return (drm_mm_hole_node_end(node) > mm->scan_hit_start &&
  454. node->start < mm->scan_hit_end);
  455. }
  456. EXPORT_SYMBOL(drm_mm_scan_remove_block);
  457. int drm_mm_clean(struct drm_mm * mm)
  458. {
  459. struct list_head *head = &mm->head_node.node_list;
  460. return (head->next->next == head);
  461. }
  462. EXPORT_SYMBOL(drm_mm_clean);
  463. void drm_mm_init(struct drm_mm * mm, unsigned long start, unsigned long size)
  464. {
  465. INIT_LIST_HEAD(&mm->hole_stack);
  466. mm->scanned_blocks = 0;
  467. /* Clever trick to avoid a special case in the free hole tracking. */
  468. INIT_LIST_HEAD(&mm->head_node.node_list);
  469. INIT_LIST_HEAD(&mm->head_node.hole_stack);
  470. mm->head_node.hole_follows = 1;
  471. mm->head_node.scanned_block = 0;
  472. mm->head_node.scanned_prev_free = 0;
  473. mm->head_node.scanned_next_free = 0;
  474. mm->head_node.mm = mm;
  475. mm->head_node.start = start + size;
  476. mm->head_node.size = start - mm->head_node.start;
  477. list_add_tail(&mm->head_node.hole_stack, &mm->hole_stack);
  478. mm->color_adjust = NULL;
  479. }
  480. EXPORT_SYMBOL(drm_mm_init);
  481. void drm_mm_takedown(struct drm_mm * mm)
  482. {
  483. WARN(!list_empty(&mm->head_node.node_list),
  484. "Memory manager not clean during takedown.\n");
  485. }
  486. EXPORT_SYMBOL(drm_mm_takedown);
  487. static unsigned long drm_mm_debug_hole(struct drm_mm_node *entry,
  488. const char *prefix)
  489. {
  490. unsigned long hole_start, hole_end, hole_size;
  491. if (entry->hole_follows) {
  492. hole_start = drm_mm_hole_node_start(entry);
  493. hole_end = drm_mm_hole_node_end(entry);
  494. hole_size = hole_end - hole_start;
  495. printk(KERN_DEBUG "%s 0x%08lx-0x%08lx: %8lu: free\n",
  496. prefix, hole_start, hole_end,
  497. hole_size);
  498. return hole_size;
  499. }
  500. return 0;
  501. }
  502. void drm_mm_debug_table(struct drm_mm *mm, const char *prefix)
  503. {
  504. struct drm_mm_node *entry;
  505. unsigned long total_used = 0, total_free = 0, total = 0;
  506. total_free += drm_mm_debug_hole(&mm->head_node, prefix);
  507. drm_mm_for_each_node(entry, mm) {
  508. printk(KERN_DEBUG "%s 0x%08lx-0x%08lx: %8lu: used\n",
  509. prefix, entry->start, entry->start + entry->size,
  510. entry->size);
  511. total_used += entry->size;
  512. total_free += drm_mm_debug_hole(entry, prefix);
  513. }
  514. total = total_free + total_used;
  515. printk(KERN_DEBUG "%s total: %lu, used %lu free %lu\n", prefix, total,
  516. total_used, total_free);
  517. }
  518. EXPORT_SYMBOL(drm_mm_debug_table);
  519. #if defined(CONFIG_DEBUG_FS)
  520. static unsigned long drm_mm_dump_hole(struct seq_file *m, struct drm_mm_node *entry)
  521. {
  522. unsigned long hole_start, hole_end, hole_size;
  523. if (entry->hole_follows) {
  524. hole_start = drm_mm_hole_node_start(entry);
  525. hole_end = drm_mm_hole_node_end(entry);
  526. hole_size = hole_end - hole_start;
  527. seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: free\n",
  528. hole_start, hole_end, hole_size);
  529. return hole_size;
  530. }
  531. return 0;
  532. }
  533. int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm)
  534. {
  535. struct drm_mm_node *entry;
  536. unsigned long total_used = 0, total_free = 0, total = 0;
  537. total_free += drm_mm_dump_hole(m, &mm->head_node);
  538. drm_mm_for_each_node(entry, mm) {
  539. seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: used\n",
  540. entry->start, entry->start + entry->size,
  541. entry->size);
  542. total_used += entry->size;
  543. total_free += drm_mm_dump_hole(m, entry);
  544. }
  545. total = total_free + total_used;
  546. seq_printf(m, "total: %lu, used %lu free %lu\n", total, total_used, total_free);
  547. return 0;
  548. }
  549. EXPORT_SYMBOL(drm_mm_dump_table);
  550. #endif