From patchwork Thu Aug 25 09:20:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 12954413 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 4C90BC04AA5 for ; Thu, 25 Aug 2022 09:21:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7BB0B6B0074; Thu, 25 Aug 2022 05:21:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 76A496B0075; Thu, 25 Aug 2022 05:21:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 60B8B940007; Thu, 25 Aug 2022 05:21:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 50E5C6B0074 for ; Thu, 25 Aug 2022 05:21:24 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 26117141B39 for ; Thu, 25 Aug 2022 09:21:24 +0000 (UTC) X-FDA: 79837571688.06.B8B8DEC Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf07.hostedemail.com (Postfix) with ESMTP id 9F52540002 for ; Thu, 25 Aug 2022 09:21:22 +0000 (UTC) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27P7uCAt012328; Thu, 25 Aug 2022 09:20:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=V1ZsmE9exi3HrE4feFWGgAnfWbKxkMywvkzji4yNFSg=; b=hCq5aeIF5EQ/NTsEv6fK/2q4llnBjJ9ZF1VW5hJy2FtTlDD2t7xigWrpWxNHuyDVtI0m FNTPWvE531IVjwMlA/Dl7+BIPn5slzuYs2oJaq1jcnq+1FB3CmHSOXpzFMyRnK+MV3Rh ezejXxNS2YMdyn3dOZBQ572ShpTqAIYLk+LeMkScP37YTxReNE92gTZuHPQ3NMeSTf/P E2WqnMMeH0w6L41Ac+agkPJaClxIPr4L0CW/CUhKtTnSfQpPP7desGuLgkmB7p9EKFoD mHZiLcWMn+oypfMzJjXMdhjWvehADq3nBI1VsOoueB/QF3INY9P/FOoVvASApZ9mM5MQ wA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3j654cun4t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Aug 2022 09:20:46 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 27P7woaM025055; Thu, 25 Aug 2022 09:20:45 GMT Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3j654cun3r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Aug 2022 09:20:45 +0000 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 27P95Nd4016969; Thu, 25 Aug 2022 09:20:44 GMT Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by ppma03wdc.us.ibm.com with ESMTP id 3j2q89pr61-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Aug 2022 09:20:44 +0000 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 27P9KiAR10617346 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Aug 2022 09:20:44 GMT Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C25F06A04F; Thu, 25 Aug 2022 09:20:43 +0000 (GMT) Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E17356A047; Thu, 25 Aug 2022 09:20:37 +0000 (GMT) Received: from skywalker.ibmuc.com (unknown [9.43.112.25]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP; Thu, 25 Aug 2022 09:20:37 +0000 (GMT) From: "Aneesh Kumar K.V" To: linux-mm@kvack.org, akpm@linux-foundation.org Cc: Wei Xu , Huang Ying , Yang Shi , Davidlohr Bueso , Tim C Chen , Michal Hocko , Linux Kernel Mailing List , Hesham Almatary , Dave Hansen , Jonathan Cameron , Alistair Popple , Dan Williams , Johannes Weiner , jvgediya.oss@gmail.com, Bharata B Rao , "Aneesh Kumar K.V" Subject: [PATCH] mm/demotion: Fix kernel error with memory hotplug Date: Thu, 25 Aug 2022 14:50:19 +0530 Message-Id: <20220825092019.379069-1-aneesh.kumar@linux.ibm.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: LYRoZX7Bp77pwoZ9Vxo2iM0zsMzAVDlB X-Proofpoint-ORIG-GUID: X5vJ9CsKnfFtGnKxP0Om01-AMOjGShi5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-25_03,2022-08-22_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 suspectscore=0 mlxscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=999 impostorscore=0 adultscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208250034 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661419283; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=V1ZsmE9exi3HrE4feFWGgAnfWbKxkMywvkzji4yNFSg=; b=JehW1ghjHiz6gszJ2GGg8kKLa1Mds8OZNfJsdch42oIhtZLC1LKDnFszq/7ESqI3K0pCTT lBBLP8vfhkIZN0hJqslSF/tB9wdbStNJBqFYKcWMREMNoPZQI5u8LkZ/i0DDraRuQst1v6 oR7g1wO+5b4HNZpJiTsmgzdkADgXDac= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=hCq5aeIF; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf07.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661419283; a=rsa-sha256; cv=none; b=19c4pq1kRbug/N2JMlwzvT69z17i/w2/YGsVNad0zLSaZ3Tw1/Difeqtu2DSNU7kIEe6lv Jne7nHVyKkc18fnthkjjn6I/+2SvqsE4JLKucOjaRBZ0IZCysOm2/ZtfXZ6ZgWp6rICLci xGC6nI65VL6OCkmcdqZOPJeh6oXY9NI= Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=hCq5aeIF; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf07.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-Rspam-User: X-Rspamd-Queue-Id: 9F52540002 X-Rspamd-Server: rspam10 X-Stat-Signature: an9iiojh7944xdyss7x8yn3s9nxcqayr X-HE-Tag: 1661419282-220068 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 memory hot unplug, the kernel removes the node memory type from the associated memory tier. Use list_del_init instead of list del such that the same memory type can be added back to a memory tier on hotplug. Without this, we get the below warning and return error on adding memory type to a new memory tier. [ 33.596095] ------------[ cut here ]------------ [ 33.596099] WARNING: CPU: 3 PID: 667 at mm/memory-tiers.c:115 set_node_memory_tier+0xd6/0x2e0 [ 33.596109] Modules linked in: kmem ... [ 33.596126] RIP: 0010:set_node_memory_tier+0xd6/0x2e0 .... [ 33.596196] memtier_hotplug_callback+0x48/0x68 [ 33.596204] blocking_notifier_call_chain+0x80/0xc0 [ 33.596211] online_pages+0x25e/0x280 [ 33.596218] memory_block_change_state+0x176/0x1f0 [ 33.596225] memory_subsys_online+0x37/0x40 [ 33.596230] online_store+0x9b/0x130 [ 33.596236] kernfs_fop_write_iter+0x128/0x1b0 [ 33.596242] vfs_write+0x24b/0x2c0 [ 33.596249] ksys_write+0x74/0xe0 [ 33.596254] do_syscall_64+0x43/0x90 [ 33.596259] entry_SYSCALL_64_after_hwframe+0x63/0xcd Fixes: mm/demotion: Add hotplug callbacks to handle new numa node onlined Signed-off-by: Aneesh Kumar K.V --- mm/memory-tiers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c index a20795bb0e07..ba844fe9cc8c 100644 --- a/mm/memory-tiers.c +++ b/mm/memory-tiers.c @@ -451,7 +451,7 @@ static bool clear_node_memory_tier(int node) memtype = node_memory_types[node]; node_clear(node, memtype->nodes); if (nodes_empty(memtype->nodes)) { - list_del(&memtype->tier_sibiling); + list_del_init(&memtype->tier_sibiling); if (list_empty(&memtier->memory_types)) destroy_memory_tier(memtier); }