From: Mike Kravetz <mike.kravetz@oracle.com>
To: Mina Almasry <almasrymina@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Shuah Khan <shuah@kernel.org>, Miaohe Lin <linmiaohe@huawei.com>,
Oscar Salvador <osalvador@suse.de>,
Michal Hocko <mhocko@suse.com>,
Muchun Song <songmuchun@bytedance.com>,
David Rientjes <rientjes@google.com>, Jue Wang <juew@google.com>,
Yang Yao <ygyao@google.com>, Joanna Li <joannali@google.com>,
Cannon Matthews <cannonmatthews@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] hugetlb: Add hugetlb.*.numa_stat file
Date: Mon, 1 Nov 2021 16:19:34 -0700 [thread overview]
Message-ID: <89a1fa3f-2c9b-34c9-761c-d0f21d0ba233@oracle.com> (raw)
In-Reply-To: <CAHS8izPf-NL_BQnC-xBXW+mcsQQdiUSfxwL1JtU_H6DnBjr_Qg@mail.gmail.com>
On 10/31/21 1:39 PM, Mina Almasry wrote:
> On Wed, Oct 27, 2021 at 4:36 PM Mike Kravetz <mike.kravetz@oracle.com> wrote:
>>
>> On 10/20/21 12:09 PM, Mina Almasry wrote:
>>
>> I have no objections to adding this functionality, and do not see any
>> blocking issues in hugetlb code. However, it would be GREAT if someone
>> more familiar/experienced with cgroups would comment. My cgroup
>> experience is very limited.
>>
>
> I will send V2 to Shakeel as well from our team and ask him to take a
> look and he has more than enough experience to review. If anyone else
> reading with cgroups knowledge can Review/Ack that would be great.
>
> It's possible I'm a bit off the mark here, but FWIW I don't think
> there is much that is continuous or ambiguous here. For
> memory.numa_stat it's a bit nuanced because there is anon, rss, shmem,
> etc.. but for hugetlb we just have hugetlb memory and the only care
> needed is hierarchical vs not in cgroups v1.
>
I agree. It is straight forward from a hugetlb POV. Just would like to
get an ack from someone more familiar with cgroups. To me it also looks
fine from a cgroups POV, but my cgroup knowledge is so limited that does
not mean much.
>> alloc_mem_cgroup_per_node_info provides similar functionality and has
>> the following comment.
>>
>> * TODO: this routine can waste much memory for nodes which will
>> * never be onlined. It's better to use memory hotplug callback
>> * function.
>>
>
> So the memory allocated per node in total is (HUGE_MAX_HSTATE *
> unsigned long * num_css_on_the system). HUGE_MAX_HSTATE is 2 on x86.
> This is significant, but to address this comment I have to complicate
> the hugetlb_cgroup code quite a bit so I thought I'd check with you if
> you think it's still OK/worth it. slub.c implements these changes
> (slab_memory_callback) and they are:
>
> - When creating a new hugetlb_cgroup, I create per_node data for only
> online nodes.
> - On node online I need to loop over all existing hugetlb_cgroups and
> allocate per_node data. I need rcu_read_lock() here and below.
> - On node offline I need to loop over all existing hugetlb_cgroups and
> free per_node data.
> - If I follow the slub example, I need a lock to synchronize
> onlining/offlining with references to per_node data in commit_charge()
> uncharge_page() and show_numa_stats().
>
> I don't think it's worth it TBH, but I'm happy to oblige if you think so.
>
No need to do anything extra/special here. I just noted that you would
be allocating memory for offline nodes and took a look to see if the
memory cgroup code handled this case. They do not, and have this as a
TODO. I think that is sufficient here.
Thanks,
--
Mike Kravetz
next prev parent reply other threads:[~2021-11-01 23:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-20 19:09 [PATCH v2] hugetlb: Add hugetlb.*.numa_stat file Mina Almasry
2021-10-27 23:35 ` Mike Kravetz
2021-10-31 20:39 ` Mina Almasry
2021-11-01 23:19 ` Mike Kravetz [this message]
2021-11-02 5:11 ` Muchun Song
2021-11-04 1:43 ` Mina Almasry
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=89a1fa3f-2c9b-34c9-761c-d0f21d0ba233@oracle.com \
--to=mike.kravetz@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=almasrymina@google.com \
--cc=cannonmatthews@google.com \
--cc=joannali@google.com \
--cc=juew@google.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=osalvador@suse.de \
--cc=rientjes@google.com \
--cc=shuah@kernel.org \
--cc=songmuchun@bytedance.com \
--cc=ygyao@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).