linux/drivers
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
..
accessibility
acpi nmi_backtrace: generate one-line reports for idle cpus 2016-10-07 18:46:30 -07:00
amba
android
ata pata_ninja32: Avoid corrupting status flags 2016-08-30 11:59:47 -04:00
atm atm: iphase: fix newline escape and minor tweak to source formatting 2016-09-15 19:15:55 -04:00
auxdisplay
base memory-hotplug: fix store_mem_state() return value 2016-10-07 18:46:28 -07:00
bcma bcma: use of_dma_configure() to set initial dma mask 2016-09-09 12:00:37 +03:00
block
bluetooth Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2016-10-05 10:11:24 -07:00
bus Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-10-03 19:43:08 -07:00
cdrom
char Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security 2016-10-04 14:48:27 -07:00
clk CLK: Add Loongson1C clock support 2016-09-23 14:49:21 -07:00
clocksource Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-10-03 18:09:13 -07:00
connector
cpufreq Merge branch 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm 2016-10-06 07:59:37 -07:00
cpuidle nmi_backtrace: generate one-line reports for idle cpus 2016-10-07 18:46:30 -07:00
crypto chcr/cxgb4i/cxgbit/RDMA/cxgb4: Allocate resources dynamically for all cxgb4 ULD's 2016-09-19 01:37:32 -04:00
dax dax: fix mapping size check 2016-09-03 10:40:57 -07:00
dca
devfreq PM / devfreq: rk3399_dmc: Remove explictly regulator_put call in .remove 2016-09-19 13:36:20 +02:00
dio
dma dmaengine updates for 4.8-rc1 2016-10-06 17:13:54 -07:00
dma-buf
edac * Altera Arria10 enablement of NAND, DMA, USB, QSPI and SD-MMC FIFO 2016-10-04 12:06:26 -07:00
eisa
extcon Merge branch 'next' into resolution 2016-09-15 16:45:20 +05:30
firewire
firmware Fix bug in module unloading. 2016-10-06 15:16:16 -07:00
fmc
fpga fpga manager: Add hardware dependency to Zynq driver 2016-09-08 17:31:44 +02:00
gpio Merge branch 'i2c/for-4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2016-10-07 14:12:21 -07:00
gpu Merge branch 'i2c/for-4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2016-10-07 14:12:21 -07:00
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid 2016-10-07 11:58:38 -07:00
hsi
hv Drivers: hv: get rid of id in struct vmbus_channel 2016-09-27 12:35:49 +02:00
hwmon hwmon updates for v4.9 2016-10-04 10:56:14 -07:00
hwspinlock
hwtracing coresight: tmc: mark symbols static where possible 2016-09-09 13:53:00 +02:00
i2c Merge branch 'i2c/for-4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2016-10-07 14:12:21 -07:00
ide
idle nmi_backtrace: generate one-line reports for idle cpus 2016-10-07 18:46:30 -07:00
iio Staging/IIO patches for 4.9-rc1 2016-10-05 14:50:51 -07:00
infiniband Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2016-10-05 10:11:24 -07:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2016-10-07 09:12:19 -07:00
iommu KVM updates for v4.9-rc1 2016-10-06 10:49:01 -07:00
ipack
irqchip irqchip core changes for v4.9 2016-09-22 22:49:52 +02:00
isdn mISDN: mark symbols static where possible 2016-09-01 23:36:17 -07:00
leds leds: triggers: Check return value of kobject_uevent_env() 2016-09-20 10:22:10 +02:00
lguest
lightnvm miscdevice: Use module_misc_device() macro 2016-08-31 14:12:35 +02:00
macintosh
mailbox Merge branch 'mailbox-for-next' of git://git.linaro.org/landing-teams/working/fujitsu/integration 2016-10-06 17:36:53 -07:00
mcb mcb: Add a dma_device to mcb_device 2016-09-27 12:33:47 +02:00
md Merge tag 'md/4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shli/md 2016-10-07 09:45:43 -07:00
media USB/PHY/EXTCON patches for 4.9-rc1 2016-10-03 20:17:35 -07:00
memory Char/Misc driver update for 4.9-rc1 2016-10-03 19:57:49 -07:00
memstick
message scsi: fusion: Fix error return code in mptfc_probe() 2016-09-14 14:26:19 -04:00
mfd - Core Frameworks 2016-10-07 08:35:35 -07:00
misc Merge branch 'i2c/for-4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2016-10-07 14:12:21 -07:00
mmc USB/PHY/EXTCON patches for 4.9-rc1 2016-10-03 20:17:35 -07:00
mtd Another round of MTD fixes for v4.8 2016-09-28 12:53:08 -07:00
net phy: micrel.c: Enable ksz9031 energy-detect power-down mode 2016-10-05 21:19:06 -04:00
nfc
ntb
nubus
nvdimm libnvdimm, region: fix flush hint table thinko 2016-09-24 11:45:38 -07:00
nvme nvme-rdma: only clear queue flags after successful connect 2016-09-22 19:58:17 -06:00
nvmem nvmem: rockchip-efuse: add rk3399-efuse support 2016-09-02 17:22:51 +02:00
of DeviceTree updates for 4.9: 2016-10-05 11:56:38 -07:00
oprofile oprofile/timer: Convert to hotplug state machine 2016-09-19 21:44:28 +02:00
parisc
parport
pci PCI changes for the v4.9 merge window: 2016-10-07 11:46:37 -07:00
pcmcia pcmcia: lubbock: fix sockets configuration 2016-09-12 10:57:01 +01:00
perf Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-10-03 19:43:08 -07:00
phy phy-twl4030-usb: initialize charging-related stuff via pm_runtime 2016-09-14 10:59:12 +05:30
pinctrl This is the bulk of GPIO changes for the v4.9 series: 2016-10-05 11:49:09 -07:00
platform - Core Frameworks 2016-10-07 08:35:35 -07:00
pnp
power power supply and reset changes for the v4.9 series 2016-10-06 18:21:15 -07:00
powercap x86/cpu: Rename Merrifield2 to Moorefield 2016-09-08 08:13:08 +02:00
pps
ps3
ptp ptp: Fix resource leak in case of error 2016-10-03 21:54:10 -04:00
pwm
rapidio rapidio/rio_cm: avoid GFP_KERNEL in atomic context 2016-09-19 15:36:17 -07:00
ras
regulator - Core Frameworks 2016-10-07 08:35:35 -07:00
remoteproc rpmsg updates for v4.9 2016-10-06 17:03:49 -07:00
reset
rpmsg rpmsg: smd: fix dependency on QCOM_SMD=n 2016-09-12 07:05:13 -07:00
rtc Merge branches 'ib-mfd-gpio-4.9', 'ib-mfd-gpio-regulator-4.9', 'ib-mfd-input-4.9', 'ib-mfd-regulator-4.9', 'ib-mfd-regulator-4.9.1', 'ib-mfd-regulator-rtc-4.9', 'ib-mfd-regulator-rtc-4.9-1' and 'ib-mfd-rtc-4.9' into ibs-for-mfd-merged 2016-10-04 15:47:01 +01:00
s390 SCSI misc on 20161006 2016-10-07 09:28:53 -07:00
sbus
scsi SCSI misc on 20161006 2016-10-07 09:28:53 -07:00
sfi
sh
sn
soc ARM: EXYNOS: Remove calls to of_genpd_get_from_provider() 2016-09-13 02:49:33 +02:00
spi Merge remote-tracking branches 'spi/topic/ti-qspi', 'spi/topic/tools', 'spi/topic/txx9' and 'spi/topic/xlp' into spi-next 2016-09-30 09:14:22 -07:00
spmi spmi: pmic-arb: Return an error code if sanity check fails 2016-09-27 12:43:34 +02:00
ssb
staging cred: simpler, 1D supplementary groups 2016-10-07 18:46:30 -07:00
target chcr/cxgb4i/cxgbit/RDMA/cxgb4: Allocate resources dynamically for all cxgb4 ULD's 2016-09-19 01:37:32 -04:00
tc
thermal thermal: rcar_thermal: Fix priv->zone error handling 2016-09-06 20:46:06 +08:00
thunderbolt thunderbolt: Don't declare Falcon Ridge unsupported 2016-08-31 13:25:02 +02:00
tty TTY/Serial patches for 4.9-rc1 2016-10-03 20:11:49 -07:00
uio uio: fix dmem_region_start computation 2016-08-31 13:07:30 +02:00
usb Revert "usbtmc: convert to devm_kzalloc" 2016-09-28 11:51:30 +02:00
uwb
vfio vfio_pci: use pci_alloc_irq_vectors 2016-09-29 13:36:38 -06:00
vhost Merge 4.8-rc5 into char-misc-next 2016-09-05 08:04:07 +02:00
video backlight: pwm_bl: Handle gpio that can sleep 2016-10-06 09:27:26 +01:00
virt
virtio virtio: mark vring_dma_dev() static 2016-09-09 21:12:35 +03:00
vlynq
vme vme: fake: remove unexpected unlock in fake_master_set() 2016-09-27 12:43:35 +02:00
w1 w1: fix timeout_us parameter description 2016-08-31 13:56:05 +02:00
watchdog USB/PHY/EXTCON patches for 4.9-rc1 2016-10-03 20:17:35 -07:00
xen xen: features and fixes for 4.9-rc0 2016-10-06 11:19:10 -07:00
zorro
Kconfig
Makefile clk: probe common clock drivers earlier 2016-09-23 13:00:04 +02:00