Re: [PATCH v6] hugetlb: Add hugetlb.*.numa_stat file

From: Shakeel Butt
Date: Wed Nov 10 2021 - 21:59:39 EST


On Wed, Nov 10, 2021 at 6:36 PM Muchun Song <songmuchun@xxxxxxxxxxxxx> wrote:
>
[...]
> > +struct hugetlb_cgroup_per_node {
> > + /* hugetlb usage in pages over all hstates. */
> > + atomic_long_t usage[HUGE_MAX_HSTATE];
>
> Why do you use atomic? IIUC, 'usage' is always
> increased/decreased under hugetlb_lock except
> hugetlb_cgroup_read_numa_stat() which is always
> reading it. So I think WRITE_ONCE/READ_ONCE
> is enough.

Oh this is me misguiding Mina, sorry about that. Yes, READ_ONCE()
should be good enough in hugetlb_cgroup_read_numa_stat().