linux-stable/drivers/virtio
David Hildenbrand b3d40a2b6d mm: enforce pageblock_order < MAX_ORDER
Some places in the kernel don't really expect pageblock_order >=
MAX_ORDER, and it looks like this is only possible in corner cases:

1) CONFIG_DEFERRED_STRUCT_PAGE_INIT we'll end up freeing pageblock_order
   pages via __free_pages_core(), which cannot possibly work.

2) find_zone_movable_pfns_for_nodes() will roundup the ZONE_MOVABLE
   start PFN to MAX_ORDER_NR_PAGES. Consequently with a bigger
   pageblock_order, we could have a single pageblock partially managed by
   two zones.

3) compaction code runs into __fragmentation_index() with order
   >= MAX_ORDER, when checking WARN_ON_ONCE(order >= MAX_ORDER). [1]

4) mm/page_reporting.c won't be reporting any pages with default
   page_reporting_order == pageblock_order, as we'll be skipping the
   reporting loop inside page_reporting_process_zone().

5) __rmqueue_fallback() will never be able to steal with
   ALLOC_NOFRAGMENT.

pageblock_order >= MAX_ORDER is weird either way: it's a pure
optimization for making alloc_contig_range(), as used for allcoation of
gigantic pages, a little more reliable to succeed.  However, if there is
demand for somewhat reliable allocation of gigantic pages, affected
setups should be using CMA or boottime allocations instead.

So let's make sure that pageblock_order < MAX_ORDER and simplify.

[1] https://lkml.kernel.org/r/87r189a2ks.fsf@linux.ibm.com

Link: https://lkml.kernel.org/r/20220214174132.219303-3-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: John Garry via iommu <iommu@lists.linux-foundation.org>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-03-22 15:57:06 -07:00
..
Kconfig virtio: drop default for virtio-mem 2022-03-06 06:06:50 -05:00
Makefile virtio-pci: introduce legacy device module 2021-11-01 04:30:34 -04:00
virtio.c virtio: document virtio_reset_device 2022-03-04 08:33:22 -05:00
virtio_balloon.c virtio: wrap config->reset calls 2022-01-14 18:50:52 -05:00
virtio_dma_buf.c dma-buf: move dma-buf symbols into the DMA_BUF module namespace 2021-10-25 14:53:08 +02:00
virtio_input.c virtio: wrap config->reset calls 2022-01-14 18:50:52 -05:00
virtio_mem.c mm: enforce pageblock_order < MAX_ORDER 2022-03-22 15:57:06 -07:00
virtio_mmio.c virtio-mmio: Use to_virtio_mmio_device() to simply code 2021-03-14 04:37:35 -04:00
virtio_pci_common.c virtio-pci: harden INTX interrupts 2021-11-01 05:26:48 -04:00
virtio_pci_common.h virtio-pci: harden INTX interrupts 2021-11-01 05:26:48 -04:00
virtio_pci_legacy.c virtio-pci: fix the confusing error message 2022-01-14 18:50:53 -05:00
virtio_pci_legacy_dev.c virtio/virtio_pci_legacy_dev: ensure the correct return value 2022-01-14 18:50:53 -05:00
virtio_pci_modern.c virtio_pci: harden MSI-X interrupts 2021-11-01 05:26:48 -04:00
virtio_pci_modern_dev.c virtio: fix a typo in function "vp_modern_remove" comments. 2022-01-14 18:50:53 -05:00
virtio_ring.c virtio_ring: mark ring unused on error 2022-01-14 18:50:53 -05:00
virtio_vdpa.c vdpa: factor out vdpa_set_features_unlocked for vdpa internal use 2022-03-04 11:56:33 -05:00