Skip to contentSkip to conversation

mm/percpu.c: renew the max_contig if we merge the head and previous block.

PATCH In review Jianyu Zhan 2 participants 2 messages Mar 27, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mm/percpu.c: renew the max_contig if we merge the head and previous block.

During pcpu_alloc_area(), we might merge the current head with the previous block. Since we have calculated the max_contig using the size of previous block before we skip it, and now we update the size of previous block, so we should renew the max_contig.

---
 mm/percpu.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
mm/percpu.c +4 -2
index 036cfe0..cfda29c 100644
@@ -506,9 +506,11 @@ static int pcpu_alloc_area(struct pcpu_chunk *chunk, int size, int align)
 		 * uncommon for percpu allocations.
 		 */
 		if (head && (head < sizeof(int) || chunk->map[i - 1] > 0)) {
-			if (chunk->map[i - 1] > 0)
+			if (chunk->map[i - 1] > 0) {
 				chunk->map[i - 1] += head;
-			else {
+				max_contig =
+					max(chunk->map[i - 1], max_contig);
+			} else {
 				chunk->map[i - 1] -= head;
 				chunk->free_size -= head;
 			}
Signature · 7 lines
1.8.5.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
maintainer
#1 lore raw
Quoted 4 lines · Jianyu Zhan

During pcpu_alloc_area(), we might merge the current head with the previous block. Since we have calculated the max_contig using the size of previous block before we skip it, and now we update the size of previous block, so we should renew the max_contig.

pcpu_alloc_area() has been reimplemented in percpu/for-3.15. Can you please refresh the patch against the new implementation?

Thanks.

Signature · 7 lines
tejun

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>