treewide: remove unnecessary invalid range checks in memblock iteration loops
Status from this message: Applied to range-checks branch of memblock.git tree, thanks!
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
Patches in v3 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | arm64: mm: remove unreachable invalid range check in kasan_init_shadow()arch/ | +0 | 0 replies | |
| 2/8 | LoongArch: remove unreachable invalid range check in kasan_init()arch/ | +0 | 0 replies | |
| 3/8 | riscv: remove unreachable invalid range check in create_linear_mapping_page_table()arch/ | +0 | 0 replies | |
| 4/8 | riscv: remove unreachable invalid range check in kasan_init()arch/ | +0 | 0 replies | |
| 5/8 | ARM: remove unreachable invalid range check in kasan_init()arch/ | +0 | 0 replies | |
| 6/8 | powerpc64/kasan: Remove unreachable invalid range check in kasan_init_phys_region()arch/ arch/ | +0 | 0 replies | |
| 7/8 | mm: remove unnecessary empty range check in early_calculate_totalpages()mm/ | +1 | 0 replies | |
| 8/8 | mm/hugetlb: remove unnecessary empty range check in hugetlb_bootmem_set_nodes()mm/ | +2 | 0 replies |
Reviews trailers per patch
6 of 8 patches have a Reviewed-by or Acked-by.
| Patch | Andrey Ryabinin | Charlie Jenkins | Mike Rapoport (Microsoft) | David Hildenbrand (Arm) |
|---|---|---|---|---|
| 1/8 | R-b | |||
| 2/8 | R-b | |||
| 3/8 | R-b T-b | |||
| 4/8 | R-b | R-b T-b | ||
| 5/8 | ||||
| 6/8 | ||||
| 7/8 | R-b | |||
| 8/8 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.
Cover letter [PATCH v3 0/8] treewide: remove unnecessary invalid range checks in memblock iteration loops
The memblock API guarantees that for_each_mem_range() and for_each_mem_pfn_range() never return an invalid range, meaning start is always less than end.
Several memblock callers still have unnecessary invalid range checks in their loop bodies, so remove them.
Patches 1-6 cover for_each_mem_range() callers. memblock never stores a zero-size region, so the range it returns always has start < end. Some callers apply __va() or __phys_to_virt() before comparing, but these keep start < end too, so the check is unreachable.
Patches 7-8 cover for_each_mem_pfn_range() callers. __next_mem_pfn_range() skips any region that contains no whole page, so it only ever returns start_pfn < end_pfn and the check is unnecessary.
For reference, commit 36ca7f4be809 ("arm64: mm: Remove bogus stop condition from map_mem() loop") did a similar cleanup in arm64 map_mem().
All these checks are in different trees, so I split the change into one patch per arch/subsystem. The patches are independent and can be applied separately.
---
Changes from v1 [1]
- Add review-by, tested-by tags from v1
- Add missing simliar patches(5,6) to patch series
- Change base to rppt/for-next
Changes from v2 [2]
- Remove unused local variable and braces
[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
---
Sang-Heon Jeon (8):
arm64: mm: remove unreachable invalid range check in
kasan_init_shadow()
LoongArch: remove unreachable invalid range check in kasan_init()
riscv: remove unreachable invalid range check in
create_linear_mapping_page_table()
riscv: remove unreachable invalid range check in kasan_init()
ARM: remove unreachable invalid range check in kasan_init() powerpc64/kasan: Remove unreachable invalid range check in
kasan_init_phys_region()
mm: remove unnecessary empty range check in
early_calculate_totalpages()
mm/hugetlb: remove unnecessary empty range check in
hugetlb_bootmem_set_nodes()
arch/arm/mm/kasan_init.c | 6 ------ arch/arm64/mm/kasan_init.c | 3 --- arch/loongarch/mm/kasan_init.c | 3 --- arch/powerpc/mm/kasan/init_book3e_64.c | 3 --- arch/powerpc/mm/kasan/init_book3s_64.c | 3 --- arch/riscv/mm/init.c | 2 -- arch/riscv/mm/kasan_init.c | 3 --- mm/hugetlb.c | 7 ++----- mm/mm_init.c | 3 +-- 9 files changed, 3 insertions(+), 30 deletions(-)
Signature · 1 line
2.43.0