From: Linus Torvalds torvalds@linux-foundation.org Date: Fri, 11 Apr 2014 11:11:33 -0700
And quite frankly, using the "vma->vm_flags" sounds potentially *incorrect* to me, since it really isn't about the vma. If you change a page through a non-executable vma, you'd want to flush the icache entry for that page mapped in a totally different vma. So I really get the feeling that passing in "vma" is actively *wrong*. The vma interface really makes little to no sense.
Hmm?
The vm_flags check is about "could it have gotten into the I-cache via this VMA".
If the VMA protections change, we'd do a flush of some sort during that change.