Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp37408154rwd; Tue, 11 Jul 2023 13:59:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlHa7fmJ31ZdEk9ppPc9C9LrgfnKmeZ5YK1G5Al/OUiaR9/arnc9nc8Lxf89BURNfb2hFyfi X-Received: by 2002:a05:6a20:3ca7:b0:11a:efaa:eb88 with SMTP id b39-20020a056a203ca700b0011aefaaeb88mr21758906pzj.3.1689109148361; Tue, 11 Jul 2023 13:59:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689109148; cv=none; d=google.com; s=arc-20160816; b=NYVmxv3sO3+DYFNcORspS1ZuU5rxuxLaIImor0dcYkchHB7U/LTmms0C7+wytpxwUb TzCeahOn9gurfMrZwwZJ1Mp33UMG/IsI0QqiIvNCnuuURP1mJcOau9CBXliZSpilJB8t cJXtQruFbxxVcQM4wEi2BPbMLl0pMrYTUGqW827ybkMx4tkNLWJpsiqid+yr0hALRZus XVFlCM2ZtyHuw0b2sLtISyTuDELbZt+AngdXj1uU9zLYaQv7lDPi40O7xZV3RuPCAxHZ PnYA1Tk6FFhf39IGHaWMPEmbvMn6jp8j49Mcxodu1ZrBBN/fEBN6UCA3GCR5fRjU8XKI Xo6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4LaucvtloWCHpaXc2axnPFcfthuhw0RH1IRv8sUy6fI=; fh=XMRMjF4ALvom2cZr0VGttxAexWkF9IzaJbVOgftPtM0=; b=BI2KnKXaE01eMhCiB4PxpuzNTw6sTQtKyJgkJoA4UUb10jZl+LmMwYD/8wjVI1lnY3 A4mWikbMC468Hwq9bP2n3mhcB1zTEtEf+47onYe+2k7e47f6RrePkl4/VdLSaQZrxq4V pSvEIU8u0Nb55Rves88j7/2UX8mQ6xvmqDmnuk6qyys3xEE7jLIReox2ayrdm7LfvxtF QgPLNVO6aqiKkU2l9RDdR50aTaT9mpuXy+JSTRKzaoVSHTkNkiql8aGLlfJ1c1UYL3vG AumxKTJJJ9LNH2/whUWUGaZraBvzJ5JDgRjU+30WJcmH4g4D4HqXNWJhnggCT6d1VowC iKIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=Az2OzX9R; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m16-20020a63fd50000000b0055c558ac516si1947120pgj.854.2023.07.11.13.58.55; Tue, 11 Jul 2023 13:59:08 -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=@suse.com header.s=susede1 header.b=Az2OzX9R; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230446AbjGKUr2 (ORCPT + 99 others); Tue, 11 Jul 2023 16:47:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230352AbjGKUr1 (ORCPT ); Tue, 11 Jul 2023 16:47:27 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 463BD9B; Tue, 11 Jul 2023 13:47:26 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D32791FE45; Tue, 11 Jul 2023 20:47:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1689108444; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=4LaucvtloWCHpaXc2axnPFcfthuhw0RH1IRv8sUy6fI=; b=Az2OzX9RYGO8kSztwAv4FZoRnv5TOlOzw0ViMusf5VKfMCKXaADhC0TL7skKzP8DIheEch bWfai/uJzSP/rQvtcCOjTq3oQsYuJA704x2WmTkwkrMt39x3fItBjoXz1pHH9RDYLD0NOF Hxc172rmIwbv7DbuXntJ9W00Y1Slafs= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id AFF7D1390F; Tue, 11 Jul 2023 20:47:24 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id lGSQKNy/rWQOKQAAMHmgww (envelope-from ); Tue, 11 Jul 2023 20:47:24 +0000 Date: Tue, 11 Jul 2023 22:47:24 +0200 From: Michal Hocko To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, Oscar Salvador , Jonathan Corbet , Andrew Morton Subject: Re: [PATCH v1] mm/memory_hotplug: document the signal_pending() check in offline_pages() Message-ID: References: <20230711174050.603820-1-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230711174050.603820-1-david@redhat.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 On Tue 11-07-23 19:40:50, David Hildenbrand wrote: > 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. Yes, and it is likely goot to mention here that this is an antipattern for many other kernel operations like IO (e.g. write) but it is a long term behavior that somebody might depend on and it is safer to reflect the documentation to the realitity rather than other way around (which would be imho better). > 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"; > -- > 2.41.0 -- Michal Hocko SUSE Labs