The patch titled low performance of lib/sort.c has been removed from the -mm tree. Its filename is low-performance-of-lib-sortc.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ Subject: low performance of lib/sort.c From: keios <keios.cn@xxxxxxxxx> It is a non-standard heap-sort algorithm implementation because the index of child node is wrong . The sort function still outputs right result, but the performance is O( n * ( log(n) + 1 ) ) , about 10% ~ 20% worse than standard algorithm. Signed-off-by: keios <keios.cn@xxxxxxxxx> Acked-by: Matt Mackall <mpm@xxxxxxxxxxx> Acked-by: Zou Nan hai <nanhai.zou@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- lib/sort.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff -puN lib/sort.c~low-performance-of-lib-sortc lib/sort.c --- a/lib/sort.c~low-performance-of-lib-sortc +++ a/lib/sort.c @@ -49,15 +49,15 @@ void sort(void *base, size_t num, size_t void (*swap)(void *, void *, int size)) { /* pre-scale counters for performance */ - int i = (num/2) * size, n = num * size, c, r; + int i = (num/2 - 1) * size, n = num * size, c, r; if (!swap) swap = (size == 4 ? u32_swap : generic_swap); /* heapify */ for ( ; i >= 0; i -= size) { - for (r = i; r * 2 < n; r = c) { - c = r * 2; + for (r = i; r * 2 + size < n; r = c) { + c = r * 2 + size; if (c < n - size && cmp(base + c, base + c + size) < 0) c += size; if (cmp(base + r, base + c) >= 0) @@ -69,8 +69,8 @@ void sort(void *base, size_t num, size_t /* sort */ for (i = n - size; i >= 0; i -= size) { swap(base, base + i, size); - for (r = 0; r * 2 < i; r = c) { - c = r * 2; + for (r = 0; r * 2 + size < i; r = c) { + c = r * 2 + size; if (c < i - size && cmp(base + c, base + c + size) < 0) c += size; if (cmp(base + r, base + c) >= 0) _ Patches currently in -mm which might be from keios.cn@xxxxxxxxx are origin.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html