Commit 405cc51fc104 ("mm/list_lru: optimize memcg_reparent_list_lru_node()") has subtle races which are proving ugly to fix. Revert the original optimization. If quantitative testing indicates that we have a significant problem here then other implementations can be looked at.
Unified · Split
| @@ -394,12 +394,6 @@ static void memcg_reparent_list_lru_node(struct list_lru *lru, int nid, · 393 unmodified lines | |||
| 394 | int dst_idx = dst_memcg->kmemcg_id; | 394 | int dst_idx = dst_memcg->kmemcg_id; |
| 395 | struct list_lru_one *src, *dst; | 395 | struct list_lru_one *src, *dst; |
| 396 | 396 | ||
| 397 | /* | ||
| 398 | * If there is no lru entry in this nlru, we can skip it immediately. | ||
| 399 | */ | ||
| 400 | if (!READ_ONCE(nlru->nr_items)) | ||
| 401 | return; | ||
| 402 | |||
| 403 | /* | 397 | /* |
| 404 | * Since list_lru_{add,del} may be called under an IRQ-safe lock, | 398 | * Since list_lru_{add,del} may be called under an IRQ-safe lock, |
| 405 | * we have to use IRQ-safe primitives here to avoid deadlock. | 399 | * we have to use IRQ-safe primitives here to avoid deadlock. |