Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp37206483rwd; Tue, 11 Jul 2023 10:51:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlFvCjhq1SR4NeWzUnGRugZvYvGYXXtc696TyOIfz0ligMWAmjEamliWEPwcAaOB5gAtEJuG X-Received: by 2002:a17:906:5358:b0:993:fe9d:eac4 with SMTP id j24-20020a170906535800b00993fe9deac4mr9160936ejo.7.1689097866556; Tue, 11 Jul 2023 10:51:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689097866; cv=none; d=google.com; s=arc-20160816; b=cDGdBLrK9jEx6+uzUjk3yikM8qmzYJWINYq77bepq/ylmsh5If/3oK+ZQl+EtercpX iGT+cJtLNEki/enDepyWFswphxNc7f/gIdyMgTyN8IsNCACmViFYCrP262OcKv+BeMjS DSeIhFQUcd+ai37p4mgT8Kq3S+KT8mBT0pvJTJwnzLR36Vcu3csE0GNj+1oMbHIk9mY8 ykOM6Da/e5KhSuzUU9OhkcSUzGebNCsAIrNiqtJQ9jmIk7roN/q/SDBaq1BzaxVMXjpK O2UKpl3MBLFcblP9dHQomqphBABtm6Z32JwR8Ql9c299qOzY4c6YK2DQAVUtMGZVi1I1 +O/g== ARC-Message-Signature: i=1; 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=vWzL8ieoY5r6fmGrcUdpEwPYQKFs0j5cY8SKpwRqgk4=; fh=TWF9UgDbu9LL9LTD0It1ju1LGrGxOOfHIx+hC6cDT7E=; b=NAygXoGR4vGRTWU23U/JQd3Mlw/uLmbc+cB3IRoHf4pAzoVSoml3FtAnkKRp5CLEgl 9Di0EA4xm/Up+jokMvCSOxG8XY/eNGKHAttqJd+0rcAlig4FYK/+ipkZRQ/diaWrgxUp ERT22LF+Os6k5687ZI9z2/mFk8KERN5wIfqmuHQ4ItYHRfGXzxp49hYPraOSyXx8OdlC BtF9V+6vfO+XO1ieXW2SKEQuR4GQATCukSVEMqHqIPv9urtjJrObVtaDKpABFcj1drqp fw565WmaxVnfbGr2wlYGWDoBvOE5OKuWQy1zeOAe5I8wapfJ7OeTtNp4IDmP5wxWc+bq Herw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZIz5Fg3o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a3-20020a170906368300b00993150e55desi2560474ejc.291.2023.07.11.10.50.41; Tue, 11 Jul 2023 10:51:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZIz5Fg3o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229512AbjGKRlm (ORCPT + 99 others); Tue, 11 Jul 2023 13:41:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229693AbjGKRll (ORCPT ); Tue, 11 Jul 2023 13:41:41 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23281E49 for ; Tue, 11 Jul 2023 10:40:58 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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"; -- 2.41.0