Re: [PATCH 1/4] arch: consolidate existing CONFIG_PAGE_SIZE_*KB definitions

From: Arnd Bergmann
Date: Tue Feb 27 2024 - 10:41:10 EST


On Mon, Feb 26, 2024, at 17:55, Samuel Holland wrote:
> On 2024-02-26 10:14 AM, Arnd Bergmann wrote:
>>
>> +config HAVE_PAGE_SIZE_4KB
>> + bool
>> +
>> +config HAVE_PAGE_SIZE_8KB
>> + bool
>> +
>> +config HAVE_PAGE_SIZE_16KB
>> + bool
>> +
>> +config HAVE_PAGE_SIZE_32KB
>> + bool
>> +
>> +config HAVE_PAGE_SIZE_64KB
>> + bool
>> +
>> +config HAVE_PAGE_SIZE_256KB
>> + bool
>> +
>> +choice
>> + prompt "MMU page size"
>
> Should this have some generic help text (at least a warning about
> compatibility)?

Good point. I've added some of this now, based on the mips
text with some generalizations for other architectures:

config PAGE_SIZE_4KB
bool "4KiB pages"
depends on HAVE_PAGE_SIZE_4KB
help
This option select the standard 4KiB Linux page size and the only
available option on many architectures. Using 4KiB page size will
minimize memory consumption and is therefore recommended for low
memory systems.
Some software that is written for x86 systems makes incorrect
assumptions about the page size and only runs on 4KiB pages.

config PAGE_SIZE_8KB
bool "8KiB pages"
depends on HAVE_PAGE_SIZE_8KB
help
This option is the only supported page size on a few older
processors, and can be slightly faster than 4KiB pages.

config PAGE_SIZE_16KB
bool "16KiB pages"
depends on HAVE_PAGE_SIZE_16KB
help
This option is usually a good compromise between memory
consumption and performance for typical desktop and server
workloads, often saving a level of page table lookups compared
to 4KB pages as well as reducing TLB pressure and overhead of
per-page operations in the kernel at the expense of a larger
page cache.

config PAGE_SIZE_32KB
bool "32KiB pages"
depends on HAVE_PAGE_SIZE_32KB
Using 32KiB page size will result in slightly higher performance
kernel at the price of higher memory consumption compared to
16KiB pages. This option is available only on cnMIPS cores.
Note that you will need a suitable Linux distribution to
support this.

config PAGE_SIZE_64KB
bool "64KiB pages"
depends on HAVE_PAGE_SIZE_64KB
Using 64KiB page size will result in slightly higher performance
kernel at the price of much higher memory consumption compared to
4KiB or 16KiB pages.
This is not suitable for general-purpose workloads but the
better performance may be worth the cost for certain types of
supercomputing or database applications that work mostly with
large in-memory data rather than small files.

config PAGE_SIZE_256KB
bool "256KiB pages"
depends on HAVE_PAGE_SIZE_256KB
help
256KB pages have little practical value due to their extreme
memory usage.

>> diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
>> index a880ee067d2e..aac46ee1a000 100644
>> --- a/arch/hexagon/Kconfig
>> +++ b/arch/hexagon/Kconfig
>> @@ -8,6 +8,11 @@ config HEXAGON
>> select ARCH_HAS_SYNC_DMA_FOR_DEVICE
>> select ARCH_NO_PREEMPT
>> select DMA_GLOBAL_POOL
>> + select FRAME_POINTER
>
> Looks like a paste error.
>

Fixed, thanks! I think that happened during a rebase.

>> #ifdef CONFIG_PAGE_SIZE_1MB
>> -#define PAGE_SHIFT 20
>> #define HEXAGON_L1_PTE_SIZE __HVM_PDE_S_1MB
>> #endif
>
> The corresponding Kconfig option does not exist (and did not exist before this
> patch).

Yes, I noticed that as well. It's clearly harmless.

Arnd