On 28.11.2020 13:12, Konstantin Belousov wrote:
Author: kib
Date: Sat Nov 28 12:12:51 2020
New Revision: 368124
URL: https://svnweb.freebsd.org/changeset/base/368124
Log:
Make MAXPHYS tunable. Bump MAXPHYS to 1M.
Unfortunately, bumping MAXPHYS broke arm kernel. The kernel runs out of
KVA while running 'pbuf' keg init function. This causes that
keg_alloc_slab() always returns NULL and for cycle in uma_prealloc()
newer ends (whish should be considered as another bug).
Do you think that MAXPHYS constant can depends on given arch?
128k (or 256k) sounds reasonable for arm32 systems...
Michal
Replace MAXPHYS by runtime variable maxphys. It is initialized from
MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys.
Make b_pages[] array in struct buf flexible. Size b_pages[] for buffer
cache buffers exactly to atop(maxbcachebuf) (currently it is sized to
atop(MAXPHYS)), and b_pages[] for pbufs is sized to atop(maxphys) + 1.
The +1 for pbufs allow several pbuf consumers, among them vmapbuf(),
to use unaligned buffers still sized to maxphys, esp. when such
buffers come from userspace (*). Overall, we save significant amount
of otherwise wasted memory in b_pages[] for buffer cache buffers,
while bumping MAXPHYS to desired high value.
Eliminate all direct uses of the MAXPHYS constant in kernel and driver
sources, except a place which initialize maxphys. Some random (and
arguably weird) uses of MAXPHYS, e.g. in linuxolator, are converted
straight. Some drivers, which use MAXPHYS to size embeded structures,
get private MAXPHYS-like constant; their convertion is out of scope
for this work.
Changes to cam/, dev/ahci, dev/ata, dev/mpr, dev/mpt, dev/mvs,
dev/siis, where either submitted by, or based on changes by mav.
Suggested by: mav (*)
Reviewed by: imp, mav, imp, mckusick, scottl (intermediate versions)
Tested by: pho
Sponsored by:The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D27225
Modified:
head/sys/cam/ata/ata_da.c
head/sys/cam/cam_compat.c
head/sys/cam/cam_periph.c
head/sys/cam/cam_xpt.c
head/sys/cam/ctl/ctl_backend_block.c
head/sys/cam/mmc/mmc_da.c
head/sys/cam/nvme/nvme_da.c
head/sys/cam/scsi/scsi_cd.c
head/sys/cam/scsi/scsi_da.c
head/sys/cam/scsi/scsi_pass.c
head/sys/cam/scsi/scsi_sa.c
head/sys/cam/scsi/scsi_sg.c
head/sys/cam/scsi/scsi_target.c
head/sys/compat/linprocfs/linprocfs.c
head/sys/compat/linux/linux_ioctl.c
head/sys/conf/options
head/sys/contrib/openzfs/module/os/freebsd/zfs/vdev_geom.c
head/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c
head/sys/dev/ahci/ahci.c
head/sys/dev/ahci/ahci.h
head/sys/dev/ahci/ahciem.c
head/sys/dev/ata/ata-all.c
head/sys/dev/ata/ata-all.h
head/sys/dev/ata/ata-dma.c
head/sys/dev/firewire/sbp.c
head/sys/dev/flash/cqspi.c
head/sys/dev/isci/scil/sci_controller_constants.h
head/sys/dev/iscsi/iscsi.c
head/sys/dev/md/md.c
head/sys/dev/mfi/mfi.c
head/sys/dev/mpr/mpr.c
head/sys/dev/mps/mps.c
head/sys/dev/mpt/mpt.c
head/sys/dev/mpt/mpt.h
head/sys/dev/mrsas/mrsas.c
head/sys/dev/mvs/mvs.c
head/sys/dev/mvs/mvs.h
head/sys/dev/nvme/nvme.h
head/sys/dev/nvme/nvme_ctrlr.c
head/sys/dev/pms/freebsd/driver/ini/src/agdef.h
head/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c
head/sys/dev/sdhci/sdhci.c
head/sys/dev/siis/siis.c
head/sys/dev/siis/siis.h
head/sys/dev/sym/sym_conf.h
head/sys/dev/usb/storage/umass.c
head/sys/dev/virtio/block/virtio_blk.c
head/sys/dev/virtio/scsi/virtio_scsi.c
head/sys/dev/xen/blkback/blkback.c
head/sys/dev/xen/blkfront/blkfront.c
head/sys/fs/cd9660/cd9660_vfsops.c
head/sys/fs/ext2fs/ext2_vfsops.c
head/sys/fs/fuse/fuse_vfsops.c
head/sys/fs/msdosfs/msdosfs_vfsops.c
head/sys/fs/udf/udf_vfsops.c
head/sys/geom/cache/g_cache.c
head/sys/geom/eli/g_eli_integrity.c
head/sys/geom/geom_dev.c
head/sys/geom/geom_io.c
head/sys/geom/journal/g_journal.c
head/sys/geom/journal/g_journal.h
head/sys/geom/mirror/g_mirror.c
head/sys/geom/nop/g_nop.c
head/sys/geom/part/g_part_apm.c
head/sys/geom/part/g_part_gpt.c
head/sys/geom/part/g_part_ldm.c
head/sys/geom/raid/md_ddf.c
head/sys/geom/raid/md_promise.c
head/sys/geom/raid3/g_raid3.c
head/sys/geom/shsec/g_shsec.c
head/sys/geom/stripe/g_stripe.c
head/sys/geom/uzip/g_uzip.c
head/sys/geom/vinum/geom_vinum_var.h
head/sys/geom/virstor/g_virstor.c
head/sys/geom/virstor/g_virstor.h
head/sys/kern/kern_mib.c
head/sys/kern/kern_physio.c
head/sys/kern/kern_sendfile.c
head/sys/kern/subr_param.c
head/sys/kern/vfs_aio.c
head/sys/kern/vfs_bio.c
head/sys/kern/vfs_cluster.c
head/sys/kern/vfs_default.c
head/sys/mips/ingenic/jz4780_mmc.c
head/sys/net/if.c
head/sys/powerpc/mambo/mambo_disk.c
head/sys/powerpc/mpc85xx/fsl_sata.c
head/