From patchwork Tue Jul 11 17:40:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13309276 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 07FACEB64DC for ; Tue, 11 Jul 2023 17:41:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6935F6B0072; Tue, 11 Jul 2023 13:41:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 641106B0074; Tue, 11 Jul 2023 13:41:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5083C6B0075; Tue, 11 Jul 2023 13:41:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 411956B0072 for ; Tue, 11 Jul 2023 13:41:01 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 06AD340226 for ; Tue, 11 Jul 2023 17:41:01 +0000 (UTC) X-FDA: 81000046722.14.B97DFF2 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf23.hostedemail.com (Postfix) with ESMTP id 490D2140009 for ; Tue, 11 Jul 2023 17:40:58 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ZIz5Fg3o; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf23.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689097258; 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=vWzL8ieoY5r6fmGrcUdpEwPYQKFs0j5cY8SKpwRqgk4=; b=CmJKiTzRl+LhkrwbRkmPnhYyTzdqGN0/N1vWAI1Boupyh5bqNhJYyC0Jjcrs/jiQmFuhmi lBWvFvuC55PFnULlnszQUXRnmKY7/8nE7iFWvgXMdRWxUu/XHOFxnvrijTIeKfExOzhV6c EOT/lWO0r85UMaUEYLABOqcug7WscFk= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ZIz5Fg3o; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf23.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689097258; a=rsa-sha256; cv=none; b=DzEj3Q+saqJouHbvZhjtUXD+uKiBvT0azy+p92nBtfG5GNdkcHEA2AQWJWc/zOVmlNdlx0 U3dZRwPUBbDaaZ2zooub3Hbvpiqj97EntGAKchCf6JdRVbC76kFnYuiYnanJ1PLfJhzodL Lhyee9K0W2C/IZ5QsqnllzyHaqpTzYE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689097257; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=vWzL8ieoY5r6fmGrcUdpEwPYQKFs0j5cY8SKpwRqgk4=; b=ZIz5Fg3o20vG5tluvMfY/h3Gj584LTGJU/VokrI4W4EoXc6kbUIip0bYOFu+XLix/nINEV yRU/yN8meOAfFioBWnfB47RhAzAdTrWEbKupk3tNiBnJZj5TnlAfCUTC2XjHIMvBpEKtDH u/yJTAgxAB/JknWDKj7KYJQigU2iC+U= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-625-mkZ48wdiNw2C8aPa3j_InQ-1; Tue, 11 Jul 2023 13:40:54 -0400 X-MC-Unique: mkZ48wdiNw2C8aPa3j_InQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6ED5610504AC; Tue, 11 Jul 2023 17:40:53 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.194.218]) by smtp.corp.redhat.com (Postfix) with ESMTP id D4908492B01; Tue, 11 Jul 2023 17:40:51 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-doc@vger.kernel.org, David Hildenbrand , Michal Hocko , Oscar Salvador , Jonathan Corbet , Andrew Morton Subject: [PATCH v1] mm/memory_hotplug: document the signal_pending() check in offline_pages() Date: Tue, 11 Jul 2023 19:40:50 +0200 Message-ID: <20230711174050.603820-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 490D2140009 X-Stat-Signature: znt8dkb8yixma4s3f5etj7k68r6xgznx X-HE-Tag: 1689097258-38202 X-HE-Meta: U2FsdGVkX1+T5AX6aKfyuE8AhZW24SFFzCUIvZiZ7kEE5YhnQhiwi/2RI2QCv+V0HeV89JxfZdN2/D89yZCyJgJa7gmI0vF7DBQoEeDq2pDFhOHnRAaRSURS8cF+bjQRvMLC13GzKT8/K7nH9qbe77dli9Ro4PYrEDf20yw0U7LIum0GxcVZnT3TPRVAy8yMzDY082l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A8zPDE/2+ZYj9nGbbgQ1U/Aqe1hfzF2/I4YAWPFsXmi5r1blbxV+U7Xhz+NodE5DIgSGAOSBMb2kls+Hi8dXl2ghE84fIv+48uPBX/cvBMxs0N9U= 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: Let's update the documentation that any signal is sufficient, and add a comment that not only checking for fatal signals is historical baggage: changing it now could break existing user space. although unlikely. For example, when an app provides a custom SIGALRM handler and triggers memory offlining, the timeout cmd would no longer stop memory offlining, because SIGALRM would no longer be considered a fatal signal. Cc: Michal Hocko Cc: Oscar Salvador Cc: Jonathan Corbet Cc: Andrew Morton Signed-off-by: David Hildenbrand Acked-by: Michal Hocko --- Documentation/admin-guide/mm/memory-hotplug.rst | 2 +- mm/memory_hotplug.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/mm/memory-hotplug.rst b/Documentation/admin-guide/mm/memory-hotplug.rst index 1b02fe5807cc..bd77841041af 100644 --- a/Documentation/admin-guide/mm/memory-hotplug.rst +++ b/Documentation/admin-guide/mm/memory-hotplug.rst @@ -669,7 +669,7 @@ when still encountering permanently unmovable pages within ZONE_MOVABLE (-> BUG), memory offlining will keep retrying until it eventually succeeds. When offlining is triggered from user space, the offlining context can be -terminated by sending a fatal signal. A timeout based offlining can easily be +terminated by sending a signal. A timeout based offlining can easily be implemented via:: % timeout $TIMEOUT offline_block | failure_handling diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 3f231cf1b410..7cfd13c91568 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1843,6 +1843,11 @@ int __ref offline_pages(unsigned long start_pfn, unsigned long nr_pages, do { pfn = start_pfn; do { + /* + * Historically we always checked for any signal and + * can't limit it to fatal signals without eventually + * breaking user space. + */ if (signal_pending(current)) { ret = -EINTR; reason = "signal backoff";