Commit fefc075
mm/page_alloc: fix race condition in unaccepted memory handling
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]>1 parent 23fa022 commit fefc075
3 files changed
+0
-49
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1590 | 1590 | | |
1591 | 1591 | | |
1592 | 1592 | | |
1593 | | - | |
1594 | 1593 | | |
1595 | 1594 | | |
1596 | 1595 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1441 | 1441 | | |
1442 | 1442 | | |
1443 | 1443 | | |
1444 | | - | |
1445 | 1444 | | |
1446 | 1445 | | |
1447 | 1446 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7172 | 7172 | | |
7173 | 7173 | | |
7174 | 7174 | | |
7175 | | - | |
7176 | | - | |
7177 | | - | |
7178 | 7175 | | |
7179 | 7176 | | |
7180 | | - | |
7181 | | - | |
7182 | | - | |
7183 | | - | |
7184 | | - | |
7185 | 7177 | | |
7186 | 7178 | | |
7187 | 7179 | | |
| |||
7206 | 7198 | | |
7207 | 7199 | | |
7208 | 7200 | | |
7209 | | - | |
7210 | | - | |
7211 | 7201 | | |
7212 | | - | |
7213 | | - | |
7214 | 7202 | | |
7215 | 7203 | | |
7216 | 7204 | | |
| |||
7219 | 7207 | | |
7220 | 7208 | | |
7221 | 7209 | | |
7222 | | - | |
7223 | | - | |
7224 | | - | |
7225 | | - | |
7226 | | - | |
7227 | | - | |
7228 | | - | |
7229 | | - | |
7230 | | - | |
7231 | | - | |
7232 | | - | |
7233 | | - | |
7234 | | - | |
7235 | | - | |
7236 | | - | |
7237 | | - | |
7238 | | - | |
7239 | | - | |
7240 | | - | |
7241 | | - | |
7242 | | - | |
7243 | | - | |
7244 | 7210 | | |
7245 | 7211 | | |
7246 | 7212 | | |
| |||
7277 | 7243 | | |
7278 | 7244 | | |
7279 | 7245 | | |
7280 | | - | |
7281 | | - | |
7282 | | - | |
7283 | | - | |
7284 | | - | |
7285 | 7246 | | |
7286 | 7247 | | |
7287 | 7248 | | |
7288 | 7249 | | |
7289 | 7250 | | |
7290 | 7251 | | |
7291 | | - | |
7292 | | - | |
7293 | | - | |
7294 | 7252 | | |
7295 | 7253 | | |
7296 | 7254 | | |
| |||
7328 | 7286 | | |
7329 | 7287 | | |
7330 | 7288 | | |
7331 | | - | |
7332 | 7289 | | |
7333 | 7290 | | |
7334 | 7291 | | |
7335 | 7292 | | |
7336 | 7293 | | |
7337 | | - | |
7338 | 7294 | | |
7339 | 7295 | | |
7340 | 7296 | | |
7341 | 7297 | | |
7342 | 7298 | | |
7343 | 7299 | | |
7344 | | - | |
7345 | | - | |
7346 | | - | |
7347 | 7300 | | |
7348 | 7301 | | |
7349 | 7302 | | |
| |||
0 commit comments