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:   Sat, 30 Mar 2019 17:16:02 GMT
From:   George Spelvin <lkml@....org>
To:     adrian.hunter@...el.com, ard.biesheuvel@...aro.org,
        benh@...nel.crashing.org, bp@...en8.de, darrick.wong@...cle.com,
        dchinner@...hat.com, dedekind1@...il.com,
        gregkh@...uxfoundation.org, hpa@...or.com, jlbec@...lplan.org,
        jpoimboe@...hat.com, linux-kernel@...r.kernel.org,
        linux-mtd@...ts.infradead.org, linux-snps-arc@...ts.infradead.org,
        linuxppc-dev@...ts.ozlabs.org, lkml@....org, mark@...heh.com,
        mingo@...hat.com, mpe@...erman.id.au,
        naveen.n.rao@...ux.vnet.ibm.com, ocfs2-devel@....oracle.com,
        paulus@...ba.org, richard@....at, sfr@...b.auug.org.au,
        st5pub@...dex.ru, tglx@...utronix.de, vgupta@...opsys.com,
        x86@...nel.org
Cc:     akpm@...ux-foundation.org, amir73il@...il.com,
        andriy.shevchenko@...ux.intel.com, ashish.samant@...cle.com,
        ge.changwei@....com, gustavo@...eddedor.com, jannh@...gle.com,
        jiang.biao2@....com.cn, jiangyiwen@...wei.com, jslaby@...e.cz,
        kamalesh@...ux.vnet.ibm.com, keescook@...omium.org, lchen@...e.com,
        linux@...musvillemoes.dk, malat@...ian.org, mhocko@...e.com,
        npiggin@...il.com, peterz@...radead.org, piaojun@...wei.com,
        rppt@...ux.ibm.com, yamada.masahiro@...ionext.com,
        yuehaibing@...wei.com
Subject: Re: [PATCH 0/5] simple sort swap function usage improvements

Great work; that is indeed a logical follow-on.

Reviewed by: George Spelvin <lkml@....org>

I you feel even more ambitious, you could try impementing Rasmus
Villemoes' idea of having generic *compare* functions.  (It's on
my to-do list, but I haven't made meaningful progress yet, and I'm
happy to pawn it off.)

A significant fraction of the time, the sort key is a 4- or 8-byte
integer field in a structure at a small offset from the base or
list_head.

A function pointer < 4096 could be interpreted as encoding:
- Key size (1 bit)
- Key signedness (1 bit)
- Sort direction (1 bit)
- Offset (9 bits; +/-256 words = +/-1024 bytes, or 0..511 words from start)

With the correct level of preprocessor hackery,
SIMPLE_CMP_ASCENDING(struct type, key_field)
SIMPLE_LIST_CMP_ASCENDING(struct type, list_field, key_field)
SIMPLE_CMP_DESCENDING(struct type, key_field)
SIMPLE_LIST_CMP_DESCENDING(struct type, list_field, key_field)

could encode all that and cause a compile-time error if the key
is the wrong type or the offset is out of range.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ