[PATCH v4 4/8] mm: Move immutable fields of 'struct vm_fault' into anonymous struct

Will Deacon will at kernel.org
Thu Jan 21 07:48:25 EST 2021


On Wed, Jan 20, 2021 at 10:13:37AM -0800, Nick Desaulniers wrote:
> On Wed, Jan 20, 2021 at 9:36 AM Will Deacon <will at kernel.org> wrote:
> >
> > 'struct vm_fault' contains both information about the fault being
> > serviced alongside mutable fields contributing to the state of the
> > fault-handling logic. Unfortunately, the distinction between the two is
> > not clear-cut, and a number of callers end up manipulating the structure
> > temporarily before restoring it when returning.
> >
> > Try to clean this up by moving the immutable fault information into an
> > anonymous struct, which will later be marked as 'const'. GCC will then
> > complain (with an error) about modification of these fields after they
> > have been initialised, although LLVM currently allows them without even
> > a warning:
> >
> > https://bugs.llvm.org/show_bug.cgi?id=48755
> 
> I think this paragraph+link would be better on patch 8/8.

Agreed, I'll move it.

Will



More information about the linux-arm-kernel mailing list