Re: [v5 PATCH 07/11] mm: vmscan: add per memcg shrinker nr_deferred

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/29/21 7:04 PM, Yang Shi wrote:

>> > > @@ -209,9 +214,15 @@ static int expand_one_shrinker_info(struct mem_cgroup *memcg,
>> > >               if (!new)
>> > >                       return -ENOMEM;
>> > >
>> > > -             /* Set all old bits, clear all new bits */
>> > > -             memset(new->map, (int)0xff, old_size);
>> > > -             memset((void *)new->map + old_size, 0, size - old_size);
>> > > +             new->map = (unsigned long *)(new + 1);
>> > > +             new->nr_deferred = (void *)new->map + m_size;
>> >
>> > This better be aligned to sizeof(atomic_long_t). Can we be sure about that?
>>
>> Good point. No, if unsigned long is 32 bit on some 64 bit machines.
> 
> I think we could just change map to "u64" and guarantee struct
> shrinker_info is aligned to 64 bit.

What about changing to order, nr_deferred before map? Then the atomics are at
the beginning of allocated area, thus aligned.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux