slice.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. /*
  2. * address space "slices" (meta-segments) support
  3. *
  4. * Copyright (C) 2007 Benjamin Herrenschmidt, IBM Corporation.
  5. *
  6. * Based on hugetlb implementation
  7. *
  8. * Copyright (C) 2003 David Gibson, IBM Corporation.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. */
  24. #undef DEBUG
  25. #include <linux/kernel.h>
  26. #include <linux/mm.h>
  27. #include <linux/pagemap.h>
  28. #include <linux/err.h>
  29. #include <linux/spinlock.h>
  30. #include <linux/module.h>
  31. #include <asm/mman.h>
  32. #include <asm/mmu.h>
  33. #include <asm/spu.h>
  34. static spinlock_t slice_convert_lock = SPIN_LOCK_UNLOCKED;
  35. #ifdef DEBUG
  36. int _slice_debug = 1;
  37. static void slice_print_mask(const char *label, struct slice_mask mask)
  38. {
  39. char *p, buf[16 + 3 + 16 + 1];
  40. int i;
  41. if (!_slice_debug)
  42. return;
  43. p = buf;
  44. for (i = 0; i < SLICE_NUM_LOW; i++)
  45. *(p++) = (mask.low_slices & (1 << i)) ? '1' : '0';
  46. *(p++) = ' ';
  47. *(p++) = '-';
  48. *(p++) = ' ';
  49. for (i = 0; i < SLICE_NUM_HIGH; i++)
  50. *(p++) = (mask.high_slices & (1 << i)) ? '1' : '0';
  51. *(p++) = 0;
  52. printk(KERN_DEBUG "%s:%s\n", label, buf);
  53. }
  54. #define slice_dbg(fmt...) do { if (_slice_debug) pr_debug(fmt); } while(0)
  55. #else
  56. static void slice_print_mask(const char *label, struct slice_mask mask) {}
  57. #define slice_dbg(fmt...)
  58. #endif
  59. static struct slice_mask slice_range_to_mask(unsigned long start,
  60. unsigned long len)
  61. {
  62. unsigned long end = start + len - 1;
  63. struct slice_mask ret = { 0, 0 };
  64. if (start < SLICE_LOW_TOP) {
  65. unsigned long mend = min(end, SLICE_LOW_TOP);
  66. unsigned long mstart = min(start, SLICE_LOW_TOP);
  67. ret.low_slices = (1u << (GET_LOW_SLICE_INDEX(mend) + 1))
  68. - (1u << GET_LOW_SLICE_INDEX(mstart));
  69. }
  70. if ((start + len) > SLICE_LOW_TOP)
  71. ret.high_slices = (1u << (GET_HIGH_SLICE_INDEX(end) + 1))
  72. - (1u << GET_HIGH_SLICE_INDEX(start));
  73. return ret;
  74. }
  75. static int slice_area_is_free(struct mm_struct *mm, unsigned long addr,
  76. unsigned long len)
  77. {
  78. struct vm_area_struct *vma;
  79. if ((mm->task_size - len) < addr)
  80. return 0;
  81. vma = find_vma(mm, addr);
  82. return (!vma || (addr + len) <= vma->vm_start);
  83. }
  84. static int slice_low_has_vma(struct mm_struct *mm, unsigned long slice)
  85. {
  86. return !slice_area_is_free(mm, slice << SLICE_LOW_SHIFT,
  87. 1ul << SLICE_LOW_SHIFT);
  88. }
  89. static int slice_high_has_vma(struct mm_struct *mm, unsigned long slice)
  90. {
  91. unsigned long start = slice << SLICE_HIGH_SHIFT;
  92. unsigned long end = start + (1ul << SLICE_HIGH_SHIFT);
  93. /* Hack, so that each addresses is controlled by exactly one
  94. * of the high or low area bitmaps, the first high area starts
  95. * at 4GB, not 0 */
  96. if (start == 0)
  97. start = SLICE_LOW_TOP;
  98. return !slice_area_is_free(mm, start, end - start);
  99. }
  100. static struct slice_mask slice_mask_for_free(struct mm_struct *mm)
  101. {
  102. struct slice_mask ret = { 0, 0 };
  103. unsigned long i;
  104. for (i = 0; i < SLICE_NUM_LOW; i++)
  105. if (!slice_low_has_vma(mm, i))
  106. ret.low_slices |= 1u << i;
  107. if (mm->task_size <= SLICE_LOW_TOP)
  108. return ret;
  109. for (i = 0; i < SLICE_NUM_HIGH; i++)
  110. if (!slice_high_has_vma(mm, i))
  111. ret.high_slices |= 1u << i;
  112. return ret;
  113. }
  114. static struct slice_mask slice_mask_for_size(struct mm_struct *mm, int psize)
  115. {
  116. struct slice_mask ret = { 0, 0 };
  117. unsigned long i;
  118. u64 psizes;
  119. psizes = mm->context.low_slices_psize;
  120. for (i = 0; i < SLICE_NUM_LOW; i++)
  121. if (((psizes >> (i * 4)) & 0xf) == psize)
  122. ret.low_slices |= 1u << i;
  123. psizes = mm->context.high_slices_psize;
  124. for (i = 0; i < SLICE_NUM_HIGH; i++)
  125. if (((psizes >> (i * 4)) & 0xf) == psize)
  126. ret.high_slices |= 1u << i;
  127. return ret;
  128. }
  129. static int slice_check_fit(struct slice_mask mask, struct slice_mask available)
  130. {
  131. return (mask.low_slices & available.low_slices) == mask.low_slices &&
  132. (mask.high_slices & available.high_slices) == mask.high_slices;
  133. }
  134. static void slice_flush_segments(void *parm)
  135. {
  136. struct mm_struct *mm = parm;
  137. unsigned long flags;
  138. if (mm != current->active_mm)
  139. return;
  140. /* update the paca copy of the context struct */
  141. get_paca()->context = current->active_mm->context;
  142. local_irq_save(flags);
  143. slb_flush_and_rebolt();
  144. local_irq_restore(flags);
  145. }
  146. static void slice_convert(struct mm_struct *mm, struct slice_mask mask, int psize)
  147. {
  148. /* Write the new slice psize bits */
  149. u64 lpsizes, hpsizes;
  150. unsigned long i, flags;
  151. slice_dbg("slice_convert(mm=%p, psize=%d)\n", mm, psize);
  152. slice_print_mask(" mask", mask);
  153. /* We need to use a spinlock here to protect against
  154. * concurrent 64k -> 4k demotion ...
  155. */
  156. spin_lock_irqsave(&slice_convert_lock, flags);
  157. lpsizes = mm->context.low_slices_psize;
  158. for (i = 0; i < SLICE_NUM_LOW; i++)
  159. if (mask.low_slices & (1u << i))
  160. lpsizes = (lpsizes & ~(0xful << (i * 4))) |
  161. (((unsigned long)psize) << (i * 4));
  162. hpsizes = mm->context.high_slices_psize;
  163. for (i = 0; i < SLICE_NUM_HIGH; i++)
  164. if (mask.high_slices & (1u << i))
  165. hpsizes = (hpsizes & ~(0xful << (i * 4))) |
  166. (((unsigned long)psize) << (i * 4));
  167. mm->context.low_slices_psize = lpsizes;
  168. mm->context.high_slices_psize = hpsizes;
  169. slice_dbg(" lsps=%lx, hsps=%lx\n",
  170. mm->context.low_slices_psize,
  171. mm->context.high_slices_psize);
  172. spin_unlock_irqrestore(&slice_convert_lock, flags);
  173. mb();
  174. /* XXX this is sub-optimal but will do for now */
  175. on_each_cpu(slice_flush_segments, mm, 0, 1);
  176. #ifdef CONFIG_SPU_BASE
  177. spu_flush_all_slbs(mm);
  178. #endif
  179. }
  180. static unsigned long slice_find_area_bottomup(struct mm_struct *mm,
  181. unsigned long len,
  182. struct slice_mask available,
  183. int psize, int use_cache)
  184. {
  185. struct vm_area_struct *vma;
  186. unsigned long start_addr, addr;
  187. struct slice_mask mask;
  188. int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT);
  189. if (use_cache) {
  190. if (len <= mm->cached_hole_size) {
  191. start_addr = addr = TASK_UNMAPPED_BASE;
  192. mm->cached_hole_size = 0;
  193. } else
  194. start_addr = addr = mm->free_area_cache;
  195. } else
  196. start_addr = addr = TASK_UNMAPPED_BASE;
  197. full_search:
  198. for (;;) {
  199. addr = _ALIGN_UP(addr, 1ul << pshift);
  200. if ((TASK_SIZE - len) < addr)
  201. break;
  202. vma = find_vma(mm, addr);
  203. BUG_ON(vma && (addr >= vma->vm_end));
  204. mask = slice_range_to_mask(addr, len);
  205. if (!slice_check_fit(mask, available)) {
  206. if (addr < SLICE_LOW_TOP)
  207. addr = _ALIGN_UP(addr + 1, 1ul << SLICE_LOW_SHIFT);
  208. else
  209. addr = _ALIGN_UP(addr + 1, 1ul << SLICE_HIGH_SHIFT);
  210. continue;
  211. }
  212. if (!vma || addr + len <= vma->vm_start) {
  213. /*
  214. * Remember the place where we stopped the search:
  215. */
  216. if (use_cache)
  217. mm->free_area_cache = addr + len;
  218. return addr;
  219. }
  220. if (use_cache && (addr + mm->cached_hole_size) < vma->vm_start)
  221. mm->cached_hole_size = vma->vm_start - addr;
  222. addr = vma->vm_end;
  223. }
  224. /* Make sure we didn't miss any holes */
  225. if (use_cache && start_addr != TASK_UNMAPPED_BASE) {
  226. start_addr = addr = TASK_UNMAPPED_BASE;
  227. mm->cached_hole_size = 0;
  228. goto full_search;
  229. }
  230. return -ENOMEM;
  231. }
  232. static unsigned long slice_find_area_topdown(struct mm_struct *mm,
  233. unsigned long len,
  234. struct slice_mask available,
  235. int psize, int use_cache)
  236. {
  237. struct vm_area_struct *vma;
  238. unsigned long addr;
  239. struct slice_mask mask;
  240. int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT);
  241. /* check if free_area_cache is useful for us */
  242. if (use_cache) {
  243. if (len <= mm->cached_hole_size) {
  244. mm->cached_hole_size = 0;
  245. mm->free_area_cache = mm->mmap_base;
  246. }
  247. /* either no address requested or can't fit in requested
  248. * address hole
  249. */
  250. addr = mm->free_area_cache;
  251. /* make sure it can fit in the remaining address space */
  252. if (addr > len) {
  253. addr = _ALIGN_DOWN(addr - len, 1ul << pshift);
  254. mask = slice_range_to_mask(addr, len);
  255. if (slice_check_fit(mask, available) &&
  256. slice_area_is_free(mm, addr, len))
  257. /* remember the address as a hint for
  258. * next time
  259. */
  260. return (mm->free_area_cache = addr);
  261. }
  262. }
  263. addr = mm->mmap_base;
  264. while (addr > len) {
  265. /* Go down by chunk size */
  266. addr = _ALIGN_DOWN(addr - len, 1ul << pshift);
  267. /* Check for hit with different page size */
  268. mask = slice_range_to_mask(addr, len);
  269. if (!slice_check_fit(mask, available)) {
  270. if (addr < SLICE_LOW_TOP)
  271. addr = _ALIGN_DOWN(addr, 1ul << SLICE_LOW_SHIFT);
  272. else if (addr < (1ul << SLICE_HIGH_SHIFT))
  273. addr = SLICE_LOW_TOP;
  274. else
  275. addr = _ALIGN_DOWN(addr, 1ul << SLICE_HIGH_SHIFT);
  276. continue;
  277. }
  278. /*
  279. * Lookup failure means no vma is above this address,
  280. * else if new region fits below vma->vm_start,
  281. * return with success:
  282. */
  283. vma = find_vma(mm, addr);
  284. if (!vma || (addr + len) <= vma->vm_start) {
  285. /* remember the address as a hint for next time */
  286. if (use_cache)
  287. mm->free_area_cache = addr;
  288. return addr;
  289. }
  290. /* remember the largest hole we saw so far */
  291. if (use_cache && (addr + mm->cached_hole_size) < vma->vm_start)
  292. mm->cached_hole_size = vma->vm_start - addr;
  293. /* try just below the current vma->vm_start */
  294. addr = vma->vm_start;
  295. }
  296. /*
  297. * A failed mmap() very likely causes application failure,
  298. * so fall back to the bottom-up function here. This scenario
  299. * can happen with large stack limits and large mmap()
  300. * allocations.
  301. */
  302. addr = slice_find_area_bottomup(mm, len, available, psize, 0);
  303. /*
  304. * Restore the topdown base:
  305. */
  306. if (use_cache) {
  307. mm->free_area_cache = mm->mmap_base;
  308. mm->cached_hole_size = ~0UL;
  309. }
  310. return addr;
  311. }
  312. static unsigned long slice_find_area(struct mm_struct *mm, unsigned long len,
  313. struct slice_mask mask, int psize,
  314. int topdown, int use_cache)
  315. {
  316. if (topdown)
  317. return slice_find_area_topdown(mm, len, mask, psize, use_cache);
  318. else
  319. return slice_find_area_bottomup(mm, len, mask, psize, use_cache);
  320. }
  321. unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
  322. unsigned long flags, unsigned int psize,
  323. int topdown, int use_cache)
  324. {
  325. struct slice_mask mask;
  326. struct slice_mask good_mask;
  327. struct slice_mask potential_mask = {0,0} /* silence stupid warning */;
  328. int pmask_set = 0;
  329. int fixed = (flags & MAP_FIXED);
  330. int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT);
  331. struct mm_struct *mm = current->mm;
  332. /* Sanity checks */
  333. BUG_ON(mm->task_size == 0);
  334. slice_dbg("slice_get_unmapped_area(mm=%p, psize=%d...\n", mm, psize);
  335. slice_dbg(" addr=%lx, len=%lx, flags=%lx, topdown=%d, use_cache=%d\n",
  336. addr, len, flags, topdown, use_cache);
  337. if (len > mm->task_size)
  338. return -ENOMEM;
  339. if (len & ((1ul << pshift) - 1))
  340. return -EINVAL;
  341. if (fixed && (addr & ((1ul << pshift) - 1)))
  342. return -EINVAL;
  343. if (fixed && addr > (mm->task_size - len))
  344. return -EINVAL;
  345. /* If hint, make sure it matches our alignment restrictions */
  346. if (!fixed && addr) {
  347. addr = _ALIGN_UP(addr, 1ul << pshift);
  348. slice_dbg(" aligned addr=%lx\n", addr);
  349. }
  350. /* First makeup a "good" mask of slices that have the right size
  351. * already
  352. */
  353. good_mask = slice_mask_for_size(mm, psize);
  354. slice_print_mask(" good_mask", good_mask);
  355. /* First check hint if it's valid or if we have MAP_FIXED */
  356. if ((addr != 0 || fixed) && (mm->task_size - len) >= addr) {
  357. /* Don't bother with hint if it overlaps a VMA */
  358. if (!fixed && !slice_area_is_free(mm, addr, len))
  359. goto search;
  360. /* Build a mask for the requested range */
  361. mask = slice_range_to_mask(addr, len);
  362. slice_print_mask(" mask", mask);
  363. /* Check if we fit in the good mask. If we do, we just return,
  364. * nothing else to do
  365. */
  366. if (slice_check_fit(mask, good_mask)) {
  367. slice_dbg(" fits good !\n");
  368. return addr;
  369. }
  370. /* We don't fit in the good mask, check what other slices are
  371. * empty and thus can be converted
  372. */
  373. potential_mask = slice_mask_for_free(mm);
  374. potential_mask.low_slices |= good_mask.low_slices;
  375. potential_mask.high_slices |= good_mask.high_slices;
  376. pmask_set = 1;
  377. slice_print_mask(" potential", potential_mask);
  378. if (slice_check_fit(mask, potential_mask)) {
  379. slice_dbg(" fits potential !\n");
  380. goto convert;
  381. }
  382. }
  383. /* If we have MAP_FIXED and failed the above step, then error out */
  384. if (fixed)
  385. return -EBUSY;
  386. search:
  387. slice_dbg(" search...\n");
  388. /* Now let's see if we can find something in the existing slices
  389. * for that size
  390. */
  391. addr = slice_find_area(mm, len, good_mask, psize, topdown, use_cache);
  392. if (addr != -ENOMEM) {
  393. /* Found within the good mask, we don't have to setup,
  394. * we thus return directly
  395. */
  396. slice_dbg(" found area at 0x%lx\n", addr);
  397. return addr;
  398. }
  399. /* Won't fit, check what can be converted */
  400. if (!pmask_set) {
  401. potential_mask = slice_mask_for_free(mm);
  402. potential_mask.low_slices |= good_mask.low_slices;
  403. potential_mask.high_slices |= good_mask.high_slices;
  404. pmask_set = 1;
  405. slice_print_mask(" potential", potential_mask);
  406. }
  407. /* Now let's see if we can find something in the existing slices
  408. * for that size
  409. */
  410. addr = slice_find_area(mm, len, potential_mask, psize, topdown,
  411. use_cache);
  412. if (addr == -ENOMEM)
  413. return -ENOMEM;
  414. mask = slice_range_to_mask(addr, len);
  415. slice_dbg(" found potential area at 0x%lx\n", addr);
  416. slice_print_mask(" mask", mask);
  417. convert:
  418. slice_convert(mm, mask, psize);
  419. return addr;
  420. }
  421. EXPORT_SYMBOL_GPL(slice_get_unmapped_area);
  422. unsigned long arch_get_unmapped_area(struct file *filp,
  423. unsigned long addr,
  424. unsigned long len,
  425. unsigned long pgoff,
  426. unsigned long flags)
  427. {
  428. return slice_get_unmapped_area(addr, len, flags,
  429. current->mm->context.user_psize,
  430. 0, 1);
  431. }
  432. unsigned long arch_get_unmapped_area_topdown(struct file *filp,
  433. const unsigned long addr0,
  434. const unsigned long len,
  435. const unsigned long pgoff,
  436. const unsigned long flags)
  437. {
  438. return slice_get_unmapped_area(addr0, len, flags,
  439. current->mm->context.user_psize,
  440. 1, 1);
  441. }
  442. unsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr)
  443. {
  444. u64 psizes;
  445. int index;
  446. if (addr < SLICE_LOW_TOP) {
  447. psizes = mm->context.low_slices_psize;
  448. index = GET_LOW_SLICE_INDEX(addr);
  449. } else {
  450. psizes = mm->context.high_slices_psize;
  451. index = GET_HIGH_SLICE_INDEX(addr);
  452. }
  453. return (psizes >> (index * 4)) & 0xf;
  454. }
  455. EXPORT_SYMBOL_GPL(get_slice_psize);
  456. /*
  457. * This is called by hash_page when it needs to do a lazy conversion of
  458. * an address space from real 64K pages to combo 4K pages (typically
  459. * when hitting a non cacheable mapping on a processor or hypervisor
  460. * that won't allow them for 64K pages).
  461. *
  462. * This is also called in init_new_context() to change back the user
  463. * psize from whatever the parent context had it set to
  464. * N.B. This may be called before mm->context.id has been set.
  465. *
  466. * This function will only change the content of the {low,high)_slice_psize
  467. * masks, it will not flush SLBs as this shall be handled lazily by the
  468. * caller.
  469. */
  470. void slice_set_user_psize(struct mm_struct *mm, unsigned int psize)
  471. {
  472. unsigned long flags, lpsizes, hpsizes;
  473. unsigned int old_psize;
  474. int i;
  475. slice_dbg("slice_set_user_psize(mm=%p, psize=%d)\n", mm, psize);
  476. spin_lock_irqsave(&slice_convert_lock, flags);
  477. old_psize = mm->context.user_psize;
  478. slice_dbg(" old_psize=%d\n", old_psize);
  479. if (old_psize == psize)
  480. goto bail;
  481. mm->context.user_psize = psize;
  482. wmb();
  483. lpsizes = mm->context.low_slices_psize;
  484. for (i = 0; i < SLICE_NUM_LOW; i++)
  485. if (((lpsizes >> (i * 4)) & 0xf) == old_psize)
  486. lpsizes = (lpsizes & ~(0xful << (i * 4))) |
  487. (((unsigned long)psize) << (i * 4));
  488. hpsizes = mm->context.high_slices_psize;
  489. for (i = 0; i < SLICE_NUM_HIGH; i++)
  490. if (((hpsizes >> (i * 4)) & 0xf) == old_psize)
  491. hpsizes = (hpsizes & ~(0xful << (i * 4))) |
  492. (((unsigned long)psize) << (i * 4));
  493. mm->context.low_slices_psize = lpsizes;
  494. mm->context.high_slices_psize = hpsizes;
  495. slice_dbg(" lsps=%lx, hsps=%lx\n",
  496. mm->context.low_slices_psize,
  497. mm->context.high_slices_psize);
  498. bail:
  499. spin_unlock_irqrestore(&slice_convert_lock, flags);
  500. }
  501. /*
  502. * is_hugepage_only_range() is used by generic code to verify wether
  503. * a normal mmap mapping (non hugetlbfs) is valid on a given area.
  504. *
  505. * until the generic code provides a more generic hook and/or starts
  506. * calling arch get_unmapped_area for MAP_FIXED (which our implementation
  507. * here knows how to deal with), we hijack it to keep standard mappings
  508. * away from us.
  509. *
  510. * because of that generic code limitation, MAP_FIXED mapping cannot
  511. * "convert" back a slice with no VMAs to the standard page size, only
  512. * get_unmapped_area() can. It would be possible to fix it here but I
  513. * prefer working on fixing the generic code instead.
  514. *
  515. * WARNING: This will not work if hugetlbfs isn't enabled since the
  516. * generic code will redefine that function as 0 in that. This is ok
  517. * for now as we only use slices with hugetlbfs enabled. This should
  518. * be fixed as the generic code gets fixed.
  519. */
  520. int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr,
  521. unsigned long len)
  522. {
  523. struct slice_mask mask, available;
  524. mask = slice_range_to_mask(addr, len);
  525. available = slice_mask_for_size(mm, mm->context.user_psize);
  526. #if 0 /* too verbose */
  527. slice_dbg("is_hugepage_only_range(mm=%p, addr=%lx, len=%lx)\n",
  528. mm, addr, len);
  529. slice_print_mask(" mask", mask);
  530. slice_print_mask(" available", available);
  531. #endif
  532. return !slice_check_fit(mask, available);
  533. }