On Wed, Jul 25, 2018 at 11:51:06AM +0900, Minchan Kim wrote:
> On Tue, Jul 24, 2018 at 07:35:32PM -0700, Matthew Wilcox wrote:
> > There is NOTHING in a union with _refcount.
> 
> Confusing. Matthew, what am I missing?
> 
> Before:
> 
> counters consumes 8 bytes
> units and _refcount consumes each 4 bytes so memory space is not overlapped.

Correct.  _mapcount is at offset 24, as is units.  _refcount is at offset 28.

>         union {
>                 unsigned long counters;
>                 struct {
>                         union {
>                                 atomic_t _mapcount;
>                                 int units;                      /* SLOB */
>                         };
>                         atomic_t _refcount;
>                 };
>         };
> 
> 
> After:
> 
> Now, units is overlapped with _refcount and _mapcount.

No.  units is at offset 24, as is _mapcount.  But _refcount is still at
offset 28.

>         union {
>                 unsigned long counters;
>                 int units;                      /* SLOB */
>                 struct {                        /* Page cache */
>                         atomic_t _mapcount;
>                         atomic_t _refcount;
>                 };
>         };

Reply via email to