Commit 1bfd188
mm/shmem, swap: avoid redundant Xarray lookup during swapin
commit 0cfc0e7 upstream.
Currently shmem calls xa_get_order to get the swap radix entry order,
requiring a full tree walk. This can be easily combined with the swap
entry value checking (shmem_confirm_swap) to avoid the duplicated lookup
and abort early if the entry is gone already. Which should improve the
performance.
Link: https://lkml.kernel.org/r/20250728075306.12704-1-ryncsn@gmail.com
Link: https://lkml.kernel.org/r/20250728075306.12704-3-ryncsn@gmail.com
Signed-off-by: Kairui Song <kasong@tencent.com>
Reviewed-by: Kemeng Shi <shikemeng@huaweicloud.com>
Reviewed-by: Dev Jain <dev.jain@arm.com>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Barry Song <baohua@kernel.org>
Cc: Chris Li <chrisl@kernel.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Nhat Pham <nphamcs@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Stable-dep-of: 8a1968b ("mm/shmem, swap: fix race of truncate and swap entry split")
[ hughd: removed series cover letter and skip_swapcache dependencies ]
Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 62414ee commit 1bfd188
1 file changed
Lines changed: 25 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
499 | 499 | | |
500 | 500 | | |
501 | 501 | | |
502 | | - | |
| 502 | + | |
503 | 503 | | |
504 | 504 | | |
505 | 505 | | |
| 506 | + | |
506 | 507 | | |
507 | | - | |
508 | | - | |
| 508 | + | |
| 509 | + | |
509 | 510 | | |
510 | | - | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
511 | 523 | | |
512 | 524 | | |
513 | 525 | | |
| |||
2155 | 2167 | | |
2156 | 2168 | | |
2157 | 2169 | | |
2158 | | - | |
2159 | | - | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
2160 | 2173 | | |
2161 | 2174 | | |
2162 | 2175 | | |
2163 | 2176 | | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
2164 | 2181 | | |
2165 | 2182 | | |
2166 | 2183 | | |
2167 | | - | |
2168 | 2184 | | |
2169 | 2185 | | |
2170 | 2186 | | |
| |||
2241 | 2257 | | |
2242 | 2258 | | |
2243 | 2259 | | |
2244 | | - | |
| 2260 | + | |
2245 | 2261 | | |
2246 | 2262 | | |
2247 | 2263 | | |
| |||
2284 | 2300 | | |
2285 | 2301 | | |
2286 | 2302 | | |
2287 | | - | |
| 2303 | + | |
2288 | 2304 | | |
2289 | 2305 | | |
2290 | 2306 | | |
| |||
0 commit comments