From patchwork Tue Jun 20 01:17:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13285107 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 E1BDBEB64DB for ; Tue, 20 Jun 2023 01:17:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8C75C8D0001; Mon, 19 Jun 2023 21:17:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 87E118D0005; Mon, 19 Jun 2023 21:17:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5BF398D0001; Mon, 19 Jun 2023 21:17:33 -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 422148D0002 for ; Mon, 19 Jun 2023 21:17:33 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0ACF3A04DB for ; Tue, 20 Jun 2023 01:17:33 +0000 (UTC) X-FDA: 80921363586.06.F03CAB9 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2051.outbound.protection.outlook.com [40.107.94.51]) by imf22.hostedemail.com (Postfix) with ESMTP id 01167C0005 for ; Tue, 20 Jun 2023 01:17:29 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=UB6cFM6s; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf22.hostedemail.com: domain of jhubbard@nvidia.com designates 40.107.94.51 as permitted sender) smtp.mailfrom=jhubbard@nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1687223850; a=rsa-sha256; cv=pass; b=C44LM6GY/Sk1v+1S+9xtEjIvzgxNvjR/od1OuBETSAq7GLe2Jj/4MXgQSY3u67zIojND02 pUVIStNjfTPYDpJMYOnInHd27IPaq2zGqkDupvVNcy0SqNXl5nThVwZyOkdnuOeOI/QmPo ux8s1vjEE7vps5I4/c08q1b8sAmptJU= ARC-Authentication-Results: i=2; imf22.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=UB6cFM6s; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf22.hostedemail.com: domain of jhubbard@nvidia.com designates 40.107.94.51 as permitted sender) smtp.mailfrom=jhubbard@nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687223850; 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=5xYe3VM8yuX4vtW90lhI/aysRTnQnkFoQxzyk2ZljDI=; b=D+L7+Elao5Mx8/1LhuREz10wbh1A61T8rVEZsAMgJPIJNitcwqQlOgE6k+8wxTevkukTY/ 1dWxShZQEeUslNwZ8nm+WBrE39eS/EgmhZv4JuOyLk+WfEeqHTCQxFBWH+2iJKpmxxWCE3 ndBBbn3l1ncKFqKmWZi4vhNAhvdJT/Y= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WQIER0G1xXhxcbXGhaerBVdni6B+gfN9pXmNCgP7XJec4Ef7DwdEKm8qHWj0yr6n6BZ0N4hxI92zljdmPWcAy8UuRlJMPVQxya8Tm9bSYNlmcfa2xJaff5k+SlTxPWLdme+ft5HaRRTdAYLbYrydBUAJ34dQfB7YtOX+vhPqAuTHQ0NY1b7Sk8WyAu5ROT4kdZ3/VmjYWNEQE2iyipsEMTD5XuMyUUv8aOr/11T368WllG52zeO7kqRuydm8ckDSwRJI2NkmXs6Y2DpX4hUCftZrfxDNutliYSdOP80OclyFn9dvjD6fcUULgZhns9n9yC25cPNTadJj/uC2chvm6A== 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=5xYe3VM8yuX4vtW90lhI/aysRTnQnkFoQxzyk2ZljDI=; b=a2sqNCh+w6GfCL8wFP+oMizw+LqlPq1bWGfEbXi/9rllHVbuonqrbUEcYyz8TUzAC/WhlInzndidxBOCSGUfUH5GcZrBNHX8+Kvd4R9VsOrHKlqFg7Bail8ygpGFjoKqkbMtFkr0A3VVKEedIlHAgquU4wXbYD1SyJlpU6sWtIw3NNbhBiujgLzrs7n48H041W3RsxrftxQVpqPKjrh8UbrNYkpBXuBOeSbF3bSRgr4mGQZi9B9Kt57pdedo2ceykzv/HWX4UaFJQK4fOCQgaBroYBVVzXPwBJ6PQlwS9c2GyJ6zlDiHtvCVUNU5gzxAz9upwVNSsDRDK8rmiroWyQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5xYe3VM8yuX4vtW90lhI/aysRTnQnkFoQxzyk2ZljDI=; b=UB6cFM6sADuoXKJgQtUnziqa98rGnpf48Px5xvTRAlIRj0S+3jUeP5lcWN7d+w+JZQ3ACMdQoVUI6B7XCRwoAZJOHhs2LN4r4BqLGVcTGr2Er528Vk02tDrrt5MyNBWIOGRfyBNvoZ1LhNQn3am8I4weLMdDW0Hm0Avwq63dk/eIY8rpl1kLeXnAFu58MMlE5nPaK+Yxkxdm1pTK9VS2dalnnPpyNxvbuz5JPOl4xeDNCR7AxpwJrPjaWRasNiUuru9vXp0jwXAYTXE99EGZffR+t9wEl1Yh+gS20Azj6k3HHn589MJH0oSN3K70Z3XBAMRdy1sS1WHIalHsisSo6A== Received: from SA1PR02CA0022.namprd02.prod.outlook.com (2603:10b6:806:2cf::29) by LV8PR12MB9153.namprd12.prod.outlook.com (2603:10b6:408:185::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.36; Tue, 20 Jun 2023 01:17:26 +0000 Received: from SA2PEPF0000150B.namprd04.prod.outlook.com (2603:10b6:806:2cf:cafe::d9) by SA1PR02CA0022.outlook.office365.com (2603:10b6:806:2cf::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37 via Frontend Transport; Tue, 20 Jun 2023 01:17:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SA2PEPF0000150B.mail.protection.outlook.com (10.167.242.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.17 via Frontend Transport; Tue, 20 Jun 2023 01:17:26 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 19 Jun 2023 18:17:20 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 19 Jun 2023 18:17:20 -0700 Received: from blueforge.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 19 Jun 2023 18:17:20 -0700 From: John Hubbard To: David Hildenbrand , Oscar Salvador CC: Andrew Morton , LKML , , John Hubbard Subject: [PATCH] mm/memory_hotplug.c: don't fail hot unplug quite so eagerly Date: Mon, 19 Jun 2023 18:17:07 -0700 Message-ID: <20230620011719.155379-1-jhubbard@nvidia.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF0000150B:EE_|LV8PR12MB9153:EE_ X-MS-Office365-Filtering-Correlation-Id: de1975a9-e916-48af-8375-08db712c1bee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4VeQw7sm+l7pxXz6V5bR2DuPHDo049YdZGgw+m/uSNwR1y4f8sOBFHIa4nZNV4d2dvMLR0itcuz9eQu/7nravJ5QzqkzfJ4I1Nl6yznGXQulQcCyCdmQpcYDMb7Dg4ZTTiLb4VwsEdDKhEdsZ50ucK7qaJFv9EkZI7fSq51xh7eOfNoipKB4qRxGNVOFib9o6Cis4m3VB5ix8xMJpp7eungIFE4K6qyRWH1+s179UFoA3g2FwNYyKu4JgzLOX8gIt0pTdYNZJ97M9XyEDb/hAO1bKFVm7y2qswAcehxKktheY2nQgqCHAOJ7M9jzQmasscIffRZpA0Vp63PRgbVn800pODgRV8EmC9CMj46UIZqM492SPN3GSrMAr44uYkldN0mL0FBawIAXHKiG9C072xs+SF1dENoBYkGdj5qVgzswGcqoy+vAdZTeMLoQopAlJCfFcpEjYCGq/rDiovhsJ1pxrxag8mByXTbftfRVrh84w6mqF27QMMHfxbqWXngBL6x0m5TA+dkM7uEHQ1JdHVJzTisnxXWX5IfwRaJQ+ipxqTDChinCExdeM6dbYRtq5Wcyk+g7SyVmNNG4Uiv+aBIRSuJ37QeHQFen6Pn5iv53AYe5tWnea6puUUUG5mXjz1hAFKJnZG/Aatn88tsdBReV4pwlKs/ZwUcixFE+h4oZcXp+mSt+PcSLc9qdY+waBy5Ffr2hnkFOUwGDEFKgXHg2tdVVZt4k9/knHIDQ6YmVxDKahiFhmdTCMA52UA1g X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(376002)(136003)(346002)(396003)(39860400002)(451199021)(36840700001)(40470700004)(46966006)(186003)(110136005)(478600001)(7696005)(6666004)(86362001)(26005)(54906003)(1076003)(107886003)(2616005)(336012)(426003)(316002)(82740400003)(83380400001)(70206006)(70586007)(4326008)(7636003)(356005)(36860700001)(47076005)(8676002)(8936002)(5660300002)(2906002)(40460700003)(41300700001)(40480700001)(36756003)(82310400005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2023 01:17:26.2922 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: de1975a9-e916-48af-8375-08db712c1bee X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF0000150B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9153 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 01167C0005 X-Stat-Signature: n3s6nxjybdhjj1w936ubs4prxob7f7q7 X-HE-Tag: 1687223849-182642 X-HE-Meta: U2FsdGVkX189OBza3vKtP7Ud1Crml6c3pzqy0zcer+U2ciNti5tjMkmvnIIAZN/aq+ZP4B4tjJS57slsVV05tUtTeowa6oQleN5Gp9rZbr37Tu3fWYuj1/I06UB6AplzewkF4VcTO34jsu0mQg3F6SutuRXqKVcIIcbRwUEtKXb9+EZ7Y1zeQ2XGVteFV8RgTa3UjVBiB3kd2rIM8y50HAwjU/Avt/jq/pe9NpQt/Hwud+LpmjPoDWMmqWgW2C6R+pDQNjIjwwe3dcqlpDF2AbeMHe1ux++7eAkj/s+RUAArRL2oHP9ThFjDOFZU3WIdtPWSHujqJOrFq9rWURjzul6UMXAOA7GzPe3OTsnU0QBU1G51XbiL7IHbYyvN+oe2aHL64Dqt6FEupM8yhidaOf11t3VduwBp6Z2ZgiwauyQpaKCNb3f8w1Fxesfl5vHlyAG5zOTV7guvVcTXsnvrjkjwyKLSazC7oD3B6d0zDkuq3q9PVt83cSCiPDtNTIk0SiApAtPOWMN8BQTOJf5gGEuuVAe0jcuWsp3rFAtBLEfqlpGree/lHpS0FKSeqXy2jKVEkcpZttJzJ5SPgTuvKj4wMga3EdGAsjP7p/5KVvBl7nmZvSq3zqMefzBs24+iNHTiaJrdxFQKE66bEfNsig3BJr7VvxjzajspWpJVDz/5Jx5ks1ayiWgPj9pgftcMTUfm9JmDrkYD0K4UO+/MyI4c3jQJqS8Pifs5Mit6wMAMZNOlSNC7YqfMqiZhJ95iRfYrLzcrxERx74EpCo3TIqBKQ0+Pb9cQ7eDv6F5/LuAYPxdaZHbzc8tfzsTaEv+exWQIFD87yeBKEC/k3RGPpPdrlYKTAb5hQvCHM0EtkRmyawnLgJWiSAJ0I2ZP1h9kO54sil14UJxI6udSbxkq+Rp8/3KWBh8GXaKtCNgUl4Tw5o3ZlDKtA5sh0t1chmwxxVMEDWNgJw8n4hk3UTS IACrMUPu ka8P53TGQyRPy/7pJyUDZyld718Pb9XSmtmlfo8LI9vEaKi2m8P3DfOh0hyez6C4upHdBFN0C+rgdg/66CV7T/PBvRT40uW9JmjOSrbNhY/bUlq0ZRGlMZ+szcpPKQWNtQxfFQfHJAws6nviuAqMZc6uUTWntOPk8xsOmhkVrAvYaLykBLJqXtaeulbUHcZ3bn8jIcYs8PH5RYaa2dCG61UuilTPmCIacGm/dB9cgy7/S34qM8wGG2euF8O7fD08fBES+rr4h9xjQMS/GAxuTU1UB5oETLptxv06u 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: mm/memory_hotplug.c: don't fail hot unplug quite so eagerly Some device drivers add memory to the system via memory hotplug. When the driver is unloaded, that memory is hot-unplugged. However, memory hot unplug can fail. And these days, it fails a little too easily, with respect to the above case. Specifically, if a signal is pending on the process, hot unplug fails. This leads directly to: the user must reboot the machine in order to unload the driver, and therefore the device is unusable until the machine is rebooted. During teardown paths in the kernel, a higher tolerance for failures or imperfections is often best. That is, it is often better to continue with the teardown, than to error out too early. So in this case, other things (unmovable pages, un-splittable huge pages) can also cause the above problem. However, those are demonstrably less common than simply having a pending signal. I've got bug reports from users who can trivially reproduce this by killing their process with a "kill -9", for example. Fix this by soldering on with memory hot plug, even in the presence of pending signals. Signed-off-by: John Hubbard --- mm/memory_hotplug.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 8e0fa209d533..57a46620a667 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1879,12 +1879,6 @@ int __ref offline_pages(unsigned long start_pfn, unsigned long nr_pages, do { pfn = start_pfn; do { - if (signal_pending(current)) { - ret = -EINTR; - reason = "signal backoff"; - goto failed_removal_isolated; - } - cond_resched(); ret = scan_movable_pages(pfn, end_pfn, &pfn);