Deleted Added
full compact
vm_radix.c (230749) vm_radix.c (230750)
1/*
2 * Copyright (c) 2011 Jeffrey Roberson <jeff@freebsd.org>
3 * Copyright (c) 2008 Mayur Shardul <mayur.shardul@gmail.com>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 444 unchanged lines hidden (view full) ---

453 /*
454 * Calculate how much to increment our index by
455 * based on the tree level. We must truncate the
456 * lower bits to start from the begnning of the
457 * next leaf.
458 */
459 inc = 1LL << (level * VM_RADIX_WIDTH);
460 start &= ~VM_RADIX_MAX(level);
1/*
2 * Copyright (c) 2011 Jeffrey Roberson <jeff@freebsd.org>
3 * Copyright (c) 2008 Mayur Shardul <mayur.shardul@gmail.com>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 444 unchanged lines hidden (view full) ---

453 /*
454 * Calculate how much to increment our index by
455 * based on the tree level. We must truncate the
456 * lower bits to start from the begnning of the
457 * next leaf.
458 */
459 inc = 1LL << (level * VM_RADIX_WIDTH);
460 start &= ~VM_RADIX_MAX(level);
461
462 /* Avoid start address wrapping up. */
463 if ((VM_RADIX_MAXVAL - start) < inc) {
464 rnode = NULL;
465 goto out;
466 }
461 start += inc;
462 slot++;
463 CTR5(KTR_VM,
464 "leaf: start %ju end %ju inc %ju mask 0x%jX slot %d",
465 (uintmax_t)start, (uintmax_t)end, (uintmax_t)inc,
466 (uintmax_t)~VM_RADIX_MAX(level), slot);
467 for (; slot < VM_RADIX_COUNT; slot++, start += inc) {
468 if (end != 0 && start >= end) {
469 rnode = NULL;
470 goto out;
471 }
472 if (rnode->rn_child[slot]) {
473 rnode = rnode->rn_child[slot];
474 break;
475 }
467 start += inc;
468 slot++;
469 CTR5(KTR_VM,
470 "leaf: start %ju end %ju inc %ju mask 0x%jX slot %d",
471 (uintmax_t)start, (uintmax_t)end, (uintmax_t)inc,
472 (uintmax_t)~VM_RADIX_MAX(level), slot);
473 for (; slot < VM_RADIX_COUNT; slot++, start += inc) {
474 if (end != 0 && start >= end) {
475 rnode = NULL;
476 goto out;
477 }
478 if (rnode->rn_child[slot]) {
479 rnode = rnode->rn_child[slot];
480 break;
481 }
482 if ((VM_RADIX_MAXVAL - start) < inc) {
483 rnode = NULL;
484 goto out;
485 }
476 }
477 if (slot == VM_RADIX_COUNT)
478 goto restart;
479 }
480
481out:
482 *startp = start;
483 return (rnode);

--- 277 unchanged lines hidden ---
486 }
487 if (slot == VM_RADIX_COUNT)
488 goto restart;
489 }
490
491out:
492 *startp = start;
493 return (rnode);

--- 277 unchanged lines hidden ---