On Mon, Nov 23, 2020 at 08:44:12PM +0000, Edgecombe, Rick P wrote: > Well, there were two reasons: > 1. Non-standard naming for the PAGE_FOO flags. For example, > PAGE_KERNEL_ROX vs PAGE_KERNEL_READ_EXEC. This could be unified. I > think it's just riscv that breaks the conventions. Others are just > missing some. We need to standardize those anyway. I've done that for a few PAGE_* constants already but as you see there is more work to do. > But I thought that using those pgprot flags was still sort overloading > the meaning of pgprot. My understanding was that it is supposed to hold > the actual bits set in the PTE. For example large pages or TLB hints > (like PAGE_KERNEL_EXEC_CONT) could set or unset extra bits, so asking > for PAGE_KERNEL_EXEC wouldn't necessarily mean "set these bits in all > of the PTEs", it could mean something more like "infer what I want from > these bits and do that". > > x86's cpa will also avoid changing NX if it is not supported, so if the > caller asked for PAGE_KERNEL->PAGE_KERNEL_EXEC in perm_change() it > should not necessarily bother setting all of the PAGE_KERNEL_EXEC bits > in the actual PTEs. Asking for PERM_RW->PERM_RWX on the other hand, > would let the implementation do whatever it needs to set the memory > executable, like set_memory_x() does. It should work either way but > seems like the expectations would be a little clearer with the PERM_ > flags. Ok, maybe that is an argument, and we should use the new flags more broadly. > Could easily wrap this one, but just to clarify, do you mean lines over > 80 chars? There were already some over 80 in vmalloc before the move to > 100 chars, so figured it was ok to stretch out now. CodingStyle still says 80 characters unless you have an exception where a longer line improves the readability. The quoted code absolutely does not fit the definition of an exception or improves readability.