int                     map_alloc;      /* # of map entries allocated */
        int                     *map;           /* allocation map */
        void                    *data;          /* chunk data */
+       int                     first_free;     /* no free below this */
        bool                    immutable;      /* no [de]population allowed */
        unsigned long           populated[];    /* populated bitmap */
 };
        int oslot = pcpu_chunk_slot(chunk);
        int max_contig = 0;
        int i, off;
+       bool seen_free = false;
        int *p;
 
-       for (i = 0, p = chunk->map; i < chunk->map_used; i++, p++) {
+       for (i = chunk->first_free, p = chunk->map + i; i < chunk->map_used; i++, p++) {
                int head, tail;
                int this_size;
 
 
                this_size = (p[1] & ~1) - off;
                if (this_size < head + size) {
+                       if (!seen_free) {
+                               chunk->first_free = i;
+                               seen_free = true;
+                       }
                        max_contig = max(this_size, max_contig);
                        continue;
                }
                        chunk->map_used += nr_extra;
 
                        if (head) {
+                               if (!seen_free) {
+                                       chunk->first_free = i;
+                                       seen_free = true;
+                               }
                                *++p = off += head;
                                ++i;
                                max_contig = max(head, max_contig);
                        }
                }
 
+               if (!seen_free)
+                       chunk->first_free = i + 1;
+
                /* update hint and mark allocated */
                if (i + 1 == chunk->map_used)
                        chunk->contig_hint = max_contig; /* fully scanned */
        }
        BUG_ON(off != freeme);
 
+       if (i < chunk->first_free)
+               chunk->first_free = i;
+
        p = chunk->map + i;
        *p = off &= ~1;
        chunk->free_size += (p[1] & ~1) - off;