Commit 7eb97da
committed
mm/page_alloc: avoid second trylock of zone->lock
JIRA: https://issues.redhat.com/browse/RHEL-78202
commit c5bb27e
Author: Alexei Starovoitov <ast@kernel.org>
Date: Sun Mar 30 17:28:09 2025 -0700
mm/page_alloc: avoid second trylock of zone->lock
spin_trylock followed by spin_lock will cause extra write cache access.
If the lock is contended it may cause unnecessary cache line bouncing and
will execute redundant irq restore/save pair. Therefore, check
alloc/fpi_flags first and use spin_trylock or spin_lock.
Link: https://lkml.kernel.org/r/20250331002809.94758-1-alexei.starovoitov@gmail.com
Fixes: 97769a5 ("mm, bpf: Introduce try_alloc_pages() for opportunistic page allocation")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
Reviewed-by: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Daniel Borkman <daniel@iogearbox.net>
Cc: Martin KaFai Lau <martin.lau@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Gregory Bell <grbell@redhat.com>1 parent a23a231 commit 7eb97da
1 file changed
+9
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1264 | 1264 | | |
1265 | 1265 | | |
1266 | 1266 | | |
1267 | | - | |
1268 | | - | |
| 1267 | + | |
| 1268 | + | |
1269 | 1269 | | |
1270 | 1270 | | |
1271 | 1271 | | |
| 1272 | + | |
1272 | 1273 | | |
1273 | 1274 | | |
1274 | 1275 | | |
| |||
2336 | 2337 | | |
2337 | 2338 | | |
2338 | 2339 | | |
2339 | | - | |
2340 | | - | |
| 2340 | + | |
| 2341 | + | |
2341 | 2342 | | |
| 2343 | + | |
2342 | 2344 | | |
2343 | 2345 | | |
2344 | 2346 | | |
| |||
2959 | 2961 | | |
2960 | 2962 | | |
2961 | 2963 | | |
2962 | | - | |
2963 | | - | |
| 2964 | + | |
| 2965 | + | |
2964 | 2966 | | |
| 2967 | + | |
2965 | 2968 | | |
2966 | 2969 | | |
2967 | 2970 | | |
| |||
0 commit comments