--- zzzz-none-000/linux-3.10.107/mm/highmem.c 2017-06-27 09:49:32.000000000 +0000 +++ vr9-7490-729/linux-3.10.107/mm/highmem.c 2021-11-10 11:53:56.000000000 +0000 @@ -44,6 +44,14 @@ */ #ifdef CONFIG_HIGHMEM +#ifndef ARCH_PKMAP_COLORING +#define set_pkmap_color(pg,cl) /* */ +#define get_last_pkmap_nr(p,cl) (p) +#define get_next_pkmap_nr(p,cl) ((p + 1) & LAST_PKMAP_MASK) +#define is_no_more_pkmaps(p,cl) (!p) +#define get_next_pkmap_counter(c,cl) (c - 1) +#endif + unsigned long totalhigh_pages __read_mostly; EXPORT_SYMBOL(totalhigh_pages); @@ -161,19 +169,24 @@ { unsigned long vaddr; int count; + int color __attribute__((unused)); + + set_pkmap_color(page,color); + last_pkmap_nr = get_last_pkmap_nr(last_pkmap_nr,color); start: count = LAST_PKMAP; /* Find an empty entry */ for (;;) { - last_pkmap_nr = (last_pkmap_nr + 1) & LAST_PKMAP_MASK; - if (!last_pkmap_nr) { + last_pkmap_nr = get_next_pkmap_nr(last_pkmap_nr,color); + if (is_no_more_pkmaps(last_pkmap_nr,color)) { flush_all_zero_pkmaps(); count = LAST_PKMAP; } if (!pkmap_count[last_pkmap_nr]) break; /* Found a usable entry */ - if (--count) + count = get_next_pkmap_counter(count,color); + if (count > 0) continue; /*