linux/arch/s390/kernel
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
..
vdso32 s390: enable UBSAN 2016-09-20 14:26:23 +02:00
vdso64 s390: enable UBSAN 2016-09-20 14:26:23 +02:00
.gitignore
als.c s390/als: print missing facilities on facility mismatch 2016-07-31 05:27:59 -04:00
asm-offsets.c KVM: s390: write external damage code on machine checks 2016-09-08 09:07:52 +02:00
audit.c
audit.h
base.S s390/kdump: fix nosmt kernel parameter 2015-06-25 09:39:26 +02:00
cache.c s390/cpuinfo: show dynamic and static cpu mhz 2016-06-13 15:58:17 +02:00
compat_audit.c
compat_linux.c cred: simpler, 1D supplementary groups 2016-10-07 18:46:30 -07:00
compat_linux.h s390: add support for vector extension 2014-10-09 09:14:13 +02:00
compat_ptrace.h
compat_signal.c s390/compat: correct restore of high gprs on signal return 2016-02-22 09:29:35 +01:00
compat_wrapper.c s390: wire up copy_file_range syscall 2016-01-19 12:14:02 +01:00
cpcmd.c s390: Use pr_warn instead of pr_warning 2016-03-07 13:12:04 +01:00
crash_dump.c s390/crashdump: use list_first_entry_or_null 2016-09-20 14:26:04 +02:00
debug.c s390: Use pr_warn instead of pr_warning 2016-03-07 13:12:04 +01:00
diag.c - ARM: GICv3 ITS emulation and various fixes. Removal of the old 2016-08-02 16:11:27 -04:00
dis.c s390: remove math emulation code 2016-06-15 16:37:11 +02:00
dumpstack.c s390: stack address vs thread_info 2016-06-28 09:33:00 +02:00
early.c s390: migrate exception table users off module.h and onto extable.h 2016-09-20 14:26:38 +02:00
ebcdic.c s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
entry.h s390/als: convert architecture level set code to C 2016-07-31 05:27:58 -04:00
entry.S s390: have unique symbol for __switch_to address 2016-07-04 09:25:22 +02:00
fpu.c s390/fpu: improve kernel_fpu_[begin|end] 2016-08-29 11:05:01 +02:00
ftrace.c ftrace: Add return address pointer to ftrace_ret_stack 2016-08-24 12:15:14 +02:00
head_kdump.S s390: remove 31 bit support 2015-03-25 11:49:33 +01:00
head.S s390: clarify compressed image code path 2016-08-08 15:41:31 +02:00
head64.S s390/cpumf: Fix lpp detection 2016-03-08 10:38:06 +01:00
idle.c s390/idle: convert open coded idle time seqcount 2014-12-08 09:42:32 +01:00
ipl.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2016-07-26 12:22:51 -07:00
irq.c s390: use SPARSE_IRQ 2016-06-13 15:58:24 +02:00
jump_label.c Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-09-03 15:46:07 -07:00
kprobes.c s390: migrate exception table users off module.h and onto extable.h 2016-09-20 14:26:38 +02:00
lgr.c s390/sysinfo,stsi: change return code handling 2012-09-26 15:45:12 +02:00
machine_kexec.c s390/kexec: fix crash on resize of reserved memory 2016-06-13 15:58:19 +02:00
Makefile s390: enable UBSAN 2016-09-20 14:26:23 +02:00
mcount.S s390/ftrace: hotpatch support for function tracing 2015-01-29 09:19:25 +01:00
module.c module: s390: keep mod_arch_specific for livepatch modules 2016-04-01 15:00:11 +02:00
nmi.c s390/nmi: improve revalidation of fpu / vector registers 2016-08-29 11:05:03 +02:00
os_info.c s390/dump: streamline oldmem copy functions 2015-11-27 09:24:12 +01:00
perf_cpum_cf_events.c s390/cpum_cf: Export event names in sysfs 2013-12-16 14:37:50 +01:00
perf_cpum_cf.c s390/perf: Convert the hotplug notifier to state machine callbacks (Counter) 2016-07-14 09:34:37 +02:00
perf_cpum_sf.c Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-29 13:55:30 -07:00
perf_event.c s390/perf: remove perf_release/reserver_sampling functions 2016-06-28 09:32:25 +02:00
pgm_check.S s390: remove 31 bit support 2015-03-25 11:49:33 +01:00
process.c exit_thread: accept a task parameter to be exited 2016-05-20 17:58:30 -07:00
processor.c s390/cpuinfo: show maximum thread id 2016-07-04 09:25:20 +02:00
ptrace.c Merge branch 'stable-4.8' of git://git.infradead.org/users/pcmoore/audit 2016-07-29 17:54:17 -07:00
reipl.S s390/dump: rework CPU register dump code 2015-11-27 09:24:14 +01:00
relocate_kernel.S s390: remove "64" suffix from a couple of files 2015-03-25 11:49:34 +01:00
runtime_instr.c s390: remove runtime instrumentation interrupts 2015-11-03 14:40:51 +01:00
s390_ksyms.c s390/fpu: split fpu-internal.h into fpu internals, api, and type headers 2015-10-16 09:41:12 +02:00
sclp.c s390/sclp: move uninitialized data to data section 2016-07-31 05:27:58 -04:00
setup.c treewide: replace config_enabled() with IS_ENABLED() (2nd round) 2016-08-26 17:39:35 -07:00
signal.c s390: remove all usages of PSW_ADDR_AMODE 2016-01-19 12:14:02 +01:00
smp.c s390/smp: clean up a condition 2016-07-18 10:17:23 +02:00
stacktrace.c s390/dumpstack: merge all four stack tracers 2016-02-23 08:56:20 +01:00
suspend.c PCI: Include <linux/pci.h>, not <asm/pci.h> 2015-06-08 07:55:03 -05:00
swsusp.S s390/hibernate: fix save and restore of vector registers 2015-09-17 13:43:41 +02:00
sys_s390.c s390: remove 31 bit support 2015-03-25 11:49:33 +01:00
syscalls.S s390: wire up preadv2/pwritev2 syscalls 2016-04-01 08:42:38 +02:00
sysinfo.c s390/fpu: improve kernel_fpu_[begin|end] 2016-08-29 11:05:01 +02:00
time.c s390/time: avoid races when updating tb_update_count 2016-08-29 11:04:58 +02:00
topology.c s390/topology: remove z10 special handling 2016-06-13 15:58:27 +02:00
trace.c s390/diag: avoid lockdep recursion 2016-02-11 13:05:56 +01:00
traps.c s390: migrate exception table users off module.h and onto extable.h 2016-09-20 14:26:38 +02:00
uprobes.c s390/uprobes: fix address space annotation 2015-03-25 11:49:47 +01:00
vdso.c vdso: make arch_setup_additional_pages wait for mmap_sem for write killable 2016-05-23 17:04:14 -07:00
vmlinux.lds.S nmi_backtrace: generate one-line reports for idle cpus 2016-10-07 18:46:30 -07:00
vtime.c s390: add missing declarations 2016-05-10 13:24:51 +02:00