android_kernel_motorola_sm6225/net/sunrpc/auth_gss
Alexey Dobriyan 81243eacfa cred: simpler, 1D supplementary groups
Current supplementary groups code can massively overallocate memory and
is implemented in a way so that access to individual gid is done via 2D
array.

If number of gids is <= 32, memory allocation is more or less tolerable
(140/148 bytes).  But if it is not, code allocates full page (!)
regardless and, what's even more fun, doesn't reuse small 32-entry
array.

2D array means dependent shifts, loads and LEAs without possibility to
optimize them (gid is never known at compile time).

All of the above is unnecessary.  Switch to the usual
trailing-zero-len-array scheme.  Memory is allocated with
kmalloc/vmalloc() and only as much as needed.  Accesses become simpler
(LEA 8(gi,idx,4) or even without displacement).

Maximum number of gids is 65536 which translates to 256KB+8 bytes.  I
think kernel can handle such allocation.

On my usual desktop system with whole 9 (nine) aux groups, struct
group_info shrinks from 148 bytes to 44 bytes, yay!

Nice side effects:

 - "gi->gid[i]" is shorter than "GROUP_AT(gi, i)", less typing,

 - fix little mess in net/ipv4/ping.c
   should have been using GROUP_AT macro but this point becomes moot,

 - aux group allocation is persistent and should be accounted as such.

Link: http://lkml.kernel.org/r/20160817201927.GA2096@p183.telecom.by
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Vasily Kulikov <segoon@openwall.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-10-07 18:46:30 -07:00
..
auth_gss.c SUNRPC: allow for upcalls for same uid but different gss service 2016-08-05 11:29:59 -04:00
gss_generic_token.c sunrpc: eliminate RPC_DEBUG 2014-11-24 17:31:46 -05:00
gss_krb5_crypto.c Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2016-04-14 18:15:40 -07:00
gss_krb5_keys.c sunrpc: Use skcipher and ahash/shash 2016-01-27 20:36:01 +08:00
gss_krb5_mech.c xprtrdma: No direct data placement with krb5i and krb5p 2016-07-11 15:50:43 -04:00
gss_krb5_seal.c sunrpc: eliminate RPC_DEBUG 2014-11-24 17:31:46 -05:00
gss_krb5_seqnum.c sunrpc: Use skcipher and ahash/shash 2016-01-27 20:36:01 +08:00
gss_krb5_unseal.c sunrpc: eliminate RPC_DEBUG 2014-11-24 17:31:46 -05:00
gss_krb5_wrap.c mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
gss_mech_switch.c xprtrdma: No direct data placement with krb5i and krb5p 2016-07-11 15:50:43 -04:00
gss_rpc_upcall.c nfsd4: fix gss-proxy 4.1 mounts for some AD principals 2015-11-24 11:36:31 -07:00
gss_rpc_upcall.h Merge branch 'nfs-for-next' of git://linux-nfs.org/~trondmy/nfs-2.6 into for-3.10 2013-04-29 16:23:34 -04:00
gss_rpc_xdr.c cred: simpler, 1D supplementary groups 2016-10-07 18:46:30 -07:00
gss_rpc_xdr.h sunrpc: eliminate RPC_DEBUG 2014-11-24 17:31:46 -05:00
Makefile SUNRPC: Add RPC based upcall mechanism for RPCGSS auth 2013-04-26 11:41:27 -04:00
svcauth_gss.c cred: simpler, 1D supplementary groups 2016-10-07 18:46:30 -07:00