lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 23 May 2019 10:14:49 +0200
From:   Boris Brezillon <boris.brezillon@...labora.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
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

Hi Andrew,

On Wed, 22 May 2019 11:33:15 -0700
Andrew Morton <akpm@...ux-foundation.org> wrote:

> 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 ;)

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@...ux-foundation.org>

Thanks for your review.

Boris

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ