Commit 98fdd2f
mm/page_alloc: fix race condition in unaccepted memory handling
commit fefc075 upstream.
The page allocator tracks the number of zones that have unaccepted memory
using static_branch_enc/dec() and uses that static branch in hot paths to
determine if it needs to deal with unaccepted memory.
Borislav and Thomas pointed out that the tracking is racy: operations on
static_branch are not serialized against adding/removing unaccepted pages
to/from the zone.
Sanity checks inside static_branch machinery detects it:
WARNING: CPU: 0 PID: 10 at kernel/jump_label.c:276 __static_key_slow_dec_cpuslocked+0x8e/0xa0
The comment around the WARN() explains the problem:
/*
* Warn about the '-1' case though; since that means a
* decrement is concurrent with a first (0->1) increment. IOW
* people are trying to disable something that wasn't yet fully
* enabled. This suggests an ordering problem on the user side.
*/
The effect of this static_branch optimization is only visible on
microbenchmark.
Instead of adding more complexity around it, remove it altogether.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Kirill A. Shutemov <[email protected]>
Fixes: dcdfdd4 ("mm: Add support for unaccepted memory")
Link: https://lore.kernel.org/all/20250506092445.GBaBnVXXyvnazly6iF@fat_crate.local
Reported-by: Borislav Petkov <[email protected]>
Tested-by: Borislav Petkov (AMD) <[email protected]>
Reported-by: Thomas Gleixner <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Suren Baghdasaryan <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Brendan Jackman <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: <[email protected]> [6.5+]
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Kirill A. Shutemov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>1 parent e24073c commit 98fdd2f
1 file changed
+0
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
306 | | - | |
307 | 306 | | |
308 | 307 | | |
309 | 308 | | |
| |||
6586 | 6585 | | |
6587 | 6586 | | |
6588 | 6587 | | |
6589 | | - | |
6590 | | - | |
6591 | | - | |
6592 | 6588 | | |
6593 | 6589 | | |
6594 | 6590 | | |
| |||
6624 | 6620 | | |
6625 | 6621 | | |
6626 | 6622 | | |
6627 | | - | |
6628 | 6623 | | |
6629 | 6624 | | |
6630 | 6625 | | |
| |||
6635 | 6630 | | |
6636 | 6631 | | |
6637 | 6632 | | |
6638 | | - | |
6639 | 6633 | | |
6640 | 6634 | | |
6641 | 6635 | | |
| |||
6645 | 6639 | | |
6646 | 6640 | | |
6647 | 6641 | | |
6648 | | - | |
6649 | | - | |
6650 | | - | |
6651 | 6642 | | |
6652 | 6643 | | |
6653 | 6644 | | |
| |||
6656 | 6647 | | |
6657 | 6648 | | |
6658 | 6649 | | |
6659 | | - | |
6660 | | - | |
6661 | | - | |
6662 | 6650 | | |
6663 | 6651 | | |
6664 | 6652 | | |
| |||
6688 | 6676 | | |
6689 | 6677 | | |
6690 | 6678 | | |
6691 | | - | |
6692 | | - | |
6693 | | - | |
6694 | | - | |
6695 | | - | |
6696 | 6679 | | |
6697 | 6680 | | |
6698 | 6681 | | |
6699 | 6682 | | |
6700 | | - | |
6701 | 6683 | | |
6702 | 6684 | | |
6703 | 6685 | | |
6704 | 6686 | | |
6705 | 6687 | | |
6706 | | - | |
6707 | 6688 | | |
6708 | 6689 | | |
6709 | 6690 | | |
6710 | 6691 | | |
6711 | 6692 | | |
6712 | | - | |
6713 | | - | |
6714 | | - | |
6715 | 6693 | | |
6716 | 6694 | | |
6717 | 6695 | | |
| |||
6731 | 6709 | | |
6732 | 6710 | | |
6733 | 6711 | | |
6734 | | - | |
6735 | | - | |
6736 | | - | |
6737 | | - | |
6738 | | - | |
6739 | 6712 | | |
6740 | 6713 | | |
6741 | 6714 | | |
| |||
0 commit comments