Lines Matching +full:a +full:- +full:z
1 // SPDX-License-Identifier: GPL-2.0
20 return -EINVAL; in shuffle_param_set()
21 if (*(bool *)kp->arg) in shuffle_param_set()
33 * For two pages to be swapped in the shuffle, they must be free (on a
42 * Given we're dealing with randomly selected pfns in a zone we in shuffle_valid_page()
54 /* ...is the page free and currently on a free_area list? */ in shuffle_valid_page()
69 * Fisher-Yates shuffle the freelist which prescribes iterating through an
71 * the span, end_pfn - start_pfn.
74 * of bias in the distribution, like modulo bias or pseudo-random number
77 * be a perfect shuffle.
80 void __meminit __shuffle_zone(struct zone *z) in __shuffle_zone() argument
83 unsigned long start_pfn = z->zone_start_pfn; in __shuffle_zone()
84 unsigned long end_pfn = zone_end_pfn(z); in __shuffle_zone()
88 spin_lock_irqsave(&z->lock, flags); in __shuffle_zone()
96 * We expect page_i, in the sub-range of a zone being added in __shuffle_zone()
101 page_i = shuffle_valid_page(z, i, order); in __shuffle_zone()
107 * Pick a random order aligned page in the zone span as in __shuffle_zone()
108 * a swap target. If the selected pfn is a hole, retry in __shuffle_zone()
109 * up to SHUFFLE_RETRY attempts find a random valid pfn in __shuffle_zone()
112 j = z->zone_start_pfn + in __shuffle_zone()
113 ALIGN_DOWN(get_random_long() % z->spanned_pages, in __shuffle_zone()
115 page_j = shuffle_valid_page(z, j, order); in __shuffle_zone()
135 list_swap(&page_i->lru, &page_j->lru); in __shuffle_zone()
137 pr_debug("%s: swap: %#lx -> %#lx\n", __func__, i, j); in __shuffle_zone()
141 spin_unlock_irqrestore(&z->lock, flags); in __shuffle_zone()
143 spin_lock_irqsave(&z->lock, flags); in __shuffle_zone()
146 spin_unlock_irqrestore(&z->lock, flags); in __shuffle_zone()
150 * __shuffle_free_memory - reduce the predictability of the page allocator
155 struct zone *z; in __shuffle_free_memory() local
157 for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++) in __shuffle_free_memory()
158 shuffle_zone(z); in __shuffle_free_memory()
178 rand_bits--; in shuffle_pick_tail()