From patchwork Thu Jun 15 22:00:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 13281774 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 2DA4EEB64D9 for ; Thu, 15 Jun 2023 22:01:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 688468E0001; Thu, 15 Jun 2023 18:01:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6383E6B0075; Thu, 15 Jun 2023 18:01:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4D8668E0001; Thu, 15 Jun 2023 18:01:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 3F2316B0074 for ; Thu, 15 Jun 2023 18:01:09 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id F11E380AD6 for ; Thu, 15 Jun 2023 22:01:08 +0000 (UTC) X-FDA: 80906353416.07.5DC95C1 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by imf26.hostedemail.com (Postfix) with ESMTP id 5392314002A for ; Thu, 15 Jun 2023 22:01:04 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=OPpNTeFQ; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf26.hostedemail.com: domain of vishal.l.verma@intel.com designates 134.134.136.126 as permitted sender) smtp.mailfrom=vishal.l.verma@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686866466; 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:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=fvMLBjjnJfSDUagMZ1N7VhzCM8vCzL/1uB8EI2MIL8s=; b=ghiJTOKmJyKjxn1ZM9pJOkxYPgDt1oQ12vOFe5RsyVrhOnF8zeDmhOPiExsp1Sa7ZGobMA oL3FEVAawV+wQVZQhf/8oMPDSoGhP9PU28yf9aF/MQDrzmXuJG9rV3jAI/SV6wPu2GV5YB oxaiqO87xXQs/Ah6AX6ZNVfLs3mPX5U= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=OPpNTeFQ; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf26.hostedemail.com: domain of vishal.l.verma@intel.com designates 134.134.136.126 as permitted sender) smtp.mailfrom=vishal.l.verma@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686866466; a=rsa-sha256; cv=none; b=QnGiH0GdEcuhAjGeapPY/rOpBPrWE3dOHxYbk6cHpN604t05OyDipRzqb6vEENyWZy9cjZ N6wFHRchOEJ2QTAAf5kgk8gxnN85mj13ERY8irNREpBgTI2Bjd+jMT7gIcO2SslsqCEO6V oB5VD4xFxDE1n8M+G3uBXT05d9RaG1k= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686866465; x=1718402465; h=from:subject:date:message-id:mime-version: content-transfer-encoding:to:cc; bh=lZ52Uyzr79J6u7Q25jSEHwxvL9rBOICrMhEJ+YQMfOE=; b=OPpNTeFQpee1QDnXij6zfLhHL2akxPqE0Mz38xcicAfRRoKALtiB5CgU Dk/DYRmu/1lay2BCzW2nEe4a0GeBxuABgBWBrGh1XYjsARiodz9GzjSen EhgntbVbr8kzTw3wKsFzH3neHl+RUwFtv4n2Q+X7e6NE1EkscruU06+tH uieRMpLLxUkn3NaD/GIiFid33jvxqgjW2z7StLy+tLvGBVor9x40N2VpN rwMPrpaFJgHcxynWc1ZIT3eS7wt+wXYb4S7XGLJqhBwkMejxhkgZWlPc+ 4qszR34GGhNdeWTUIwABHukLH9kA8k+5aAjI/RA34oh6/9H1ZPxRAMJ2k Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="343791123" X-IronPort-AV: E=Sophos;i="6.00,245,1681196400"; d="scan'208";a="343791123" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2023 15:01:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="715770085" X-IronPort-AV: E=Sophos;i="6.00,245,1681196400"; d="scan'208";a="715770085" Received: from smaurice-mobl.amr.corp.intel.com (HELO [192.168.1.200]) ([10.212.120.175]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2023 15:01:00 -0700 From: Vishal Verma Subject: [PATCH 0/3] mm: use memmap_on_memory semantics for dax/kmem Date: Thu, 15 Jun 2023 16:00:22 -0600 Message-Id: <20230613-vv-kmem_memmap-v1-0-f6de9c6af2c6@intel.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAPaJi2QC/x2NQQqDMBBFryKzdiAmVq1XKaXEOOpQEyWhQRDv7 tDFX7wPj3dCosiUoC9OiJQ58RYEqrIAt9gwE/IoDFppo5rKYM749eQ/Mm93fNSdcd2oat0+QaT BJsIh2uAW0cJvXeXcI018/Cuv93XdGOiP7nUAAAA= To: "Rafael J. Wysocki" , Len Brown , Andrew Morton , David Hildenbrand , Oscar Salvador , Dan Williams , Dave Jiang Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, Huang Ying , Dave Hansen , Vishal Verma X-Mailer: b4 0.13-dev-02a79 X-Developer-Signature: v=1; a=openpgp-sha256; l=1518; i=vishal.l.verma@intel.com; h=from:subject:message-id; bh=lZ52Uyzr79J6u7Q25jSEHwxvL9rBOICrMhEJ+YQMfOE=; b=owGbwMvMwCXGf25diOft7jLG02pJDCndXXwTsly/77OW2O/flsjQd6vDyiTYSTTdw7JrgQJnk u7tqAkdpSwMYlwMsmKKLH/3fGQ8Jrc9nycwwRFmDisTyBAGLk4BmMiirYwM94uWCrD/T7tUVyQu /Z/rbMmOF5+f8nw51Lr5VmvUz2c2lQz/DI1u2T1KWqE1rY7z7stD/zPc3oVZTq58l/v2SgTHrpN JfAA= X-Developer-Key: i=vishal.l.verma@intel.com; a=openpgp; fpr=F8682BE134C67A12332A2ED07AFA61BEA3B84DFF X-Rspamd-Queue-Id: 5392314002A X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: ukupqzkbhnf4nksu57o93etk1zcmneaf X-HE-Tag: 1686866464-48419 X-HE-Meta: U2FsdGVkX19c428JB4bqYpSgEncr/m6JNJAlVK9QcT3vSP7KmDHgK+ZWGqXwf6kZVkaThCY74NDPlXcVihN0nlFGTGoDXTzxTwA3tjTOAF2MZKhxqLgMdXAKHaKvzytNIWGAqzgqtNnq7KGv8pF4/id7c8PN0IH8HxnRRZwebwHt/da6QZzVIxM3tVIR6xAU+ucBOBePdReF62FIi+TR0gmzpg0YvPk7UF2JxEcNhzuH6T0BeDFwJnjkaSynMwm20X8iywZCAl1TfGgeuBG439tz56aZo+xoyT1Jqim5WrxmwkI9aLeVgGBEYiEoaFIO34Kn4WWNHQj6270tshK4c/VnREvTUhdiDZLO87ux/iImwTvcrYAeF+/1ObtsmI3IfJerEaKPTFrCX+NdXlp2ETV100/OmTLD7KtNtXSNc5euPXJH5LLesdHsoUhUllAE9O02GxEgHg7gaJy8mTevDMbKnnzzo05TL0GA0eRuXvAGgfp45meHww+1Nxox2wC1XS/UEHntyZeeY6cCVtsazhX7eIS4dBn+5A0jc6NEA2wbdN+3lpna+MoB4iZ7PTZ5KB5/+2vIgvkK7U6j0gfgEv36H+HccHx2gYFeO6K0HCwRee2GBp0wvXxF9zV7gxgLs+o75QHh7GnDMJ5lP6qbm6I9QhNrRCvdhKSH/rmaxdYh4V3eewcPgx7oPuODxCqPgQ30wL1KkuscaqDZLEEcTr3Oap9M2LhbKqffFjKyqGHdaPdzfIw8EzSuO6g4zQN7pwx9rFuFHBOVTc05iGKBGR3G5QTcS3XDqExYYsbIJFLRNrohuyxBp6IupmES16+/uei7Wi6yzFSw11UX/oStGzGR4yRD3eW+pJzEgBk+ECGTfoZy6+jvZ49N98qIYI3Qrg5TmyOmrP2QNxYQgk+bmRb3oYCWU2FWAwO3TXsLa9VUCpFKrj7WExppXVtdYDQFTwxepg7dTX83Lnccx/0 nrhEjRW+ d6tn8curBM6LEkkvjP/uT9hRB5iNX/1M//7PH7zHXWysIyF2ue1y/uDgfgwc/NEVSCuld3BkIGb4PtjggWZ1RabnN61zXSgCSpj1yOjGa94FgCmZ8WOlt1FK2S0aCXrzN7pJAHegfbN72VCCBIpXXub+Ul2DL0/bsZN2hb2a0vVQSkhWch5tBcmxioDa3xZSDo7539gKebQJi32UW1tbHd2X6rQ== 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: The dax/kmem driver can potentially hot-add large amounts of memory originating from CXL memory expanders, or NVDIMMs, or other 'device memories'. There is a chance there isn't enough regular system memory available to fit ythe memmap for this new memory. It's therefore desirable, if all other conditions are met, for the kmem managed memory to place its memmap on the newly added memory itself. Arrange for this by first allowing for a module parameter override for the mhp_supports_memmap_on_memory() test using a flag, adjusting the only other caller of this interface in dirvers/acpi/acpi_memoryhotplug.c, exporting the symbol so it can be called by kmem.c, and finally changing the kmem driver to add_memory() in chunks of memory_block_size_bytes(). Signed-off-by: Vishal Verma --- Vishal Verma (3): mm/memory_hotplug: Allow an override for the memmap_on_memory param mm/memory_hotplug: Export symbol mhp_supports_memmap_on_memory() dax/kmem: Always enroll hotplugged memory for memmap_on_memory include/linux/memory_hotplug.h | 2 +- drivers/acpi/acpi_memhotplug.c | 2 +- drivers/dax/kmem.c | 49 +++++++++++++++++++++++++++++++----------- mm/memory_hotplug.c | 25 ++++++++++++++------- 4 files changed, 55 insertions(+), 23 deletions(-) --- base-commit: f1fcbaa18b28dec10281551dfe6ed3a3ed80e3d6 change-id: 20230613-vv-kmem_memmap-5483c8d04279 Best regards,