From patchwork Thu Nov 30 22:04:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Srinivasulu Opensrc X-Patchwork-Id: 17367 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp713433vqy; Thu, 30 Nov 2023 14:05:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IGpcmyYxU7qVSRvhk6RXtwMw2KT2vr7GhtON8XtFGauVxuT+a0/OHulKAVmF9rlNG9+LkAj X-Received: by 2002:a05:6358:6f86:b0:16f:f75e:9830 with SMTP id s6-20020a0563586f8600b0016ff75e9830mr2558135rwn.12.1701381901612; Thu, 30 Nov 2023 14:05:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701381901; cv=pass; d=google.com; s=arc-20160816; b=0+Lh8rOCduLbn+EpuxreeGeVGVow1qXootowJTQlrEtmnJYbNkucUFmn2VfcB0pf0k FOiQDdJoXE43mub/hLOUjcmq56TjGveTej+mZ0W0DPXNd5y32RoqwIBQHlSiIpiMP5rk tFuaGrTOK6A389NHp+Hf4gt6YzDdXjxdmv553ohLclUTMQm4Lw8fe2p4dvb1sMRyWOnH B+u3vVLMUbcEQ+7/rD5UVmDvGkIS6+1hriJZ8BYWzFDP/xHDcwNswqsonKeTptTLQm5v /Ne8SZdqNjMj3tYN+WH2b3MzdZl/SfXxpad1Rqv5NLG6su4bNOTfOn1Kupl9/zC/dmm1 lU6Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=2axCpfEpUw/lFBX37+lqcZ+XwWsj1GhOI3zXdhsSKZw=; fh=XjdDxkp+B4Wl5hE4S/qzEBL5/JlZM3+cRLljt73tBkE=; b=D/pHFJawbiX9bPHwpBX3EqRhdKNAbwTZks4fqqWnZMaKY9Wm67U1sLm4PazvzAbrrH VGfqPCsYM1cEqmFXGxTfgrTFkYpXt88mB2JEKDsxfQyPw+zFuABMsVWbjZxB6coR1MQa fz48XenMoqxyMYX84J2JiahKoYSAq7t0zKVEUlnks9xmKpxwdKNK4ShQjer6jvfE6WLM HFkAVRE9LdwJHtLy7+PPblfHBeU9Ktfmhw/gWDera8lCq50ihdf561BsH83XYiJOU+Yt kOE+Q3TaPVPt14eyupoKtt1TQsd3ngJm3cKqe6G9tVBKpdZbxhaA2CU9WeVXxw6XdBn6 Gv4A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@micron.com header.s=selector2 header.b=ZXt0Eznh; arc=pass (i=1 spf=pass spfdomain=micron.com dmarc=pass fromdomain=micron.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=micron.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id u22-20020a63d356000000b005c5e24c7e8csi2235464pgi.414.2023.11.30.14.05.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 14:05:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@micron.com header.s=selector2 header.b=ZXt0Eznh; arc=pass (i=1 spf=pass spfdomain=micron.com dmarc=pass fromdomain=micron.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=micron.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 0DA678024573; Thu, 30 Nov 2023 14:04:59 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377108AbjK3WEq (ORCPT + 99 others); Thu, 30 Nov 2023 17:04:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377104AbjK3WEp (ORCPT ); Thu, 30 Nov 2023 17:04:45 -0500 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2048.outbound.protection.outlook.com [40.107.94.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0606D40; Thu, 30 Nov 2023 14:04:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a7S89jrK3WIdrFOpR7RSAFo8n8GF4S4I2YvO+M0cWvnWH4tmGkLgrg3KpraSMqLoUk6US/sp8EDJEn2OOR+PzB8L0EagXb5EgAaJSKFnJGfzHmJsvDmlg/qdWSCD6yEf3qURhm1L/Nu44OdYfRZWQ2jLSoO1j+CxqurMvnDjldEXa8RT0t6/3+yEaFwoK7sGGaWdzr+cfvvhYAVQTzAlXKm/mK3Y5akPewlkiBOULk8b3LyUShXccb98qvyZPO2G3l1vjHM11MrosyuwJthPTR3XKCRBTsbc9k96gdXme5wjBFICGGlyC+ssmJv3FaV7DQg2qfPzFgCGRJBCFkDJEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2axCpfEpUw/lFBX37+lqcZ+XwWsj1GhOI3zXdhsSKZw=; b=hjOkqMX8kp8sF4ChS0nK1xL55Q8trdjiHgZNCl16Cn06Gm1OPo3b+TwTbLkab2Ur15qnSIlqaqW7cyA5UY4hfFm+AOFpSVIcDi6ps1Zbqyyz13tVgbfWGTL1x/MozLYroZQcwRUphKXNbnEofntToEG5KFtajeG/LCMqs7BNi49CmyifV8NI9F0bHHB9kT3XtMoLWouzUDc1xOh7lNW89q9qBoEJxIMNkKhh3loMpPvX86csiIm6H+JQfc1LAueLJZ4rMrUaTi1CWYDgP9Rp5wCUp7eE0XSqvF7XYjIaDQvwW5GWnjnqsBPomPL/ODilbLx5VRa6V7DctfWNVHZISg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 137.201.242.130) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=micron.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=micron.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=micron.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2axCpfEpUw/lFBX37+lqcZ+XwWsj1GhOI3zXdhsSKZw=; b=ZXt0EznhYjSj0sjg3nzljzTS30Mb9aJOzeo2FFoXFqWiDqiVIH5FmKWiVPDoiURyyLA+7KUoODB0/iOwofaJyOyrYqKdFvNwpDq00P6MYuSeT8bx6WdHzOENOzh0ADb70PYsF9aSeQjuaAqeURkLqYK4Tg35HiR8cnDKG4rL8U0XbC6UswUxdpldLepDf29SzREowxS85qEu6P3FeybE0c438uJ7Rpm30CBk0VayjH3lPymcNu1FIchu8ZMy3/WAoGoBBVfWdchPO0SoOVCrj8pqRWr5OQ6s4wuHKRR8Rl2rQHqt5JCyf92r0EurWcTwE0ji0dL66SPcfsgiFs0AIg== Received: from MW4PR04CA0084.namprd04.prod.outlook.com (2603:10b6:303:6b::29) by DS0PR08MB8490.namprd08.prod.outlook.com (2603:10b6:8:126::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.23; Thu, 30 Nov 2023 22:04:46 +0000 Received: from CO1PEPF000044EE.namprd05.prod.outlook.com (2603:10b6:303:6b:cafe::9d) by MW4PR04CA0084.outlook.office365.com (2603:10b6:303:6b::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.22 via Frontend Transport; Thu, 30 Nov 2023 22:04:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 137.201.242.130) smtp.mailfrom=micron.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=micron.com; Received-SPF: Pass (protection.outlook.com: domain of micron.com designates 137.201.242.130 as permitted sender) receiver=protection.outlook.com; client-ip=137.201.242.130; helo=mail.micron.com; pr=C Received: from mail.micron.com (137.201.242.130) by CO1PEPF000044EE.mail.protection.outlook.com (10.167.241.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.17 via Frontend Transport; Thu, 30 Nov 2023 22:04:46 +0000 Received: from BOW36EX19B.micron.com (137.201.85.154) by BOW17EX19A.micron.com (137.201.21.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.27; Thu, 30 Nov 2023 15:04:45 -0700 Received: from micron.com (10.3.67.194) by RestrictedRelayBOW36EX19B.micron.com (137.201.85.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.27 via Frontend Transport; Thu, 30 Nov 2023 15:04:39 -0700 From: To: , , , CC: , , , , , , , , , , , , , , , , Subject: [RFC PATCH 0/2] Node migration between memory tiers Date: Fri, 1 Dec 2023 03:34:20 +0530 Message-ID: <20231130220422.2033-1-sthanneeru.opensrc@micron.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-MT-Whitelisted: matched X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044EE:EE_|DS0PR08MB8490:EE_ X-MS-Office365-Filtering-Correlation-Id: 115df915-807a-4133-c623-08dbf1f05d55 X-LD-Processed: f38a5ecd-2813-4862-b11b-ac1d563c806f,ExtAddr X-EXT-ByPass: 1 X-MT-RULE-Whitelisted: Triggered X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mrOtc6/Uxeup+J62YVmFw4nRB5i8xcQkXQ0vFrqAfAR9xbq+QaTDZo86toDxY1Qh+BkadOqlFwcPJY5euN3aTpKVRSpfSQH3oYHT9XYD55tbc8z10u70tb6GSZp1jzhP7E3ZgHvD9luHyrS5paFq78ybJ+vbJlFjX0fekMhUJCaIub3l79EKzlSVSeL3r1hVB2cdnaHVRPRSD5+hWjU+e+Teb5nFu9foQ//dgmqVLv1aS8dgj6M3UFsvJsSAIQCGfM55PKe1nP7KtHofhPtRL+5ioBG1EApH7UWpcZNSNaV3uvJij+nPn8BWIKw8NH+uVSg9+l0eJt4X68ReK5Qk0WmuOh6YqiFriO6aaTNlUnvhkzZCQB+M/zRkYLQtlTrkULT2A18YpUhUOg0J86Wk7fqdR7aHwEbNsQIMjRd5OcMsZX8Hw9qj0x1VJi/EOCp2ZGpoRsmkhCnPTw4Xrel4KZd7f+61xqUWj0r001wh1OmJgdXeZo34nCt0upGd4siZ48IG6+9MbmjWqmM2rBSogUVkTwAUA3u5xMDTDfatyxQB1AuJlqIy0XlOxFyoJ+/yO/i9p1tUyFQXLz6KH2iEwhORXzr+/ToDOwer5GQKbhYRnqZ/nQYGWMthnEJGUlnNKzPeD7fUqg2JwX66qutiX8rzqzmSgHrq69BO1x+8LVQ3V7+SMlIw80QknHVYk6IQFF/ytlPC/wiPyPiPbKQ+qNnH/mhkoeLQt55i2Hs3jC9jC4fAZDa/5lkU1MddFcy/NS6KjCESc8qiKBaCF0uuww== X-Forefront-Antispam-Report: CIP:137.201.242.130;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.micron.com;PTR:masquerade.micron.com;CAT:NONE;SFS:(13230031)(4636009)(376002)(346002)(396003)(136003)(39860400002)(230922051799003)(451199024)(186009)(64100799003)(82310400011)(1800799012)(46966006)(40470700004)(36840700001)(7636003)(47076005)(83380400001)(356005)(40460700003)(26005)(1076003)(2616005)(6286002)(70586007)(54906003)(70206006)(316002)(2876002)(2906002)(110136005)(8676002)(5660300002)(4326008)(7696005)(86362001)(8936002)(41300700001)(36756003)(7416002)(6666004)(478600001)(426003)(336012)(82740400003)(40480700001)(55016003)(36860700001)(7049001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: micron.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2023 22:04:46.2467 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 115df915-807a-4133-c623-08dbf1f05d55 X-MS-Exchange-CrossTenant-Id: f38a5ecd-2813-4862-b11b-ac1d563c806f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f38a5ecd-2813-4862-b11b-ac1d563c806f;Ip=[137.201.242.130];Helo=[mail.micron.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044EE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR08MB8490 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 30 Nov 2023 14:04:59 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784027261978615021 X-GMAIL-MSGID: 1784028228554035635 From: Srinivasulu Thanneeru The memory tiers feature allows nodes with similar memory types or performance characteristics to be grouped together in a memory tier. However, there is currently no provision for moving a node from one tier to another on demand. This patch series aims to support node migration between tiers on demand by sysadmin/root user using the provided sysfs for node migration. Each tier has a start abstract distance(adistance) and range. To migrate a node to a tier, the corresponding node’s sysfs adistance_offset is written with a value corresponding to the tier’s adistance. Example: Move node2 to memory tier5 from its default tier(i.e 4) 1. Check default values: $cat /sys/devices/virtual/memory_tiering/memory_tier4/nodelist 0-2 $cat /sys/devices/system/node/node0/adistance_offset 0 $cat /sys/devices/system/node/node1/adistance_offset 0 $cat /sys/devices/system/node/node2/adistance_offset 0 2. Move node2 to tier5: To move node2 from emory_tier4 (adistance=512) to emory_tier5 (abstract=640), set the `adistance_offset` of node 2 to 128 (i.e., 512 + 128 = 640). Tier4 adistance start can be derved from tier-id (i.e for tier4, 4 << 7 = 512). $echo 128 > /sys/devices/system/node/node2/adistance_offset $cat /sys/devices/system/node/node2/adistance_offset 128 3. Verify node2's tier id: $cat /sys/devices/virtual/memory_tiering/memory_tier5/nodelist 2 $cat /sys/devices/virtual/memory_tiering/memory_tier4/nodelist 0-1 Srinivasulu Thanneeru (2): base/node: Add sysfs for adistance_offset memory tier: Support node migration between tiers drivers/base/node.c | 51 +++++++++++++++++++++++ include/linux/memory-tiers.h | 11 +++++ include/linux/node.h | 6 +++ mm/memory-tiers.c | 79 ++++++++++++++++++++---------------- 4 files changed, 113 insertions(+), 34 deletions(-)