From: Boris Brezillon <boris.brezillon@collabora.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, George Spelvin <lkml@sdf.org>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Andrey Abramov <st5pub@yandex.ru>,
kernel@collabora.com
Subject: Re: [PATCH] lib/sort: Add the sort_r() variant
Date: Thu, 23 May 2019 10:14:49 +0200 [thread overview]
Message-ID: <20190523101449.7ad35f46@collabora.com> (raw)
In-Reply-To: <20190522113315.08484a3942ec07793b7d6112@linux-foundation.org>
Hi Andrew,
On Wed, 22 May 2019 11:33:15 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Wed, 22 May 2019 13:25:50 +0200 Boris Brezillon <boris.brezillon@collabora.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@collabora.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 ;)
Will do.
>
> > 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@linux-foundation.org>
Thanks for your review.
Boris
next prev parent reply other threads:[~2019-05-23 8:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-22 11:25 [PATCH] lib/sort: Add the sort_r() variant Boris Brezillon
2019-05-22 18:33 ` Andrew Morton
2019-05-23 8:14 ` Boris Brezillon [this message]
2019-05-23 20:04 ` Rasmus Villemoes
2019-05-24 15:09 ` Boris Brezillon
2019-06-17 13:51 ` Boris Brezillon
2019-06-17 21:14 ` [PATCH] lib/sort.c: implement sort() variant taking context argument Rasmus Villemoes
2019-06-18 8:40 ` Boris Brezillon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190523101449.7ad35f46@collabora.com \
--to=boris.brezillon@collabora.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=lkml@sdf.org \
--cc=st5pub@yandex.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox