percpu: update free path with correct new free region
authorDennis Zhou <dennis@kernel.org>
Thu, 21 Feb 2019 23:50:19 +0000 (15:50 -0800)
committerDennis Zhou <dennis@kernel.org>
Wed, 13 Mar 2019 19:25:31 +0000 (12:25 -0700)
When updating the chunk's contig_hint on the free path of a hint that
does not touch the page boundaries, it was incorrectly using the
starting offset of the free region and the block's contig_hint. This
could lead to incorrect assumptions about fit given a size and better
alignment of the start. Fix this by using (end - start) as this is only
called when updating a hint within a block.

Signed-off-by: Dennis Zhou <dennis@kernel.org>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
mm/percpu.c

index 2e6fc8d552c96d58f615be2fd3addadefd01f5c0..938f295a60d4dcd48d7dd0322644c19dd2d72589 100644 (file)
@@ -871,7 +871,7 @@ static void pcpu_block_update_hint_free(struct pcpu_chunk *chunk, int bit_off,
                pcpu_chunk_refresh_hint(chunk);
        else
                pcpu_chunk_update(chunk, pcpu_block_off_to_off(s_index, start),
-                                 s_block->contig_hint);
+                                 end - start);
 }
 
 /**