Message ID | 20220728121949.20985-6-linmiaohe@huawei.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | A few cleanup patches for hugetlb_cgroup | expand |
On Thu, Jul 28, 2022 at 5:20 AM Miaohe Lin <linmiaohe@huawei.com> wrote: > > It's better to use NUMA_NO_NODE instead of magic number -1. Minor > readability improvement. > > Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> Reviewed-by: Mina Almasry <almasrymina@google.com> > --- > mm/hugetlb_cgroup.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c > index 7e0bca52c40f..13ec091385af 100644 > --- a/mm/hugetlb_cgroup.c > +++ b/mm/hugetlb_cgroup.c > @@ -153,9 +153,9 @@ hugetlb_cgroup_css_alloc(struct cgroup_subsys_state *parent_css) > * function. > */ > for_each_node(node) { > - /* Set node_to_alloc to -1 for offline nodes. */ > + /* Set node_to_alloc to NUMA_NO_NODE for offline nodes. */ > int node_to_alloc = > - node_state(node, N_NORMAL_MEMORY) ? node : -1; > + node_state(node, N_NORMAL_MEMORY) ? node : NUMA_NO_NODE; > h_cgroup->nodeinfo[node] = > kzalloc_node(sizeof(struct hugetlb_cgroup_per_node), > GFP_KERNEL, node_to_alloc); > -- > 2.23.0 >
diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index 7e0bca52c40f..13ec091385af 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c @@ -153,9 +153,9 @@ hugetlb_cgroup_css_alloc(struct cgroup_subsys_state *parent_css) * function. */ for_each_node(node) { - /* Set node_to_alloc to -1 for offline nodes. */ + /* Set node_to_alloc to NUMA_NO_NODE for offline nodes. */ int node_to_alloc = - node_state(node, N_NORMAL_MEMORY) ? node : -1; + node_state(node, N_NORMAL_MEMORY) ? node : NUMA_NO_NODE; h_cgroup->nodeinfo[node] = kzalloc_node(sizeof(struct hugetlb_cgroup_per_node), GFP_KERNEL, node_to_alloc);
It's better to use NUMA_NO_NODE instead of magic number -1. Minor readability improvement. Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> --- mm/hugetlb_cgroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)