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 0AE42C43334 for ; Fri, 15 Jul 2022 07:23:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7544A9401D0; Fri, 15 Jul 2022 03:23:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6DD549401A5; Fri, 15 Jul 2022 03:23:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 57F439401D0; Fri, 15 Jul 2022 03:23:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 435109401A5 for ; Fri, 15 Jul 2022 03:23:30 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 1BD0D34925 for ; Fri, 15 Jul 2022 07:23:30 +0000 (UTC) X-FDA: 79688493780.06.A8BA3E0 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf15.hostedemail.com (Postfix) with ESMTP id 5A6C8A007D for ; Fri, 15 Jul 2022 07:23:29 +0000 (UTC) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26F6vAKY023715; Fri, 15 Jul 2022 07:23:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : in-reply-to : references : date : message-id : mime-version : content-type; s=pp1; bh=EndeTF06wmem2QLG6bojP7IsO1nI09syR9jj12B0A5U=; b=Wz2boJsQucWKuZfV/VPgUwf/qQKNsL1OQMr0Rptqgyt8SZOCsvNS3/1kRBAJpFequzW0 YLjXDMrpZUIt0YblXOZ/3EXCLBWQqr8uhTH8I3NTwukSBPY4zYhMLlWasHSa25jBetH8 8WefLofdh82ugoVnUKuF6UnKWQn8DTDFD88jcH50YYljyD8iB+EBPQI9GLTS/M+3QcPl 5lc0HrDO5bIG1kyzqGD/sRAa8a7kVb/OfwvjlAv0sl+7JGLgZNjbVziR7Kfuw0IOclJ8 1g4c1Z3x4bNsD+YiOZr6NA0p6dhwwTnTjufDEipINoOvn6Zw/+b/pyEccVU+bOZxqozM 9w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3hb3dy0mau-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Jul 2022 07:23:15 +0000 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 26F7IIW6003541; Fri, 15 Jul 2022 07:23:15 GMT Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3hb3dy0ma4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Jul 2022 07:23:15 +0000 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 26F7KqIK032184; Fri, 15 Jul 2022 07:23:12 GMT Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by ppma03dal.us.ibm.com with ESMTP id 3ha4qy3jdv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Jul 2022 07:23:12 +0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 26F7NBOG10486518 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Jul 2022 07:23:11 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BB42CB205F; Fri, 15 Jul 2022 07:23:11 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 86F34B2065; Fri, 15 Jul 2022 07:23:06 +0000 (GMT) Received: from skywalker.linux.ibm.com (unknown [9.43.84.38]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 15 Jul 2022 07:23:06 +0000 (GMT) X-Mailer: emacs 29.0.50 (via feedmail 11-beta-1 I) From: "Aneesh Kumar K.V" To: Alistair Popple Cc: linux-mm@kvack.org, akpm@linux-foundation.org, Wei Xu , Huang Ying , Yang Shi , Davidlohr Bueso , Tim C Chen , Michal Hocko , Linux Kernel Mailing List , Hesham Almatary , Dave Hansen , Jonathan Cameron , Dan Williams , Johannes Weiner , jvgediya.oss@gmail.com Subject: Re: [PATCH v9 4/8] mm/demotion: Add hotplug callbacks to handle new numa node onlined In-Reply-To: <87h73iapg1.fsf@nvdebian.thelocal> References: <20220714045351.434957-1-aneesh.kumar@linux.ibm.com> <20220714045351.434957-5-aneesh.kumar@linux.ibm.com> <87h73iapg1.fsf@nvdebian.thelocal> Date: Fri, 15 Jul 2022 12:53:03 +0530 Message-ID: <87wnceu9ew.fsf@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: zlHsUCc6K8PTm39FtjLnSI2oSP-VcbjT X-Proofpoint-GUID: um8W-UlTrr9Q3FarESX_p5gkjFkpK-8k X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-15_02,2022-07-14_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 adultscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 spamscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207150029 ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Wz2boJsQ; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf15.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657869809; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=EndeTF06wmem2QLG6bojP7IsO1nI09syR9jj12B0A5U=; b=1gYjUjv/0dN2/2i0QK+EyiMD67qM08iJrSfAdiXnHe8HUaiaSfk5AGS6uU2njObm5PWI/p RX+xmgHV0Zd8+bryi9k0IyJg1ZUolYLflQBtJjyS/G3r8BjkKWyOtJ7eEpyrGi7R3I2z1r PjxHWABIN1JVikgqVoTZKguR34q0ees= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657869809; a=rsa-sha256; cv=none; b=3SDptf+9O0Nse7BRxRNGB4byqUE0Mh34sM2MgvvqdksntxMHeP9M9NryVVDN+qYQnNSZn8 2mwk+gzCDxhcfOo+pRdAs2SmpUQriZgqjqlucZLUoei6oIHwytGPylG7ZEfJ7abYhVtqFq p4aPAVPaPs4JlqJf9tREHmSKFm4k+mw= X-Rspam-User: X-Rspamd-Queue-Id: 5A6C8A007D X-Rspamd-Server: rspam02 X-Stat-Signature: 49cospupwmix3ecupjthpxuy4x6w6mmg Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Wz2boJsQ; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf15.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com X-HE-Tag: 1657869809-958440 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: Alistair Popple writes: > "Aneesh Kumar K.V" writes: > >> If the new NUMA node onlined doesn't have a memory tier assigned, >> the kernel adds the NUMA node to default memory tier. >> >> Signed-off-by: Aneesh Kumar K.V >> --- >> mm/memory-tiers.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 68 insertions(+) >> >> diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c >> index 79347d4ab05e..5706ad647136 100644 >> --- a/mm/memory-tiers.c >> +++ b/mm/memory-tiers.c >> @@ -5,6 +5,7 @@ >> #include >> #include >> #include >> +#include >> #include >> >> struct memory_tier { >> @@ -130,8 +131,73 @@ int node_create_and_set_memory_tier(int node, int tier) >> } >> EXPORT_SYMBOL_GPL(node_create_and_set_memory_tier); >> >> +static int __node_set_memory_tier(int node, int tier) >> +{ >> + int ret = 0; >> + struct memory_tier *memtier; >> + >> + memtier = __get_memory_tier_from_id(tier); >> + if (!memtier) { >> + ret = -EINVAL; >> + goto out; >> + } >> + node_set(node, memtier->nodelist); >> +out: >> + return ret; >> +} >> + >> +static int node_set_memory_tier(int node, int tier) > > Minor comment, but I don't like the name of this function as it doesn't > always set the node to the given tier. > > Something like this would make it clearer the tier value is only used if > the node isn't already assigned to a tier: > > static int init_node_memory_tier(int node, int default_tier) > Will rename to init_node_memory_tier() -aneesh