Re: [PATCH 00/10] mm: make mm->flags a bitmap and 64-bit on all arches

SeongJae Park
2025-08-13T16:24:47Z

On Wed, 13 Aug 2025 05:18:31 +0100 Lorenzo Stoakes <lorenzo.stoakes@oracle.com> wrote:

> On Tue, Aug 12, 2025 at 01:13:26PM -0700, SeongJae Park wrote:
> > On Tue, 12 Aug 2025 16:44:09 +0100 Lorenzo Stoakes <lorenzo.stoakes@oracle.com> wrote:
[...]
> > > In order to execute this change, we introduce a new opaque type -
> > > mm_flags_t - which wraps a bitmap.
> >
> > I have no strong opinion here, but I think coding-style.rst[1] has one? To
> > quote,
> >
> > Please don't use things like ``vps_t``.
> > It's a **mistake** to use typedef for structures and pointers.
>
> You stopped reading the relevant section in [1] :) Keep going and you see:
>
> Lots of people think that typedefs help readability. Not so. They
> are useful only for: totally opaque objects (where the typedef is
> actively used to hide what the object is). Example: pte_t
> etc. opaque objects that you can only access using the proper
> accessor functions.
>
> So this is what this is.
>
> The point is that it's opaque, that is you aren't supposed to know about or
> care about what's inside, you use the accessors.
>
> This means we can extend the size of this thing as we like, and can enforce
> atomicity through the accessors.
>
> We further highlight the opaqueness through the use of the __private.
>
> >
> > checkpatch.pl also complains similarly.
> >
> > Again, I have no strong opinion, but I think adding a clarification about why
> > we use typedef despite of the documented recommendation here might be nice?
>
> I already gave one, I clearly indicate it's opaque.

You're completely right and I agree all the points. Thank you for kindly
enlightening me :)

Thanks,
SJ …