From: Michal Hocko Subject: Re: [PATCH 1/4] mm/memcg: use NUMA_NO_NODE to indicate allocation from unspecified node Date: Tue, 11 Jan 2022 09:40:20 +0100 Message-ID: References: <20220111010302.8864-1-richard.weiyang@gmail.com> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1641890421; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VIUY6eShIdRTWSX2SPQ97aOdwxxv1/dSNJBcmaqEh1k=; b=F6OQn/8ghbFt5kDOe4MDHdFUUUJKANC6GwmV1NZ9rs/hfuit0S6arCMN+IIbKkNilDqykQ VkFrl8zKQmi6G2ugEIf9Sggw6KPJC4bGGTrmbqFIEkWlWZYdXeQjIsHCKgy7+6daHk8aJx bxjWj2srPDWFaegvbV1yxKE1P9cKT9E= Content-Disposition: inline In-Reply-To: <20220111010302.8864-1-richard.weiyang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Wei Yang Cc: hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org, vdavydov.dev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org, shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, guro-b10kYP2dOMg@public.gmane.org, vbabka-AlSwsSmVLrQ@public.gmane.org, willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org, songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org, shy828301-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, surenb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org On Tue 11-01-22 01:02:59, Wei Yang wrote: > Instead of use "-1", let's use NUMA_NO_NODE for consistency. > > Signed-off-by: Wei Yang I am not really sure this is worth it. After the merge window I plan to post http://lkml.kernel.org/r/20211214100732.26335-1-mhocko-DgEjT+Ai2yi4UlQgPVntAg@public.gmane.org With that in place we can drop the check and a node rewrite so the net result will be a less and more straightforward code. If you agree I can add this with your s-o-b into my series: diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 781605e92015..ed19a21ee14e 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5044,18 +5044,8 @@ struct mem_cgroup *mem_cgroup_from_id(unsigned short id) static int alloc_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node) { struct mem_cgroup_per_node *pn; - int tmp = node; - /* - * This routine is called against possible nodes. - * But it's BUG to call kmalloc() against offline node. - * - * TODO: this routine can waste much memory for nodes which will - * never be onlined. It's better to use memory hotplug callback - * function. - */ - if (!node_state(node, N_NORMAL_MEMORY)) - tmp = -1; - pn = kzalloc_node(sizeof(*pn), GFP_KERNEL, tmp); + + pn = kzalloc_node(sizeof(*pn), GFP_KERNEL, node); if (!pn) return 1; -- Michal Hocko SUSE Labs