From patchwork Wed Apr 13 09:22:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagdish Gediya X-Patchwork-Id: 12811781 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 71319C433EF for ; Wed, 13 Apr 2022 09:22:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EF99D6B0073; Wed, 13 Apr 2022 05:22:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EA8E46B0074; Wed, 13 Apr 2022 05:22:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D23776B0075; Wed, 13 Apr 2022 05:22:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0070.hostedemail.com [216.40.44.70]) by kanga.kvack.org (Postfix) with ESMTP id C517E6B0073 for ; Wed, 13 Apr 2022 05:22:25 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6D80BA799C for ; Wed, 13 Apr 2022 09:22:25 +0000 (UTC) X-FDA: 79351315050.23.B19FA4F Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf30.hostedemail.com (Postfix) with ESMTP id D7FF880004 for ; Wed, 13 Apr 2022 09:22:24 +0000 (UTC) Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 23D96jM8032739; Wed, 13 Apr 2022 09:22:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=AFIrjYTPtgDFJnTaB8TkYq5z5kBSeR6Y2BP+mRO/+bY=; b=Zxg8xviyaF5e60QiV/M6qFdToXWqE0Mw0ixg9wwBDkETryjBgC1ZAHhFm2fUukzfC7ZA w6nYCR8b5ufjEKWGe+TZRvyZforWmKDcEZZBifOW5t4nVAyN5VsXyERYIZKM/KL8UkR5 BsvWOPxB+xnslnrrN1ZSSAQVEGVOpgpikinnZwPxIYk1IAkgfGmVf+5j1YMzH1+5TVTK aQkEV8cUNniRc25zmll58jK1YfCiPUU9yWw2TBLB9WeuyRbWZIW4LxgzL9nOk5AaK7cm U+q7jehvJOBKfpXOX4id2eda1AnY5+s2CsISg90nctXHCehbh742dJoybJkyyCoDYkRE Rg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3fdpjhe8hg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Apr 2022 09:22:22 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 23D9MMCB008762; Wed, 13 Apr 2022 09:22:22 GMT Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 3fdpjhe8gx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Apr 2022 09:22:22 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 23D9Kklu005529; Wed, 13 Apr 2022 09:22:20 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma04fra.de.ibm.com with ESMTP id 3fb1s8w9m4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Apr 2022 09:22:20 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 23D9MHaR40108496 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Apr 2022 09:22:17 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EB3254C046; Wed, 13 Apr 2022 09:22:16 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 552E94C059; Wed, 13 Apr 2022 09:22:14 +0000 (GMT) Received: from li-6e1fa1cc-351b-11b2-a85c-b897023bb5f3.ibm.com.com (unknown [9.43.51.146]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 13 Apr 2022 09:22:14 +0000 (GMT) From: Jagdish Gediya To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, aneesh.kumar@linux.ibm.com, baolin.wang@linux.alibaba.com, dave.hansen@linux.intel.com, ying.huang@intel.com, Jagdish Gediya Subject: [PATCH v2 1/5] mm: demotion: Set demotion list differently Date: Wed, 13 Apr 2022 14:52:02 +0530 Message-Id: <20220413092206.73974-2-jvgediya@linux.ibm.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220413092206.73974-1-jvgediya@linux.ibm.com> References: <20220413092206.73974-1-jvgediya@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: UFkx_5t7kMHNG8JQm-lGG2Xnt_94zgjG X-Proofpoint-ORIG-GUID: epmHWqL7LcSG4nMSsVSJbRzL9t-i0PZq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-13_01,2022-04-12_02,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 priorityscore=1501 clxscore=1011 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204130051 X-Rspam-User: Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Zxg8xviy; spf=pass (imf30.hostedemail.com: domain of jvgediya@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=jvgediya@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: D7FF880004 X-Stat-Signature: 6ng3reoquwojkauxyohk331irqwcwrgf X-HE-Tag: 1649841744-306728 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: Sharing used_targets between multiple nodes in a single pass limits some of the opportunities for demotion target sharing. Don't share the used targets between multiple nodes in a single pass, instead accumulate all the used targets in source nodes shared by all pass, and reset 'used_targets' to source nodes while finding demotion targets for any new node. This results into some more opportunities to share demotion targets between multiple source nodes, e.g. with below NUMA topology, where node 0 & 1 are cpu + dram nodes, node 2 & 3 are equally slower memory only nodes, and node 4 is slowest memory only node, available: 5 nodes (0-4) node 0 cpus: 0 1 node 0 size: n MB node 0 free: n MB node 1 cpus: 2 3 node 1 size: n MB node 1 free: n MB node 2 cpus: node 2 size: n MB node 2 free: n MB node 3 cpus: node 3 size: n MB node 3 free: n MB node 4 cpus: node 4 size: n MB node 4 free: n MB node distances: node 0 1 2 3 4 0: 10 20 40 40 80 1: 20 10 40 40 80 2: 40 40 10 40 80 3: 40 40 40 10 80 4: 80 80 80 80 10 The existing implementation gives below demotion targets, node demotion_target 0 3, 2 1 4 2 X 3 X 4 X With this patch applied, below are the demotion targets, node demotion_target 0 3, 2 1 3, 2 2 4 3 4 4 X e.g. with below NUMA topology, where node 0, 1 & 2 are cpu + dram nodes and node 3 is slow memory node, available: 4 nodes (0-3) node 0 cpus: 0 1 node 0 size: n MB node 0 free: n MB node 1 cpus: 2 3 node 1 size: n MB node 1 free: n MB node 2 cpus: 4 5 node 2 size: n MB node 2 free: n MB node 3 cpus: node 3 size: n MB node 3 free: n MB node distances: node 0 1 2 3 0: 10 20 20 40 1: 20 10 20 40 2: 20 20 10 40 3: 40 40 40 10 The existing implementation gives below demotion targets, node demotion_target 0 3 1 X 2 X 3 X With this patch applied, below are the demotion targets, node demotion_target 0 3 1 3 2 3 3 X Signed-off-by: Aneesh Kumar K.V Signed-off-by: Jagdish Gediya Reviewed-by: Baolin Wang Tested-by: Baolin Wang Acked-by: "Huang, Ying" --- mm/migrate.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index de175e2fdba5..516f4e1348c1 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2383,7 +2383,7 @@ static void __set_migration_target_nodes(void) { nodemask_t next_pass = NODE_MASK_NONE; nodemask_t this_pass = NODE_MASK_NONE; - nodemask_t used_targets = NODE_MASK_NONE; + nodemask_t source_nodes = NODE_MASK_NONE; int node, best_distance; /* @@ -2401,20 +2401,23 @@ static void __set_migration_target_nodes(void) again: this_pass = next_pass; next_pass = NODE_MASK_NONE; + /* - * To avoid cycles in the migration "graph", ensure - * that migration sources are not future targets by - * setting them in 'used_targets'. Do this only - * once per pass so that multiple source nodes can - * share a target node. - * - * 'used_targets' will become unavailable in future - * passes. This limits some opportunities for - * multiple source nodes to share a destination. + * Accumulate source nodes to avoid the cycle in migration + * list. */ - nodes_or(used_targets, used_targets, this_pass); + nodes_or(source_nodes, source_nodes, this_pass); for_each_node_mask(node, this_pass) { + /* + * To avoid cycles in the migration "graph", ensure + * that migration sources are not future targets by + * setting them in 'used_targets'. Reset used_targets + * to source nodes for each node in this pass so that + * multiple source nodes can share a target node. + */ + nodemask_t used_targets = source_nodes; + best_distance = -1; /* From patchwork Wed Apr 13 09:22:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagdish Gediya X-Patchwork-Id: 12811782 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 74A66C433EF for ; Wed, 13 Apr 2022 09:22:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 004DB6B0074; Wed, 13 Apr 2022 05:22:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EF6E16B0075; Wed, 13 Apr 2022 05:22:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DBE616B0078; Wed, 13 Apr 2022 05:22:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0052.hostedemail.com [216.40.44.52]) by kanga.kvack.org (Postfix) with ESMTP id CF5F86B0074 for ; Wed, 13 Apr 2022 05:22:29 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 921CCA5BF9 for ; Wed, 13 Apr 2022 09:22:29 +0000 (UTC) X-FDA: 79351315218.29.4C6B5A0 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf06.hostedemail.com (Postfix) with ESMTP id 969A018000B for ; Wed, 13 Apr 2022 09:22:28 +0000 (UTC) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 23D8oEO7015856; Wed, 13 Apr 2022 09:22:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=GuT/Aag64Naw9qrAoc+yZUT4CN6KosjaU/EzDIYcFBQ=; b=O3wbE9iYbROYCeCbaC0BXCHr0hxaecx6K+dMduPc4k7L8DR5nrOb59XKJxcmYvn2paal uy/T8UxEUvHiNfXssSF5bXUP5OGaSiq39Isn02nXjw+BODp0L1HekQc7gkyyvHnnQMYw IL7kzFIJbiE4AT8hevR7N46/X/F2Zsweokki1895H7pcCGccbVyOtwGbQNeH1PjnQwPy H1JWTh9HA6xJLdolWGWgjUTCLrBuNqzD1qFF+EWPLPxg5ksPVIPoqlYK+QqK1IXQtLcx KFAAWTl03tllY1LWs3c+1lUzfAmJSbkia32ol/AkrhZ6G6TG0iTvgZ87YSi35pdmseF4 OQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3fduc0rqec-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Apr 2022 09:22:26 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 23D9LOo1013075; Wed, 13 Apr 2022 09:22:26 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 3fduc0rqdr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Apr 2022 09:22:26 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 23D9K4mm030760; Wed, 13 Apr 2022 09:22:23 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma06ams.nl.ibm.com with ESMTP id 3fb1dj6fky-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Apr 2022 09:22:23 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 23D9MTQj27984254 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Apr 2022 09:22:29 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7E1514C040; Wed, 13 Apr 2022 09:22:20 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 666894C05C; Wed, 13 Apr 2022 09:22:18 +0000 (GMT) Received: from li-6e1fa1cc-351b-11b2-a85c-b897023bb5f3.ibm.com.com (unknown [9.43.51.146]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 13 Apr 2022 09:22:18 +0000 (GMT) From: Jagdish Gediya To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, aneesh.kumar@linux.ibm.com, baolin.wang@linux.alibaba.com, dave.hansen@linux.intel.com, ying.huang@intel.com, Jagdish Gediya Subject: [PATCH v2 2/5] mm: demotion: Add new node state N_DEMOTION_TARGETS Date: Wed, 13 Apr 2022 14:52:03 +0530 Message-Id: <20220413092206.73974-3-jvgediya@linux.ibm.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220413092206.73974-1-jvgediya@linux.ibm.com> References: <20220413092206.73974-1-jvgediya@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: AqVLASNKy2nlze1g9vVm1zEmaqvPGGah X-Proofpoint-GUID: _WxfuiiwnygLq1KIjNQFFPFibbAECMho X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-13_01,2022-04-12_02,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 suspectscore=0 mlxscore=0 impostorscore=0 mlxlogscore=903 lowpriorityscore=0 bulkscore=0 adultscore=0 malwarescore=0 spamscore=0 priorityscore=1501 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204130051 X-Rspam-User: X-Stat-Signature: 8ofiyj4dgh6nh45it7s7ruwdxdhgtttb Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=O3wbE9iY; spf=pass (imf06.hostedemail.com: domain of jvgediya@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=jvgediya@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 969A018000B X-HE-Tag: 1649841748-287207 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: Current implementation to find the demotion targets works based on node state N_MEMORY, however some systems may have dram only memory numa node which are N_MEMORY but not the right choices as demotion targets. Add new state N_DEMOTION_TARGETS, node_states[N_DEMOTION_TARGETS] then can be used to hold the list of nodes which can be used as demotion targets. Signed-off-by: Aneesh Kumar K.V Signed-off-by: Jagdish Gediya --- drivers/base/node.c | 4 ++++ include/linux/nodemask.h | 1 + 2 files changed, 5 insertions(+) diff --git a/drivers/base/node.c b/drivers/base/node.c index ec8bb24a5a22..cd79815b0f7a 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -1038,6 +1038,9 @@ static struct node_attr node_state_attr[] = { [N_CPU] = _NODE_ATTR(has_cpu, N_CPU), [N_GENERIC_INITIATOR] = _NODE_ATTR(has_generic_initiator, N_GENERIC_INITIATOR), + [N_DEMOTION_TARGETS] = _NODE_ATTR(has_demotion_targets, + N_DEMOTION_TARGETS), + }; static struct attribute *node_state_attrs[] = { @@ -1050,6 +1053,7 @@ static struct attribute *node_state_attrs[] = { &node_state_attr[N_MEMORY].attr.attr, &node_state_attr[N_CPU].attr.attr, &node_state_attr[N_GENERIC_INITIATOR].attr.attr, + &node_state_attr[N_DEMOTION_TARGETS].attr.attr, NULL }; diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index 567c3ddba2c4..17844300fd57 100644 --- a/include/linux/nodemask.h +++ b/include/linux/nodemask.h @@ -400,6 +400,7 @@ enum node_states { N_MEMORY, /* The node has memory(regular, high, movable) */ N_CPU, /* The node has one or more cpus */ N_GENERIC_INITIATOR, /* The node has one or more Generic Initiators */ + N_DEMOTION_TARGETS, /* Nodes that should be considered as demotion targets */ NR_NODE_STATES }; From patchwork Wed Apr 13 09:22:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagdish Gediya X-Patchwork-Id: 12811783 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 CE78AC433F5 for ; Wed, 13 Apr 2022 09:22:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D1BD6B0075; Wed, 13 Apr 2022 05:22:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 581806B0078; Wed, 13 Apr 2022 05:22:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4221B6B007B; Wed, 13 Apr 2022 05:22:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0102.hostedemail.com [216.40.44.102]) by kanga.kvack.org (Postfix) with ESMTP id 349856B0075 for ; Wed, 13 Apr 2022 05:22:32 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id E157F183C03E1 for ; Wed, 13 Apr 2022 09:22:31 +0000 (UTC) X-FDA: 79351315302.22.A64C33D Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf27.hostedemail.com (Postfix) with ESMTP id 5503D4000A for ; Wed, 13 Apr 2022 09:22:31 +0000 (UTC) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 23D8fnt5015860; Wed, 13 Apr 2022 09:22:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=DC90fePYOoCr+3ib3Y1j/qpFHxLAIQ/hvFvZPCUiPLM=; b=LZztJFQkhVDpUpW5WhYo/PC/SZs0ezbBUQQ4L5P8kSgsLTvWr0jsPtOw+f4JyR8vUMYx zcwVW3Un8o0NJv1v+0KYZ0hRfAMbLtmDg6Z3+2tIJphU//m7FKFFtZIieYCikslHuEUy MeKQGdaMKTx9jxAj99iqM6rP0vO3X3U5ua1fqry8XBcvvCfkPumT7ALSLJKTrKTlWgpI HyYemXs1l0Y5ZmSGC1TK83lw+nqJ2R9PiT49b6tcICJf0FbAgRQXkqKkJb76JIojAosH 1a3SgU46B93cradmujMKhHD/4sCkJ6EveF1tWsv0cLnuHSjPhMd7TwlR12FzqAe6M1DG WA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3fdu7sry95-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Apr 2022 09:22:29 +0000 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 23D9MTPh017708; Wed, 13 Apr 2022 09:22:29 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 3fdu7sry8g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Apr 2022 09:22:29 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 23D9KGRa030806; Wed, 13 Apr 2022 09:22:27 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma06ams.nl.ibm.com with ESMTP id 3fb1dj6fm3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Apr 2022 09:22:26 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 23D9MOCX33620248 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Apr 2022 09:22:24 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E2FEA4C046; Wed, 13 Apr 2022 09:22:23 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 901474C044; Wed, 13 Apr 2022 09:22:21 +0000 (GMT) Received: from li-6e1fa1cc-351b-11b2-a85c-b897023bb5f3.ibm.com.com (unknown [9.43.51.146]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 13 Apr 2022 09:22:21 +0000 (GMT) From: Jagdish Gediya To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, aneesh.kumar@linux.ibm.com, baolin.wang@linux.alibaba.com, dave.hansen@linux.intel.com, ying.huang@intel.com, Jagdish Gediya Subject: [PATCH v2 3/5] mm: demotion: Add support to set targets from userspace Date: Wed, 13 Apr 2022 14:52:04 +0530 Message-Id: <20220413092206.73974-4-jvgediya@linux.ibm.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220413092206.73974-1-jvgediya@linux.ibm.com> References: <20220413092206.73974-1-jvgediya@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: hdHHjqQxSQNPifr7Z18VkAsJBt2ofxx1 X-Proofpoint-ORIG-GUID: Hw1mFgL-SDpAqea-jpyTjfCTiBnzxBM9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-13_01,2022-04-12_02,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 mlxscore=0 clxscore=1015 impostorscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204130051 Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=LZztJFQk; spf=pass (imf27.hostedemail.com: domain of jvgediya@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=jvgediya@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 5503D4000A X-Stat-Signature: m94hury17thhqtj91u1xwgoazwu8p45u X-HE-Tag: 1649841751-56428 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: Add support to set node_states[N_DEMOTION_TARGETS] from user space to override the default demotion targets. Restrict demotion targets to memory only numa nodes while setting them from user space. Demotion targets can be set from userspace using command, echo > /sys/kernel/mm/numa/demotion_target Signed-off-by: Aneesh Kumar K.V Signed-off-by: Jagdish Gediya --- .../ABI/testing/sysfs-kernel-mm-numa | 12 +++++++ mm/migrate.c | 35 +++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-numa b/Documentation/ABI/testing/sysfs-kernel-mm-numa index 77e559d4ed80..10e9e643845c 100644 --- a/Documentation/ABI/testing/sysfs-kernel-mm-numa +++ b/Documentation/ABI/testing/sysfs-kernel-mm-numa @@ -22,3 +22,15 @@ Description: Enable/disable demoting pages during reclaim the guarantees of cpusets. This should not be enabled on systems which need strict cpuset location guarantees. + +What: /sys/kernel/mm/numa/demotion_target +Date: April 2022 +Contact: Linux memory management mailing list +Description: Configure demotion target nodes + + Page migration during reclaim is intended for systems + with tiered memory configurations. Preferred migration target + nodes can be configured in a system using this interface, based + on which demotion table is prepared in kernel. If demotion is + enabled then pages will be migrated to set demotion targets + during reclaim. diff --git a/mm/migrate.c b/mm/migrate.c index 516f4e1348c1..4d3d80ca0a7f 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2564,12 +2564,47 @@ static ssize_t numa_demotion_enabled_store(struct kobject *kobj, return count; } + +static ssize_t numa_demotion_target_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + return sysfs_emit(buf, "%*pbl\n", + nodemask_pr_args(&node_states[N_DEMOTION_TARGETS])); +} + +static ssize_t numa_demotion_target_store(struct kobject *kobj, + struct kobj_attribute *attr, + const char *nodelist, size_t count) +{ + nodemask_t nodes; + + if (nodelist_parse(nodelist, nodes)) + return -EINVAL; + + if (!nodes_subset(nodes, node_states[N_MEMORY])) + return -EINVAL; + + if (nodes_intersects(nodes, node_states[N_CPU])) + return -EINVAL; + + node_states[N_DEMOTION_TARGETS] = nodes; + + set_migration_target_nodes(); + + return count; +} + static struct kobj_attribute numa_demotion_enabled_attr = __ATTR(demotion_enabled, 0644, numa_demotion_enabled_show, numa_demotion_enabled_store); +static struct kobj_attribute numa_demotion_target_attr = + __ATTR(demotion_target, 0644, numa_demotion_target_show, + numa_demotion_target_store); + static struct attribute *numa_attrs[] = { &numa_demotion_enabled_attr.attr, + &numa_demotion_target_attr.attr, NULL, }; From patchwork Wed Apr 13 09:22:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagdish Gediya X-Patchwork-Id: 12811784 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 F1EB6C433FE for ; Wed, 13 Apr 2022 09:22:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8B7F46B0078; Wed, 13 Apr 2022 05:22:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 866C26B007B; Wed, 13 Apr 2022 05:22:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 708646B007D; Wed, 13 Apr 2022 05:22:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0086.hostedemail.com [216.40.44.86]) by kanga.kvack.org (Postfix) with ESMTP id 632EA6B0078 for ; Wed, 13 Apr 2022 05:22:36 -0400 (EDT) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 1354BA79A4 for ; Wed, 13 Apr 2022 09:22:36 +0000 (UTC) X-FDA: 79351315512.31.3F0DFF1 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf27.hostedemail.com (Postfix) with ESMTP id 60EBB4000A for ; Wed, 13 Apr 2022 09:22:35 +0000 (UTC) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 23D8oEO8015856; Wed, 13 Apr 2022 09:22:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=4X2QURIlgZAv9adJmpQNjH+Rxhc/IoUAl9LWBytqM5A=; b=H85fmgXxi2JNeI09wj7ahuRgUgnbV0SddLt81WfU13qHxHRk0SzmSFEux/1TEwVj2e2F z4EEzoHt7dFIZGVycarMZSepd1OpaDxSqJD0qSifvNS7p343zwwehSU+0Q2Mk5HYD0Uc bTW3LF5TQPL9PmtiD71P2SFpkHBTtl5xRmsPaW1pQ6BdVop39DsBZ+2J47HKY7nIuwJl W5zfaIdntXxXogQKNuDh7XxTc/+tOs5FiNwQO9lJ5mp9eZrdOJ8DdYvkwO6p6b13VOZe +Q5nxljRrY1zy+9+VtQJAssNPhSvChtSt8WnFIzHds3lXxN6Z7onnB3fW7cvn8bQyjk1 lQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3fduc0rqgu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Apr 2022 09:22:33 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 23D97moT028850; Wed, 13 Apr 2022 09:22:33 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 3fduc0rqg4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Apr 2022 09:22:33 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 23D9M5cU030676; Wed, 13 Apr 2022 09:22:30 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma05fra.de.ibm.com with ESMTP id 3fb1s8n8xk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Apr 2022 09:22:30 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 23D9MaCo29098264 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Apr 2022 09:22:37 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A76B84C046; Wed, 13 Apr 2022 09:22:27 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 01BA84C040; Wed, 13 Apr 2022 09:22:25 +0000 (GMT) Received: from li-6e1fa1cc-351b-11b2-a85c-b897023bb5f3.ibm.com.com (unknown [9.43.51.146]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 13 Apr 2022 09:22:24 +0000 (GMT) From: Jagdish Gediya To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, aneesh.kumar@linux.ibm.com, baolin.wang@linux.alibaba.com, dave.hansen@linux.intel.com, ying.huang@intel.com, Jagdish Gediya Subject: [PATCH v2 4/5] device-dax/kmem: Set node state as N_DEMOTION_TARGETS Date: Wed, 13 Apr 2022 14:52:05 +0530 Message-Id: <20220413092206.73974-5-jvgediya@linux.ibm.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220413092206.73974-1-jvgediya@linux.ibm.com> References: <20220413092206.73974-1-jvgediya@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: e_M6LTzmWTwoLmWl_XFe9FdNtWKlpDzB X-Proofpoint-GUID: HDumrkkMcl1iFBQIXduGx9esBdHE8CSi X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-13_01,2022-04-12_02,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 suspectscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 lowpriorityscore=0 bulkscore=0 adultscore=0 malwarescore=0 spamscore=0 priorityscore=1501 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204130051 X-Stat-Signature: 1dkezbp3f85os1ix3iu9f7djmcwmsiiz Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=H85fmgXx; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf27.hostedemail.com: domain of jvgediya@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=jvgediya@linux.ibm.com X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 60EBB4000A X-HE-Tag: 1649841755-374373 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: Set dax-device node as N_DEMOTION_TARGETS so that it can be used as demotion target. In future, support should be added to distinguish the dax-devices which are not preferred as demotion target e.g. HBM, for such devices, node shouldn't be set to N_DEMOTION_TARGETS. Signed-off-by: Aneesh Kumar K.V Signed-off-by: Jagdish Gediya --- drivers/dax/kmem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c index a37622060fff..f42ab9d04bdf 100644 --- a/drivers/dax/kmem.c +++ b/drivers/dax/kmem.c @@ -147,6 +147,8 @@ static int dev_dax_kmem_probe(struct dev_dax *dev_dax) dev_set_drvdata(dev, data); + node_set_state(numa_node, N_DEMOTION_TARGETS); + return 0; err_request_mem: From patchwork Wed Apr 13 09:22:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagdish Gediya X-Patchwork-Id: 12811785 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 0AEB0C433F5 for ; Wed, 13 Apr 2022 09:22:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F04D6B007B; Wed, 13 Apr 2022 05:22:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 978416B007D; Wed, 13 Apr 2022 05:22:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8411B6B007E; Wed, 13 Apr 2022 05:22:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0241.hostedemail.com [216.40.44.241]) by kanga.kvack.org (Postfix) with ESMTP id 75CB06B007B for ; Wed, 13 Apr 2022 05:22:39 -0400 (EDT) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 286EEA79A4 for ; Wed, 13 Apr 2022 09:22:39 +0000 (UTC) X-FDA: 79351315638.31.CB71EF7 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf24.hostedemail.com (Postfix) with ESMTP id 98D24180005 for ; Wed, 13 Apr 2022 09:22:38 +0000 (UTC) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 23D9CHLg025180; Wed, 13 Apr 2022 09:22:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=xEuKeeb6CPM40df+lXa1GIogUowI06MGWTkkso5bVNY=; b=qiOHq1HFw2LjapovMSlv1NJjdGxW71l/pGbBi4XvWg7m8Ty10QO0IKGRwIqYuiBytmsV S73DoIpsbdVrkNGyAo7yyl8f8obZfKpYzRWKNUszKt3qJmUjOyWdWCmFUIpryfr42ZqX JhkeGu3lMQe+pHvsgwOmAyHGGHuEPwI8dGbn59rF1aO8nfPKlVBBINdxag294IcmTLy1 vMP21ROi04iWbmRSp4pdVUehgGKsU+svq5b3InwN9KEQjsoDo7EJ6GnEuMnU2MLYVMH8 aEsccwa57Ix1DWn2ysxNtpXmAG0YyxHdKKmNse9TDJodAFJ+Dw6KGYImm3XKfrk+29iu wA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3fdup206d2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Apr 2022 09:22:36 +0000 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 23D9IA96013448; Wed, 13 Apr 2022 09:22:36 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 3fdup206cc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Apr 2022 09:22:36 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 23D9MBtP021566; Wed, 13 Apr 2022 09:22:34 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma03ams.nl.ibm.com with ESMTP id 3fb1s8xerb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Apr 2022 09:22:34 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 23D9MV9B42926404 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Apr 2022 09:22:31 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E986A4C04E; Wed, 13 Apr 2022 09:22:30 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BC72D4C050; Wed, 13 Apr 2022 09:22:28 +0000 (GMT) Received: from li-6e1fa1cc-351b-11b2-a85c-b897023bb5f3.ibm.com.com (unknown [9.43.51.146]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 13 Apr 2022 09:22:28 +0000 (GMT) From: Jagdish Gediya To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, aneesh.kumar@linux.ibm.com, baolin.wang@linux.alibaba.com, dave.hansen@linux.intel.com, ying.huang@intel.com, Jagdish Gediya Subject: [PATCH v2 5/5] mm: demotion: Build demotion list based on N_DEMOTION_TARGETS Date: Wed, 13 Apr 2022 14:52:06 +0530 Message-Id: <20220413092206.73974-6-jvgediya@linux.ibm.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220413092206.73974-1-jvgediya@linux.ibm.com> References: <20220413092206.73974-1-jvgediya@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: otWXF-ZG7BkB_v-O9E6I3nxpLJWzU1zr X-Proofpoint-ORIG-GUID: FOE330h_nNeZbS-12QtEv6ppLXNnh0bo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-13_01,2022-04-12_02,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 bulkscore=0 spamscore=0 mlxscore=0 clxscore=1015 mlxlogscore=999 priorityscore=1501 phishscore=0 suspectscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204130051 X-Stat-Signature: m88zztmq9e91i6bray8wq1888ufs99b5 Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=qiOHq1HF; spf=pass (imf24.hostedemail.com: domain of jvgediya@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=jvgediya@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 98D24180005 X-HE-Tag: 1649841758-232135 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: Only nodes which has state N_DEMOTION_TARGETS should be used as demotion targets. make nodes which are not in demotion targets as source nodes while building demotion target list. Signed-off-by: Aneesh Kumar K.V Signed-off-by: Jagdish Gediya --- mm/migrate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 4d3d80ca0a7f..e517a5ab1fcf 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2394,10 +2394,11 @@ static void __set_migration_target_nodes(void) disable_all_migrate_targets(); /* - * Allocations go close to CPUs, first. Assume that - * the migration path starts at the nodes with CPUs. + * Pick demotion targets only from node_states[N_DEMOTION_TARGETS] + * so make nodes which are not in demotion targets as source nodes */ - next_pass = node_states[N_CPU]; + nodes_andnot(next_pass, node_states[N_ONLINE], + node_states[N_DEMOTION_TARGETS]); again: this_pass = next_pass; next_pass = NODE_MASK_NONE;