[PATCH 0/2] lib/sort: Clean up sort_nonatomic() and sort_r_nonatomic()

From: Kuan-Wei Chiu

Date: Thu Jul 30 2026 - 14:40:55 EST


Remove the sort_nonatomic() and sort_r_nonatomic() APIs from the kernel
library.

Currently, the arm-smmu-v3 driver is the sole in-tree user of
sort_nonatomic(). Because the array size being sorted is small in
practice, there is no real risk of triggering a soft lockup. Therefore,
the periodic cond_resched() calls provided by the _nonatomic variant
are unnecessary.

With the only in-tree user updated, the _nonatomic APIs are no longer
needed anywhere in the kernel. Removing them effectively drops the
wrapper function and eliminates the may_schedule branch from the
innermost loop of the core sorting logic, slightly simplifying the code.

Kuan-Wei Chiu (2):
iommu/arm-smmu-v3: Replace sort_nonatomic() with sort()
Revert "lib/sort.c: add _nonatomic() variants with cond_resched()"

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 6 +-
include/linux/sort.h | 11 --
lib/sort.c | 110 ++++++--------------
3 files changed, 34 insertions(+), 93 deletions(-)

--
2.55.0.508.g3f0d502094-goog