From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32BC6C433F5 for ; Wed, 12 Jan 2022 08:56:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 80F436B012C; Wed, 12 Jan 2022 03:56:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7C0536B012D; Wed, 12 Jan 2022 03:56:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6ADAD6B012E; Wed, 12 Jan 2022 03:56:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0222.hostedemail.com [216.40.44.222]) by kanga.kvack.org (Postfix) with ESMTP id 5AC546B012C for ; Wed, 12 Jan 2022 03:56:20 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id F2730181CAED8 for ; Wed, 12 Jan 2022 08:56:19 +0000 (UTC) X-FDA: 79021028520.13.06B7957 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf02.hostedemail.com (Postfix) with ESMTP id 70FEC80008 for ; Wed, 12 Jan 2022 08:56:19 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id E746B1F3C0; Wed, 12 Jan 2022 08:56:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1641977777; 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=uBzH2mVPP3ctB/WRYSae7RVF7fvvNk6lw/YieWT7XoY=; b=emOHqq2ajf3XQKAtY6MDJLTTxLdgpdZuzRzgsgUybOUXZau2wtcPEN+0xr/6g9XFLCUxaN gbR5sH+syOJ7AMleiVDT3t5vtqUQQUBLBKTGlufLw6GethRo+KdXM0yImTJbsHGn4+F+En ITLplvGE0N3IntYNvADruyzhJCyB1uc= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 9722AA3B85; Wed, 12 Jan 2022 08:56:16 +0000 (UTC) Date: Wed, 12 Jan 2022 09:56:15 +0100 From: Michal Hocko To: Wei Yang Cc: hannes@cmpxchg.org, vdavydov.dev@gmail.com, akpm@linux-foundation.org, shakeelb@google.com, guro@fb.com, vbabka@suse.cz, willy@infradead.org, songmuchun@bytedance.com, shy828301@gmail.com, surenb@google.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 1/4] mm/memcg: use NUMA_NO_NODE to indicate allocation from unspecified node Message-ID: References: <20220111010302.8864-1-richard.weiyang@gmail.com> <20220112004634.dc5suwei4ymyxaxg@master> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220112004634.dc5suwei4ymyxaxg@master> X-Rspamd-Queue-Id: 70FEC80008 X-Stat-Signature: epupaibs6z8e9abaqxercc5p41ta6d6e Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=emOHqq2a; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf02.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com X-Rspamd-Server: rspam06 X-HE-Tag: 1641977779-109818 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed 12-01-22 00:46:34, Wei Yang wrote: > On Tue, Jan 11, 2022 at 09:40:20AM +0100, Michal Hocko wrote: > >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@kernel.org. > > Give me some time to understand it :-) Just for the record, here is what I have put on top of that series: --- >From b7195eba02fe6308a6927450f4630057c05e808e Mon Sep 17 00:00:00 2001 From: Wei Yang Date: Tue, 11 Jan 2022 09:45:25 +0100 Subject: [PATCH] memcg: do not tweak node in alloc_mem_cgroup_per_node_info alloc_mem_cgroup_per_node_info is allocated for each possible node and this used to be a problem because not !node_online nodes didn't have appropriate data structure allocated. This has changed by "mm: handle uninitialized numa nodes gracefully" so we can drop the special casing here. Signed-off-by: Wei Yang Signed-off-by: Michal Hocko --- mm/memcontrol.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) 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; -- 2.30.2 -- Michal Hocko SUSE Labs