Lines Matching +full:a +full:- +full:z

1 // SPDX-License-Identifier: GPL-2.0
34 * For two pages to be swapped in the shuffle, they must be free (on a
43 * Given we're dealing with randomly selected pfns in a zone we in shuffle_valid_page()
55 /* ...is the page free and currently on a free_area list? */ in shuffle_valid_page()
70 * Fisher-Yates shuffle the freelist which prescribes iterating through an
72 * the span, end_pfn - start_pfn.
75 * of bias in the distribution, like modulo bias or pseudo-random number
78 * be a perfect shuffle.
81 void __meminit __shuffle_zone(struct zone *z) in __shuffle_zone() argument
84 unsigned long start_pfn = z->zone_start_pfn; in __shuffle_zone()
85 unsigned long end_pfn = zone_end_pfn(z); in __shuffle_zone()
89 spin_lock_irqsave(&z->lock, flags); in __shuffle_zone()
97 * We expect page_i, in the sub-range of a zone being added in __shuffle_zone()
102 page_i = shuffle_valid_page(z, i, order); in __shuffle_zone()
108 * Pick a random order aligned page in the zone span as in __shuffle_zone()
109 * a swap target. If the selected pfn is a hole, retry in __shuffle_zone()
110 * up to SHUFFLE_RETRY attempts find a random valid pfn in __shuffle_zone()
113 j = z->zone_start_pfn + in __shuffle_zone()
114 ALIGN_DOWN(get_random_long() % z->spanned_pages, in __shuffle_zone()
116 page_j = shuffle_valid_page(z, j, order); in __shuffle_zone()
136 list_swap(&page_i->lru, &page_j->lru); in __shuffle_zone()
138 pr_debug("%s: swap: %#lx -> %#lx\n", __func__, i, j); in __shuffle_zone()
142 spin_unlock_irqrestore(&z->lock, flags); in __shuffle_zone()
144 spin_lock_irqsave(&z->lock, flags); in __shuffle_zone()
147 spin_unlock_irqrestore(&z->lock, flags); in __shuffle_zone()
151 * shuffle_free_memory - reduce the predictability of the page allocator
156 struct zone *z; in __shuffle_free_memory() local
158 for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++) in __shuffle_free_memory()
159 shuffle_zone(z); in __shuffle_free_memory()
179 rand_bits--; in shuffle_pick_tail()