[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190522113315.08484a3942ec07793b7d6112@linux-foundation.org>
Date: Wed, 22 May 2019 11:33:15 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Boris Brezillon <boris.brezillon@...labora.com>
Cc: linux-kernel@...r.kernel.org, George Spelvin <lkml@....org>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Andrey Abramov <st5pub@...dex.ru>, kernel@...labora.com
Subject: Re: [PATCH] lib/sort: Add the sort_r() variant
On Wed, 22 May 2019 13:25:50 +0200 Boris Brezillon <boris.brezillon@...labora.com> wrote:
> Some users might need extra context to compare 2 elements. This patch
> adds the sort_r() which is similar to the qsort_r() variant of qsort().
>
> Signed-off-by: Boris Brezillon <boris.brezillon@...labora.com>
> ---
> Hello,
>
> A few more details about this patch.
>
> Even though I post it as a standalone patch, I do intend to use it in
> a real driver (v4l2 driver), just didn't want to have it burried in a
> huge patch series.
>
> Note that sort() and sort_r() are now implemented as wrappers around
> do_sort() so that most of the code can be shared. I initially went for
> a solution that implemented sort() as a wrapper around sort_r() (which
> basically contained the do_sort() logic without the cmp_func arg)
> but realized this was adding one extra indirect call (the compare func
> wrapper), which I know are being chased.
Please move the above text into the changelog. It's probably useful
and we can afford the disk space ;)
> There's another option, but I'm pretty sure other people already
> considered it and thought it was not a good idea as it would make
> the code size grow: move the code to sort.h as inline funcs/macros so
> that the compiler can optimize things out and replace the indirect
> cmp_func() calls by direct ones. I just tried it, and it makes my .o
> file grow by 576 bytes, given that we currently have 122 users of
> this function, that makes the kernel code grow by ~70k (that's kind
> of a max estimate since not all users will be compiled in).
eep, let's not do that.
> --- a/include/linux/sort.h
> +++ b/include/linux/sort.h
Patch otherwise looks OK. Please include it with the patch series
which uses it. Feel free to add
Acked-by: Andrew Morton <akpm@...ux-foundation.org>
Powered by blists - more mailing lists