lkml.org 
[lkml]   [2022]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC V1 01/31] mm/debug_vm_pgtable: Directly use vm_get_page_prot()
> +	 *
> + * Protection based vm_flags combinatins are always linear
> + * and increasing i.e VM_NONE ..[VM_SHARED|READ|WRITE|EXEC].
> */
> - for (idx = 0; idx < ARRAY_SIZE(protection_map); idx++) {
> + for (i = VM_NONE; i <= (VM_SHARED | VM_READ | VM_WRITE | VM_EXEC); ix++) {
> pte_basic_tests(&args, idx);
> pmd_basic_tests(&args, idx);
> pud_basic_tests(&args, idx);

This looks rather convoluted. I'd prefer to add a helper for the body
of this loop, and then explicitly call it for all the valid
combinations. Right now all are valid, so this dosn't change a thing
except for generating larger code due to the explicit loop unrolling,
but I think it is much easier to follow and maintain.

\
 
 \ /
  Last update: 2022-01-26 08:16    [W:0.478 / U:0.436 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site