Skip to contentSkip to conversation

percpu: add a schedule point in pcpu_balance_workfn()

PATCH Applied Eric Dumazet 2 participants 2 messages Feb 23, 2018

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

PATCH 1/1 percpu: add a schedule point in pcpu_balance_workfn()

From: Eric Dumazet <[email protected]>

When a large BPF percpu map is destroyed, I have seen pcpu_balance_workfn() holding cpu for hundreds of milliseconds.

On KASAN config and 112 hyperthreads, average time to destroy a chunk is ~4 ms.

[ 2489.841376] destroy chunk 1 in 4148689 ns
...
[ 2490.093428] destroy chunk 32 in 4072718 ns

---
 mm/percpu.c |    1 +

 1 file changed, 1 insertion(+)
mm/percpu.c +1 -0
index 50e7fdf84055151d8c7e8bb220f7a73e96b7f3e4..d40dfb597ffce2656220257f0227219ab917135b 100644
@@ -1600,6 +1600,7 @@ static void pcpu_balance_workfn(struct work_struct *work)
 			spin_unlock_irq(&pcpu_lock);
 		}
 		pcpu_destroy_chunk(chunk);
+		cond_resched();
 	}
 
 	/*
maintainer Applied
#1 lore raw
Quoted 5 lines · Eric Dumazet

From: Eric Dumazet <[email protected]>

When a large BPF percpu map is destroyed, I have seen pcpu_balance_workfn() holding cpu for hundreds of milliseconds.

Quoted 8 lines

On KASAN config and 112 hyperthreads, average time to destroy a chunk is ~4 ms.

[ 2489.841376] destroy chunk 1 in 4148689 ns
...
[ 2490.093428] destroy chunk 32 in 4072718 ns

Applied to percpu/for-4.16-fixes.

Thank, Eric.

Signature · 1 line
tejun