Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8565202imu; Tue, 4 Dec 2018 10:18:24 -0800 (PST) X-Google-Smtp-Source: AFSGD/VAaylKcpMgs1WL5JD3yflxsfXKY9gFS91Zqdo7XEvCC3ppIWkgkfVinIXEI/HQ4Bcc2ZK5 X-Received: by 2002:a17:902:925:: with SMTP id 34mr20212280plm.14.1543947504575; Tue, 04 Dec 2018 10:18:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543947504; cv=none; d=google.com; s=arc-20160816; b=vXdwLR+OnSsYviXXkaUbnhwZLqQCfsulNR3Em6U89fWsRADUnm8PNrio8XDR+XJt4Q G7v6QsIW2AXwtorbU8JbdDCaYeODKcaco4vFBMia/r3t0Jz4/WDdnQMTQ1HTbPRbWram YD9HfniSYz+uPeaJubvQ1Th0zspY60gv5Z7kogIRsxHT+2qNUlSUMJ65RysTvaSzNRnF dpjJr309pvJMx+DfmRvQSMiAurJTseDWpEQZUOPR+d0nTsS+RJa2BQrZ5MwbclKBeUiw NQL1Hzf8NW9AgJZT9JwbNm0wyPEA/gy1eZ+uegRb2cX0ysPCNx5nLQpNamlD0SVMcX7D 5Ivw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=6Vqak1iJP7ZzJkNcKNXJRT2loNnoX9/kvibsIpCLQ4s=; b=fa3fTDqRkVm2p+LdTm/2WQ2MNdylPr15BpG7UOzRuUR7CmVCcz9icwWpl1AzqOkFVE ODhFjxWxd+GoLDMU/nWG/fiRhD0E/pakFbq6iGjIhX23WZ8jGIEJ7+1g5zP8rWNvVTP7 Psv0PbmH8YWl+tGWe72RxwipAbPpsJ+3ZfAQmU8/S27J0yF3goL9ivy/jXqErFOWsQ8u Alfz4MpYPR9XVBtz7C4JEQlYW0UXyw0m7yuJFvz9QvmQh2ii9IObPLKD6QEmsyAVcTJy IVVBs3CG6q3d3cGXYK2RaBlGKfDz7wcJHdzgvvM0EHkYBeTHefxvHvcoaa/+wF/tHcV4 KaJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y2si18304705pfy.29.2018.12.04.10.18.09; Tue, 04 Dec 2018 10:18:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726071AbeLDSRU (ORCPT + 99 others); Tue, 4 Dec 2018 13:17:20 -0500 Received: from mx2.suse.de ([195.135.220.15]:33090 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725855AbeLDSRU (ORCPT ); Tue, 4 Dec 2018 13:17:20 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 0D600B160; Tue, 4 Dec 2018 18:17:18 +0000 (UTC) Date: Tue, 4 Dec 2018 19:17:14 +0100 From: Michal Hocko To: Linus Torvalds Cc: Ingo Molnar , pavel@ucw.cz, Oleg Nesterov , Linux List Kernel Mailing , rafael.j.wysocki@intel.com, chanho.min@lge.com, Thomas Gleixner , Peter Zijlstra Subject: Re: [PATCH] Revert "exec: make de_thread() freezable (was: Re: Linux 4.20-rc4) Message-ID: <20181204181714.GR1286@dhcp22.suse.cz> References: <20181203123857.GS31738@dhcp22.suse.cz> <20181203131006.GA10054@amd> <20181203135351.GU31738@dhcp22.suse.cz> <20181203141459.GA14789@amd> <20181203141737.GY31738@dhcp22.suse.cz> <20181204090228.GC73770@gmail.com> <20181204091020.GD1286@dhcp22.suse.cz> <20181204093310.GE73770@gmail.com> <20181204095802.GF1286@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 04-12-18 09:31:11, Linus Torvalds wrote: > On Tue, Dec 4, 2018 at 1:58 AM Michal Hocko wrote: > > > > AFAIU both suspend and hibernation require the system to enter quiescent > > state with no task potentially interfering with suspended devices. And > > in this particular case those de-thread-ed threads will certainly not > > interfere so silencing the lockdep sounds like a reasonable workaround. > > I still think it would be better to simply not freeze killed user processes. > > We already have things like > > if (test_tsk_thread_flag(p, TIF_MEMDIE)) > return false; > > exactly because we do not want to freeze processes that are about to > die due to being killed. Very similar situation: we don't want to > freeze those processes, because doing so would halt them from freeing > the resources that may be needed for suspend or hibernate. Yeah, we do not freeze oom victims but that is really far from trivial to achieve. In order to do so we post-pone quiescent state until we know all the TIF_MEMDIE threads are gone. See oom_killer_disable. In short it is a painfull code. > How about something like we set PF_NOFREEZE when we set PF_EXITING? At > that point we've pretty much turned into a kernel thread, no? Hmm, that doesn't sound like a bad idea but I am not sure it will help because those threads we are waiting for might be block way before they reached PF_EXITING. I would expect that threads that actually reach that state usually die shortly. Unless I am missing something we are talking about basically two cases here. Those threads are frozen while de_thread waits for them because zap_other_threads cannot wake them from the fridge or they are blocked in uninterruptible sleep somewhere in the kernel. The later is the fundamental problem. The former could be hacked around (check PF_FROZEN and use uninterruptible wake), I guess but I haven't thought that through yet. -- Michal Hocko SUSE Labs